summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2018-10-29 14:44:39 -0700
committerGitHub <noreply@github.com>2018-10-29 14:44:39 -0700
commit725985528f77ba939a5cddc71e5006fee7638465 (patch)
tree9b5d4d90a02e38a7c564e6df1fa2944616cf7913
parent56c9de0ae0f0b37d0c5f50f2b39d6c18362642bb (diff)
Rework command-line options handling for entry points and targets (#697)
* Rework command-line options handling for entry points and targets Overview: * The biggest functionality change is that the implicit ordering constraints when multiple `-entry` options are reversed: any `-stage` option affects the `-entry` to its *left* instead of to its *right* as it used to. This is technically a breaking change, but I expect most users aren't using this feature. * The options parsing tries to handle profile versions and stages as distinct data (rather than using the combined `Profile` type all over), and treats a `-profile` option that specifies both a profile version and a stage (e.g., `-profile ps_5_0`) as if it were sugar for both a `-profile` and a `-stage` (e.g., `-profile sm_5_0 -stage fragment`). * We now technically handle multiple `-target` options in one invocation of `-slangc`, but do not advertise that fact in the documentation because it might be confusing for users. Similar to the relationship between `-stage` and `-entry`, any `-profile` option affects the most recent `-target` option unless there is only one `-target`. * The logic for associating `-o` options with corresponding entry points and targets has been beefed up. The rule is that a `-o` option for a compiled kernel binds to the entry point to its left, unless there is only one entry point (just like for `-stage`). The associated target for a `-o` option is found via a search, however, because otherwise it would be impossible to specify `-o` options for both SPIR-V and DXIL in one pass. * The handling of output paths for entry points in the internal compiler structures was changed, because previously it could only handle one output path per entry point (even when there are multiple targets). The new logic builds up a per-target mapping from an entry point to its desired output path (if any). Details: * Support for formatting profile versions, stages, and compile targets (formats) was added to diagnostic printing, so that we can make better error messages. This is fairly ad hoc, and it would be nice to have all of the string<->enum stuff be more data-driven throughout the codebase. * Test cases were added for (almost) all of the error conditions in the current options validation. The main one that is missing is around specifying an `-entry` option before any source file when compiling multiple files. This is because the test runner is putting the source file name first on the command line automatically, so we can't reproduce that case. * Several reflection-related tests now reflect entry points where they didn't before, because the logic for detecting when to infer a default `main` entry point have been made more loose * On the dxc path, beefed up the handling of mapping from Slang `Profile`s to the coresponding string to use when invoking dxc. * A bunch of tests cases were in violation of the newly imposed rules, so those needed to be cleaned up. * There were also a bunch of test cases that had accidentally gotten "disabled" at some point because there were comparing output from `slangc` both with and without a `-pass-through` option, but that meant that any errors in command-line parsing produced the *same* error output in both the Slang and pass-through cases. This change updates `slang-test` to always expect a successful run for these tests, and then manually updates or disables the various test cases that are affected. * When merging the updated test for matrix layout mode, I found that the new command-line logic was failing to propagate a matrix layout mode passed to `render-test` into the compiler. This was because the `-matrix-layout*` options were implemented as per-target, but the target was being set by API while the option came in via command line (passed through the API). It seems like we want matrix layout mode to be a global option anyway (rather than per-target), so I made that change here. * Add missing expected output files * A 64-bit fix * Remove commented-out code noted in review
-rw-r--r--docs/command-line-slangc.md109
-rw-r--r--slang.h51
-rw-r--r--source/slang/check.cpp27
-rw-r--r--source/slang/compiler.cpp95
-rw-r--r--source/slang/compiler.h33
-rw-r--r--source/slang/diagnostic-defs.h36
-rw-r--r--source/slang/diagnostics.cpp32
-rw-r--r--source/slang/diagnostics.h7
-rw-r--r--source/slang/dxc-support.cpp2
-rw-r--r--source/slang/emit.cpp2
-rw-r--r--source/slang/options.cpp1030
-rw-r--r--source/slang/profile.h16
-rw-r--r--source/slang/slang.cpp33
-rw-r--r--tests/bindings/array-of-struct-of-resource.hlsl2
-rw-r--r--tests/bindings/binding0.hlsl2
-rw-r--r--tests/bindings/binding1.hlsl2
-rw-r--r--tests/bindings/explicit-binding.hlsl2
-rw-r--r--tests/bindings/multi-file.hlsl2
-rw-r--r--tests/bindings/multiple-parameter-blocks.slang2
-rw-r--r--tests/bindings/packoffset.hlsl2
-rw-r--r--tests/bindings/parameter-blocks.slang2
-rw-r--r--tests/bindings/resources-in-cbuffer.hlsl2
-rw-r--r--tests/bindings/resources-in-structs.hlsl.disabled2
-rw-r--r--tests/bindings/targets-and-uavs-structure.hlsl2
-rw-r--r--tests/bindings/targets-and-uavs.hlsl2
-rw-r--r--tests/bugs/array-size-static-const.hlsl2
-rw-r--r--tests/bugs/cbuffer-member-init.hlsl7
-rw-r--r--tests/bugs/do-loop.hlsl2
-rw-r--r--tests/bugs/gh-171.slang10
-rw-r--r--tests/bugs/gh-172.slang18
-rw-r--r--tests/bugs/gh-295.hlsl5
-rw-r--r--tests/bugs/gh-34.hlsl6
-rw-r--r--tests/bugs/implicit-conversion-binary-op.hlsl2
-rw-r--r--tests/bugs/import-overload-error.hlsl4
-rw-r--r--tests/bugs/matrix-mult.glsl4
-rw-r--r--tests/bugs/split-nested-types.hlsl2
-rw-r--r--tests/bugs/uav-write-index.hlsl9
-rw-r--r--tests/bugs/vec-init-list.hlsl2
-rw-r--r--tests/compute/matrix-layout.hlsl2
-rw-r--r--tests/diagnostics/command-line/duplicate-output.slang3
-rw-r--r--tests/diagnostics/command-line/duplicate-output.slang.expected6
-rw-r--r--tests/diagnostics/command-line/duplicate-target.slang3
-rw-r--r--tests/diagnostics/command-line/duplicate-target.slang.expected6
-rw-r--r--tests/diagnostics/command-line/entry-point-conflicting-stage.slang5
-rw-r--r--tests/diagnostics/command-line/entry-point-conflicting-stage.slang.1.expected6
-rw-r--r--tests/diagnostics/command-line/entry-point-conflicting-stage.slang.expected6
-rw-r--r--tests/diagnostics/command-line/entry-point-redundant-stage.slang5
-rw-r--r--tests/diagnostics/command-line/entry-point-redundant-stage.slang.1.expected6
-rw-r--r--tests/diagnostics/command-line/entry-point-redundant-stage.slang.expected6
-rw-r--r--tests/diagnostics/command-line/explicit-implicit-stage-mismatch.vert3
-rw-r--r--tests/diagnostics/command-line/explicit-implicit-stage-mismatch.vert.expected7
-rw-r--r--tests/diagnostics/command-line/option-missing-argument.slang7
-rw-r--r--tests/diagnostics/command-line/option-missing-argument.slang.1.expected6
-rw-r--r--tests/diagnostics/command-line/option-missing-argument.slang.expected6
-rw-r--r--tests/diagnostics/command-line/output-no-entry-point.slang3
-rw-r--r--tests/diagnostics/command-line/output-no-entry-point.slang.expected6
-rw-r--r--tests/diagnostics/command-line/output-no-target.slang3
-rw-r--r--tests/diagnostics/command-line/output-no-target.slang.expected6
-rw-r--r--tests/diagnostics/command-line/pass-through-no-stage.hlsl8
-rw-r--r--tests/diagnostics/command-line/pass-through-no-stage.hlsl.expected6
-rw-r--r--tests/diagnostics/command-line/profile-ignored.slang14
-rw-r--r--tests/diagnostics/command-line/profile-ignored.slang.1.expected6
-rw-r--r--tests/diagnostics/command-line/profile-ignored.slang.expected6
-rw-r--r--tests/diagnostics/command-line/stage-ignored.slang9
-rw-r--r--tests/diagnostics/command-line/stage-ignored.slang.expected6
-rw-r--r--tests/diagnostics/command-line/unknown-codegen-target.slang3
-rw-r--r--tests/diagnostics/command-line/unknown-codegen-target.slang.expected6
-rw-r--r--tests/diagnostics/command-line/unknown-line-directive-mode.slang3
-rw-r--r--tests/diagnostics/command-line/unknown-line-directive-mode.slang.expected6
-rw-r--r--tests/diagnostics/command-line/unknown-option.slang3
-rw-r--r--tests/diagnostics/command-line/unknown-option.slang.expected6
-rw-r--r--tests/diagnostics/command-line/unknown-output-format.slang3
-rw-r--r--tests/diagnostics/command-line/unknown-output-format.slang.expected7
-rw-r--r--tests/diagnostics/command-line/unknown-pass-through-target.slang3
-rw-r--r--tests/diagnostics/command-line/unknown-pass-through-target.slang.expected6
-rw-r--r--tests/diagnostics/command-line/unknown-profile.slang3
-rw-r--r--tests/diagnostics/command-line/unknown-profile.slang.expected6
-rw-r--r--tests/diagnostics/command-line/unknown-source-language.slang5
-rw-r--r--tests/diagnostics/command-line/unknown-source-language.slang.expected6
-rw-r--r--tests/diagnostics/command-line/unknown-stage.slang3
-rw-r--r--tests/diagnostics/command-line/unknown-stage.slang.expected6
-rw-r--r--tests/diagnostics/entry-point-no-stage.slang10
-rw-r--r--tests/diagnostics/entry-point-no-stage.slang.expected6
-rw-r--r--tests/diagnostics/entry-point-stage-mismatch.slang10
-rw-r--r--tests/diagnostics/entry-point-stage-mismatch.slang.expected6
-rw-r--r--tests/diagnostics/gh-38-vs.hlsl2
-rw-r--r--tests/diagnostics/missing-return.slang58
-rw-r--r--tests/diagnostics/missing-return.slang.expected7
-rw-r--r--tests/hlsl/dxsdk/AdaptiveTessellationCS40/Render.hlsl2
-rw-r--r--tests/hlsl/dxsdk/AdaptiveTessellationCS40/ScanCS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_EdgeFactorCS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_NumVerticesIndicesCS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_ScatterIDCS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_TessellateIndicesCS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_TessellateVerticesCS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/BasicCompute11/BasicCompute11.hlsl2
-rw-r--r--tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_PS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_VS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/CascadedShadowMaps11/RenderCascadeScene.hlsl2
-rw-r--r--tests/hlsl/dxsdk/CascadedShadowMaps11/RenderCascadeShadow.hlsl2
-rw-r--r--tests/hlsl/dxsdk/ComputeShaderSort11/ComputeShaderSort11.hlsl2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial02/Tutorial02.fx2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial02/Tutorial02_PS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial02/Tutorial02_VS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial03/Tutorial03.fx2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial03/Tutorial03_PS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial03/Tutorial03_VS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial04/Tutorial04.fx2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial04/Tutorial04_PS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial04/Tutorial04_VS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial05/Tutorial05.fx2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial05/Tutorial05_PS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial05/Tutorial05_VS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06.fx2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06_PS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06_VS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial07/Tutorial07.fx2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial07/Tutorial07_PS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial07/Tutorial07_VS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial08/Tutorial08.fx2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial09/Tutorial09.fx2
-rw-r--r--tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial10/Tutorial10.fx2
-rw-r--r--tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_PS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_VS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/FluidCS11/ComputeShaderSort11.hlsl2
-rw-r--r--tests/hlsl/dxsdk/FluidCS11/FluidCS11.hlsl2
-rw-r--r--tests/hlsl/dxsdk/FluidCS11/FluidRender.hlsl2
-rw-r--r--tests/hlsl/dxsdk/HDRToneMappingCS11/BrightPassAndHorizFilterCS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/HDRToneMappingCS11/DumpToTexture.hlsl2
-rw-r--r--tests/hlsl/dxsdk/HDRToneMappingCS11/FilterCS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/HDRToneMappingCS11/FinalPass.hlsl2
-rw-r--r--tests/hlsl/dxsdk/HDRToneMappingCS11/PSApproach.hlsl2
-rw-r--r--tests/hlsl/dxsdk/HDRToneMappingCS11/ReduceTo1DCS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/HDRToneMappingCS11/ReduceToSingleCS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/HDRToneMappingCS11/skybox11.hlsl2
-rw-r--r--tests/hlsl/dxsdk/MultithreadedRendering11/MultithreadedRendering11_PS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/MultithreadedRendering11/MultithreadedRendering11_VS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/NBodyGravityCS11/NBodyGravityCS11.hlsl2
-rw-r--r--tests/hlsl/dxsdk/NBodyGravityCS11/ParticleDraw.hlsl2
-rw-r--r--tests/hlsl/dxsdk/OIT11/OIT_CS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/OIT11/OIT_PS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/OIT11/SceneVS.hlsl2
-rw-r--r--tests/hlsl/dxsdk/SimpleBezier11/SimpleBezier11.hlsl2
-rw-r--r--tests/hlsl/dxsdk/SimpleSample11/SimpleSample.hlsl2
-rw-r--r--tests/hlsl/dxsdk/SubD11/SubD11.hlsl2
-rw-r--r--tests/hlsl/dxsdk/VarianceShadows11/2DQuadShaders.hlsl2
-rw-r--r--tests/hlsl/dxsdk/VarianceShadows11/RenderVarianceScene.hlsl2
-rw-r--r--tests/hlsl/dxsdk/VarianceShadows11/RenderVarianceShadow.hlsl2
-rw-r--r--tests/hlsl/simple/allow-uav-conditional.hlsl2
-rw-r--r--tests/hlsl/simple/compute-numthreads.hlsl2
-rw-r--r--tests/hlsl/simple/implicit_conversion.hlsl2
-rw-r--r--tests/hlsl/simple/literal-typing.hlsl2
-rw-r--r--tests/ir/string-literal.slang2
-rw-r--r--tests/reflection/cross-compile.slang.expected6
-rw-r--r--tests/reflection/explicit-register-space.slang.expected6
-rw-r--r--tests/reflection/global-type-params.slang.expected6
-rw-r--r--tests/reflection/matrix-layout.slang.1.expected6
-rw-r--r--tests/reflection/matrix-layout.slang.expected6
-rw-r--r--tests/reflection/multi-file.hlsl2
-rw-r--r--tests/reflection/parameter-block.slang2
-rw-r--r--tests/reflection/parameter-block.slang.expected6
-rw-r--r--tests/render/tess.hlsl2
-rw-r--r--tests/rewriter/error0.hlsl5
-rw-r--r--tests/rewriter/gh-160.hlsl4
-rw-r--r--tests/rewriter/type-splitting.hlsl18
-rw-r--r--tools/slang-test/main.cpp18
166 files changed, 1468 insertions, 649 deletions
diff --git a/docs/command-line-slangc.md b/docs/command-line-slangc.md
index 6f7636f19..a37b3138e 100644
--- a/docs/command-line-slangc.md
+++ b/docs/command-line-slangc.md
@@ -13,55 +13,66 @@ Simple Examples
### HLSL
-When compiling an HLSL shader, you must specify the path to your shader code file as well as the "profile" to use.
-To see D3D bytecode assembly for a fragment shader entry point:
+When compiling an HLSL shader, you must specify the path to your shader code file as well as the target shader model (profile) and shader stage to use.
+For example, to see D3D bytecode assembly for a fragment shader entry point:
- slangc my-shader.hlsl -profile ps_5_0
+ slangc my-shader.hlsl -profile sm_5_0 -stage fragment
To direct that output to a bytecode file:
- slangc my-shader.hlsl -profile ps_5_0 -o my-shader.dxbc
+ slangc my-shader.hlsl -profile sm_5_0 -stage fragment -o my-shader.dxbc
If the entry-point function has a name other than the default `main`, then this is specified with `-entry`:
- slangc my-shader.hlsl -profile ps_5_0 -entry psMain
+ slangc my-shader.hlsl -profile sm_5_0 -entry psMain -stage fragment
+
+If you are using the `[shader("...")]` syntax to mark your entry points, then you may leave off the `-stage` option:
+
+ slangc my-shader.hlsl -profile sm_5_0 -entry psMain
### Slang
-Compiling an entry point from a Slang file is similar to HLSL, except that you must specify the profile, the entry-point name, *and* the code generation target.
+Compiling an entry point from a Slang file is similar to HLSL, except that you must also specify a desired code generation target, because there is no assumed default (like DXBC for Direct3D Shader Model 5.x).
To get DXBC assembly written to the console:
- slangc my-shader.slang -profile ps_5_0 -entry main -target dxbc
+ slangc my-shader.slang -profile sm_5_0 -stage fragment -entry main -target dxbc
To get SPIR-V assembly:
- slangc my-shader.slang -profile ps_5_0 -entry main -target spriv
+ slangc my-shader.slang -profile sm_5_0 -stage fragment -entry main -target spriv
The code generation target is implicit when writing to a file with an appropriate extension.
To write DXBC, SPIR-V, or GLSL to files, use:
- slangc my-shader.slang -profile ps_5_0 -entry main -o my-shader.dxbc
- slangc my-shader.slang -profile ps_5_0 -entry main -o my-shader.spv
- slangc my-shader.slang -profile ps_5_0 -entry main -o my-shader.glsl
+ slangc my-shader.slang -profile sm_5_0 -entry main -stage fragment -o my-shader.dxbc
+ slangc my-shader.slang -profile sm_6_0 -entry main -stage fragment -o my-shader.dxil
+ slangc my-shader.slang -profile glsl_450 -entry main -stage fragment -o my-shader.spv
Multiple Entry Points
---------------------
-If you are taking advantage of Slang's ability to automatically assign binding locations to shader parameters (textures, buffers, etc.), then you may need to specify multiple entry points or even multiple files in one compiler invocation.
+`slangc` can compile multiple entry points, which may span multiple files in a single invocation.
+This is useful when you are taking advantage of Slang's ability to automatically assign binding locations to shader parameters, because the compiler can take all of your entry points into account when assigning location (avoiding overlap between entry points that will be used together).
-When compiling HLSL or Slang code, you might have multiple entry points in one file.
-In this case, specify the entry-point-specific options after the file, and make sure that the `-profile` option and any `-o` option precedes the corresponding `-entry` option:
+When specifying multiple entry points, you use multiple `-entry` options on the command line.
+The main thing to be aware of is that any `-stage` options apply to the most recent `-entry` point, and the same goes for any `-o` options to specify per-entry-point output files.
+For example, here is a command line to compile both vertex and fragment shader entry points from a single file and output them to distinct DXBC files:
- slangc my-shader.hlsl -profile vs_5_0 -o my-shader.vs.dxbc -entry vsMain
- -profile ps_5_0 -o my-shader.ps.dxbc -entry psMain
+ slangc -profile sm_5_0 my-shader.hlsl
+ -entry vsMain -stage vertex -o my-shader.vs.dxbc
+ -entry fsMain -stage fragment -o my-shader.fs.dxbc
-If you want to compile multiple GLSL entry points in one pass, you will need multiple files. It is also required to fully specify the profile and entry-point name in this mode.
+If your shader entry points are spread across multiple HLSL files, then each `-entry` option indicates an entry point in the preceding file.
+For example, if the preceding example put its vertex and fragment entry points in distinct files, the command line would be:
- slangc my-shader.vert -profile glsl_vertex -o my-shader.vert.spv -entry main
- my-shader.frag -profile glsl_fragment -o my-shader.frag.spv -entry main
+ slangc -profile sm_5_0 my-shader.vs.hlsl -entry vsMain -stage vertex -o my-shader.vs.dxbc
+ my-shader.fs.hlsl -entry fsMain -stage fragment -o my-shader.fs.dxbc
-These command lines obviously aren't pleasant, but we expect that most applications that need this level of complexity will be using the API.
+Note that when compiling multiple `.slang` files in one invocation, they will all be compiled together as a single module (with a single global namespace) so that the relative order of `-entry` options and source files does not matter.
+
+These long command lines obviously aren't pleasant.
+We encourage applications that require complex shader compilation workflows to use the Slang API directly so that they can implement compilation that follows application conventions/policy.
The ability to specify compilation actions like this on the command line is primarily intended a testing and debugging tool.
Options
@@ -73,35 +84,55 @@ For completeness, here are the options that `slangc` currently accepts:
* The space between `-D` and `<name>` is optional
* If no `<value>` is specified, Slang will define the macro with an empty value
+* `-I <path>`: Add a path to be used in resolving `#include` and `import` operations
+ * The space between `-I` and `<path>` is optional
+
* `-entry <name>`: Specify the name of the entry-point function
- * In single-file compiles for HLSL, this defaults to `main`
- * Multiple `-entry` options may appear on the command line. When they do, the input file path, `-profile` option, and `-o` option that apply for an entry point are each the first one found when scanning to the left from the `-entry` option.
+ * When compiling from a single file, this defaults to `main` *if* you specify a stage using `-stage`
+ * Multiple `-entry` options may appear on the command line. When they do, the file associated with the entry point will be the first one found when searching to the left in the command line.
+
+* `-stage <name>`: Specify the stage of an entry-point function
+ * When there are multiple entry points, a `-stage` option applies to the most recent `-entry` point specified
+ * When there is only a single entry point, the `-stage` option may appear anywhere on the command line
+ * The traditional stages are named as follows:
+ * `vertex`
+ * `hull`: D3D Hull Shader and GL/VK Tessellation Control Shader
+ * `domain`: D3D Domain Shader and GL/VK Tessellation Evaluation Shader
+ * `geometry`
+ * `fragment` / `pixel`: D3D Pixel Shader and GL/VK Fragment Shader
+ * `compute`
+ * The stages for ray tracing use the following names:
+ * `raygeneration`
+ * `intersection`
+ * `anyhit`
+ * `closesthit`
+ * `miss`
+ * `callable`
+
+* `-target <format>`: Specifies the format in which code should be generated. Values for `<target>` are:
+ * `glsl`: GLSL source code
+ * `hlsl`: HLSL source code
+ * `spirv`: SPIR-V intermediate language binary.
+ * `spirv-assembly` / `spirv-asm`: SPIR-V intermediate language assembly
+ * `dxbc`: DirectX shader bytecode binary
+ * `dxbc-assembly` / `dxbc-asm`: DirectX shader bytecode assembly
+ * `dxil`: DirectX Intermediate Language binary
+ * `dxil-assembly` / `dxil-asm`: DirectX Intermediate Language assembly
-* `-I <path>`: Add a path to be used in resolving `#include` and `__import` operations
- * The space between `-I` and `<path>` is optional
+* `-profile <profile>`: Specify the "profile" to use for the code generation target, which represents an abstact feature level as defined by a particular API standard. Available values include:
+ * The Direct3D "Shader Model" levels are available as `sm_{4_0,4_1,5_0,5_1,6_0,6_1,6_2,6_3}`
+ * Profiles corresponding to GLSL langauge versions are available as `glsl_{110,120,130,140,150,330,400,410,420,430,440,450,460}`
+ * As a convenience, names matching traditional HLSL shader profiles are provided such that, e.g., `-profile vs_5_0` is an abbreviation for `-profile sm_5_0 -stage vertex`
* `-o <path>`: Specify a path where generated output should be written
+ * When multiple `-entry` options are present, each `-o` associates with the first `-entry` to its left.
-* `-pass-through <name>`: Don't actually perform Slang parsing/checking/etc. on the input and instead pass it through more or less modified to the existing compiler `<name>`"
+* `-pass-through <name>`: Don't actually perform Slang parsing/checking/etc. on the input and instead pass it through (more or less) unmodified to the existing compiler `<name>`"
* `fxc`: Use the `D3DCompile` API as exposed by `d3dcompiler_47.dll`
* `glslang`: Use Slang's internal version of `glslang` as exposed by `slang-glslang.dll`
* 'dxc': Use DirectXShaderCompiler (https://github.com/Microsoft/DirectXShaderCompiler)
* These are intended for debugging/testing purposes, when you want to be able to see what these existing compilers do with the "same" input and options
-* `-profile <profile>`: Specify the language "profile" to use. This is a combination of the pipeline stage (vertex, fragment, compute, etc.) and an abstract feature level. E.g., the `ps_5_0` profile specifies the fragment stage, with the Direc3D "Shader Model 5" feature level. To summarize the available profiles:
- * The D3D profiles of the form `{cs,ds,gs,hs,ps,vs}_{4_0,4_1,5_0}` are supported
- * The D3D profiles of the form `{vs,ps}_4_0_level_9_{0,1,3}` are supported
- * Profiles of the form `glsl_{vertex,tess_control,tess_eval,geometry,fragment,compute}_<version>` are supported for all GLSL language versions where the corresponding stage is supported (e.g., there is a `glsl_fragment_110`, but the earliest compute profile is `glsl_compute_430`)
- * As a convenience profiles of the form `glsl_{vertex,tess_control,tess_eval,geometry,fragment,compute}` are provided that are intended to map to the latest version of GLSL known to the Slang compiler (curently `450`)
-
-* `-target <target>`: Specifies the desired code-generation target. Values for `<target>` are:
- * `glsl`: GLSL source code
- * `hlsl`: HLSL source code
- * `spirv`: SPIR-V intermediate language binary.
- * `spirv-assembly`: SPIR-V intermediate language assembly
- * `dxbc`: Direct3D shader bytecode binary
- * `dxbc-assembly`: Direct3D shader bytecode assembly
- * `none`: Don't generate output code (but still perform front-end parsing/checking)
* `--`: Stop parsing options, and treat the rest of the command line as input paths
diff --git a/slang.h b/slang.h
index 480c017d4..83aece07f 100644
--- a/slang.h
+++ b/slang.h
@@ -485,6 +485,27 @@ extern "C"
SLANG_MATRIX_LAYOUT_COLUMN_MAJOR,
};
+ typedef SlangUInt32 SlangStage;
+ enum
+ {
+ SLANG_STAGE_NONE,
+ SLANG_STAGE_VERTEX,
+ SLANG_STAGE_HULL,
+ SLANG_STAGE_DOMAIN,
+ SLANG_STAGE_GEOMETRY,
+ SLANG_STAGE_FRAGMENT,
+ SLANG_STAGE_COMPUTE,
+ SLANG_STAGE_RAY_GENERATION,
+ SLANG_STAGE_INTERSECTION,
+ SLANG_STAGE_ANY_HIT,
+ SLANG_STAGE_CLOSEST_HIT,
+ SLANG_STAGE_MISS,
+ SLANG_STAGE_CALLABLE,
+
+ // alias:
+ SLANG_STAGE_PIXEL = SLANG_STAGE_FRAGMENT,
+ };
+
/** A result code for a Slang API operation.
This type is generally compatible with the Windows API `HRESULT` type. In particular, negative values indicate
@@ -856,11 +877,16 @@ extern "C"
int targetIndex,
SlangTargetFlags flags);
+ /* DEPRECATED: use `spSetMatrixLayoutMode` instead. */
SLANG_API void spSetTargetMatrixLayoutMode(
SlangCompileRequest* request,
int targetIndex,
SlangMatrixLayoutMode mode);
+ SLANG_API void spSetMatrixLayoutMode(
+ SlangCompileRequest* request,
+ SlangMatrixLayoutMode mode);
+
/*!
@brief Set the container format to be used for binary output.
*/
@@ -1026,7 +1052,7 @@ extern "C"
SlangCompileRequest* request,
int translationUnitIndex,
char const* name,
- SlangProfileID profile);
+ SlangStage stage);
/** Add an entry point in a particular translation unit,
with additional arguments that specify the concrete
@@ -1036,7 +1062,7 @@ extern "C"
SlangCompileRequest* request,
int translationUnitIndex,
char const* name,
- SlangProfileID profile,
+ SlangStage stage,
int genericTypeNameCount,
char const** genericTypeNames);
@@ -1300,27 +1326,6 @@ extern "C"
SLANG_PARAMETER_CATEGORY_FRAGMENT_OUTPUT = SLANG_PARAMETER_CATEGORY_VARYING_OUTPUT,
};
- typedef SlangUInt32 SlangStage;
- enum
- {
- SLANG_STAGE_NONE,
- SLANG_STAGE_VERTEX,
- SLANG_STAGE_HULL,
- SLANG_STAGE_DOMAIN,
- SLANG_STAGE_GEOMETRY,
- SLANG_STAGE_FRAGMENT,
- SLANG_STAGE_COMPUTE,
- SLANG_STAGE_RAY_GENERATION,
- SLANG_STAGE_INTERSECTION,
- SLANG_STAGE_ANY_HIT,
- SLANG_STAGE_CLOSEST_HIT,
- SLANG_STAGE_MISS,
- SLANG_STAGE_CALLABLE,
-
- // alias:
- SLANG_STAGE_PIXEL = SLANG_STAGE_FRAGMENT,
- };
-
typedef SlangUInt32 SlangLayoutRules;
enum
{
diff --git a/source/slang/check.cpp b/source/slang/check.cpp
index 278ba7b61..dbf2b294c 100644
--- a/source/slang/check.cpp
+++ b/source/slang/check.cpp
@@ -8427,10 +8427,19 @@ namespace Slang
// that function is specific to the fragment profile/stage.
//
+ auto sink = &entryPoint->compileRequest->mSink;
+
+ // Every entry point needs to have a stage specified either via
+ // command-line/API options, or via an explicit `[shader("...")]` attribute.
+ //
+ if( entryPoint->getStage() == Stage::Unknown )
+ {
+ sink->diagnose(entryPoint->decl, Diagnostics::entryPointHasNoStage, entryPoint->name);
+ }
+
if (entryPoint->getStage() == Stage::Hull)
{
auto translationUnit = entryPoint->getTranslationUnit();
- auto sink = &entryPoint->compileRequest->mSink;
auto translationUnitSyntax = translationUnit->SyntaxNode;
auto attr = entryPoint->decl->FindModifier<PatchConstantFuncAttribute>();
@@ -8554,6 +8563,22 @@ namespace Slang
return;
}
+ // If the entry point specifies a stage via a `[shader("...")]` attribute,
+ // then we might be able to infer a stage for the entry point request if
+ // it didn't have one, *or* issue a diagnostic if there is a mismatch.
+ //
+ if( auto entryPointAttribute = entryPointFuncDecl->FindModifier<EntryPointAttribute>() )
+ {
+ if( entryPoint->getStage() == Stage::Unknown )
+ {
+ entryPoint->profile.setStage(entryPointAttribute->stage);
+ }
+ else if( entryPointAttribute->stage != entryPoint->getStage() )
+ {
+ sink->diagnose(entryPointFuncDecl, Diagnostics::specifiedStageDoesntMatchAttribute, entryPoint->name, entryPoint->getStage(), entryPointAttribute->stage);
+ }
+ }
+
// TODO: it is possible that the entry point was declared with
// profile or target overloading. Is there anything that we need
// to do at this point to filter out declarations that aren't
diff --git a/source/slang/compiler.cpp b/source/slang/compiler.cpp
index f16ad06b7..ea1b650a8 100644
--- a/source/slang/compiler.cpp
+++ b/source/slang/compiler.cpp
@@ -139,6 +139,19 @@ namespace Slang
return Profile::Unknown;
}
+ char const* Profile::getName()
+ {
+ switch( raw )
+ {
+ default:
+ return "unknown";
+
+ #define PROFILE(TAG, NAME, STAGE, VERSION) case Profile::TAG: return #NAME;
+ #define PROFILE_ALIAS(TAG, DEF, NAME) /* empty */
+ #include "profile-defs.h"
+ }
+ }
+
Stage findStageByName(String const& name)
{
static const struct
@@ -268,7 +281,7 @@ namespace Slang
}
}
- char const* GetHLSLProfileName(Profile profile)
+ String GetHLSLProfileName(Profile profile)
{
switch( profile.getFamily() )
{
@@ -285,15 +298,56 @@ namespace Slang
break;
}
- switch(profile.raw)
+ char const* stagePrefix = nullptr;
+ switch( profile.GetStage() )
{
- #define PROFILE(TAG, NAME, STAGE, VERSION) case Profile::TAG: return #NAME;
- #include "profile-defs.h"
+ default:
+ return "unknown";
+
+ #define CASE(NAME, PREFIX) case Stage::NAME: stagePrefix = #PREFIX; break
+ CASE(Vertex, vs);
+ CASE(Hull, hs);
+ CASE(Domain, ds);
+ CASE(Geometry, gs);
+ CASE(Fragment, ps);
+ CASE(Compute, cs);
+
+ // Note: dxc requires a `lib` target for all
+ // ray tracing stages.
+ CASE(RayGeneration, lib);
+ CASE(Intersection, lib);
+ CASE(AnyHit, lib);
+ CASE(ClosestHit, lib);
+ CASE(Miss, lib);
+ CASE(Callable, lib);
+ #undef CASE
+ }
+
+ char const* versionSuffix = nullptr;
+ switch(profile.GetVersion())
+ {
+ #define CASE(TAG, SUFFIX) case ProfileVersion::TAG: versionSuffix = #SUFFIX; break
+ CASE(DX_4_0, _4_0);
+ CASE(DX_4_0_Level_9_0, _4_0_level_9_0);
+ CASE(DX_4_0_Level_9_1, _4_0_level_9_1);
+ CASE(DX_4_0_Level_9_3, _4_0_level_9_3);
+ CASE(DX_4_1, _4_1);
+ CASE(DX_5_0, _5_0);
+ CASE(DX_5_1, _5_1);
+ CASE(DX_6_0, _6_0);
+ CASE(DX_6_1, _6_1);
+ CASE(DX_6_2, _6_2);
+ CASE(DX_6_3, _6_3);
+ #undef CASE
default:
- // TODO: emit an error here!
return "unknown";
}
+
+ String result;
+ result.append(stagePrefix);
+ result.append(versionSuffix);
+ return result;
}
#if SLANG_ENABLE_DXBC_SUPPORT
@@ -375,7 +429,7 @@ namespace Slang
dxMacros,
nullptr,
getText(entryPoint->name).begin(),
- GetHLSLProfileName(profile),
+ GetHLSLProfileName(profile).Buffer(),
0,
0,
&codeBlob,
@@ -787,13 +841,12 @@ String dissassembleDXILUsingDXC(
}
static void writeEntryPointResultToFile(
- EntryPointRequest* entryPoint,
- TargetRequest* targetReq,
- UInt entryPointIndex)
+ EntryPointRequest* entryPoint,
+ String const& outputPath,
+ CompileResult const& result)
{
auto compileRequest = entryPoint->compileRequest;
- auto outputPath = entryPoint->outputPath;
- auto result = targetReq->entryPointResults[entryPointIndex];
+
switch (result.format)
{
case ResultFormat::Text:
@@ -837,12 +890,11 @@ String dissassembleDXILUsingDXC(
}
static void writeEntryPointResultToStandardOutput(
- EntryPointRequest* entryPoint,
- TargetRequest* targetReq,
- UInt entryPointIndex)
+ EntryPointRequest* entryPoint,
+ TargetRequest* targetReq,
+ CompileResult const& result)
{
auto compileRequest = entryPoint->compileRequest;
- auto& result = targetReq->entryPointResults[entryPointIndex];
switch (result.format)
{
@@ -924,28 +976,23 @@ String dissassembleDXILUsingDXC(
TargetRequest* targetReq,
UInt entryPointIndex)
{
+ auto outputPath = targetReq->entryPointOutputPaths[entryPointIndex];
auto& result = targetReq->entryPointResults[entryPointIndex];
// Skip the case with no output
if (result.format == ResultFormat::None)
return;
- if (entryPoint->outputPath.Length())
+ if (outputPath.Length())
{
- writeEntryPointResultToFile(entryPoint, targetReq, entryPointIndex);
+ writeEntryPointResultToFile(entryPoint, outputPath, result);
}
else
{
- writeEntryPointResultToStandardOutput(entryPoint, targetReq, entryPointIndex);
+ writeEntryPointResultToStandardOutput(entryPoint, targetReq, result);
}
}
- void emitEntryPoints(
- TargetRequest* /*targetReq*/)
- {
-
- }
-
void generateOutputForTarget(
TargetRequest* targetReq)
{
diff --git a/source/slang/compiler.h b/source/slang/compiler.h
index de099c40b..c62daf228 100644
--- a/source/slang/compiler.h
+++ b/source/slang/compiler.h
@@ -144,23 +144,6 @@ namespace Slang
// supposed to be defined in.
int translationUnitIndex;
- // The output path requested for this entry point.
- // (only used when compiling from the command line)
- //
- // TODO: This should get dropped. When compiling from the
- // command line, the user should be either:
- //
- // * Compiling a single entry point for a single target, so
- // that only a single output path is needed for the whole request.
- //
- // * Compiling for a target that supports multiple entry points directly
- // (e.g., a recent DXIL version), so that only one output file is needed.
- //
- // * Compiling to a slang module container, so that as many entry
- // points and targets as needed can be specified.
- //
- String outputPath;
-
// The translation unit that this entry point came from
TranslationUnitRequest* getTranslationUnit();
@@ -227,7 +210,12 @@ namespace Slang
CompileRequest* compileRequest;
CodeGenTarget target;
SlangTargetFlags targetFlags = 0;
- Slang::Profile targetProfile = Slang::Profile::Unknown;
+ Slang::Profile targetProfile = Slang::Profile();
+
+ // Requested output paths for each entry point.
+ // An empty string indices no output desired for
+ // the given entry point.
+ List<String> entryPointOutputPaths;
// The resulting reflection layout information
RefPtr<ProgramLayout> layout;
@@ -240,9 +228,7 @@ namespace Slang
// TypeLayouts created on the fly by reflection API
Dictionary<Type*, RefPtr<TypeLayout>> typeLayouts;
- /// The layout to use for matrices by default (row/column major)
- MatrixLayoutMode defaultMatrixLayoutMode = kMatrixLayoutMode_ColumnMajor;
- MatrixLayoutMode getDefaultMatrixLayoutMode() { return defaultMatrixLayoutMode; }
+ MatrixLayoutMode getDefaultMatrixLayoutMode();
};
// Compute the "effective" profile to use when outputting the given entry point
@@ -324,8 +310,9 @@ namespace Slang
// Types constructed by reflection API
Dictionary<String, RefPtr<Type>> types;
- // The code generation profile we've been asked to use.
- Profile profile;
+ /// The layout to use for matrices by default (row/column major)
+ MatrixLayoutMode defaultMatrixLayoutMode = kMatrixLayoutMode_ColumnMajor;
+ MatrixLayoutMode getDefaultMatrixLayoutMode() { return defaultMatrixLayoutMode; }
// Should we just pass the input to another compiler?
PassThroughMode passThrough = PassThroughMode::None;
diff --git a/source/slang/diagnostic-defs.h b/source/slang/diagnostic-defs.h
index 89db9d0e3..a32dbb315 100644
--- a/source/slang/diagnostic-defs.h
+++ b/source/slang/diagnostic-defs.h
@@ -61,7 +61,6 @@ DIAGNOSTIC( 7, Error, noOutputPathSpecifiedForEntryPoint,
DIAGNOSTIC( 8, Error, outputPathsImplyDifferentFormats,
"the output paths '$0' and '$1' require different code-generation targets")
-DIAGNOSTIC( 9, Error, cannotDeduceOutputFormatFromPath, "cannot deduce an output format from the output path '$0'")
DIAGNOSTIC( 10, Error, explicitOutputPathsAndMultipleTargets, "canot use both explicit output paths ('-o') and multiple targets ('-target')")
DIAGNOSTIC( 11, Error, glslIsNotSupported, "the Slang compiler does not support GLSL as a source language");
DIAGNOSTIC( 12, Error, cannotDeduceSourceLanguage, "can't deduce language for input file '$0'");
@@ -70,14 +69,36 @@ DIAGNOSTIC( 14, Error, unknownProfile, "unknown profile '$0'");
DIAGNOSTIC( 15, Error, unknownStage, "unknown stage '$0'");
DIAGNOSTIC( 16, Error, unknownPassThroughTarget, "unknown pass-through target '$0'");
DIAGNOSTIC( 17, Error, unknownCommandLineOption, "unknown command-line option '$0'");
-DIAGNOSTIC( 18, Error, noProfileSpecified, "no profile specified; use the '-profile <profile name>' option");
-DIAGNOSTIC( 19, Error, multipleEntryPointsNeedMulitpleProfiles, "when specifying multiple profiles on the command line, each '-entry' option must be preceded by a '-profile' option");
-DIAGNOSTIC( 20, Error, multipleTranslationUnitsNeedEntryPoints, "when using multiple translation units, entry points must be specified after their translation unit file(s)");
+DIAGNOSTIC( 20, Error, entryPointsNeedToBeAssociatedWithTranslationUnits, "when using multiple source files, entry points must be specified after their corresponding source file(s)");
DIAGNOSTIC( 21, Error, expectedArgumentForOption, "expected an argument for command-line option '$0'");
-DIAGNOSTIC( 22, Error, noStageSpecified, "no stage specified; use the '-stage <stage name>' option");
-DIAGNOSTIC( 23, Error, multipleEntryPointsNeedMulitpleStages, "when multiple entry points are specified on the command line, each '-entry' point must be given a stage by a preceding '-stage' option");
+
DIAGNOSTIC( 24, Error, unknownLineDirectiveMode, "unknown '#line' directive mode '$0'");
+DIAGNOSTIC( 30, Error, sameStageSpecifiedMoreThanOnce, "the stage '$0' was specified more than once for entry point '$1'")
+DIAGNOSTIC( 31, Error, conflictingStagesForEntryPoint, "conflicting stages have been specified for entry point '$0'")
+DIAGNOSTIC( 32, Warning, explicitStageDoesntMatchImpliedStage, "the stage specified for entry point '$0' ('$1') does not match the stage implied by the source file name ('$2')")
+DIAGNOSTIC( 33, Error, stageSpecificationIgnoredBecauseNoEntryPoints, "one or more stages were specified, but no entry points were specified with '-entry'")
+DIAGNOSTIC( 34, Error, stageSpecificationIgnoredBecauseBeforeAllEntryPoints, "when compiling multiple entry points, any '-stage' options must follow the '-entry' option that they apply to")
+DIAGNOSTIC( 35, Error, noStageSpecifiedInPassThroughMode, "no stage was specified for entry point '$0'; when using the '-pass-through' option, stages must be fully specified on the command line")
+
+DIAGNOSTIC( 40, Warning, sameProfileSpecifiedMoreThanOnce, "the '$0' was specified more than once for target '$0'")
+DIAGNOSTIC( 41, Error, conflictingProfilesSpecifiedForTarget, "conflicting profiles have been specified for target '$0'")
+
+DIAGNOSTIC( 42, Error, profileSpecificationIgnoredBecauseNoTargets, "a '-profile' option was specified, but no target was specified with '-target'")
+DIAGNOSTIC( 43, Error, profileSpecificationIgnoredBecauseBeforeAllTargets, "when using multiple targets, any '-profile' option must follow the '-target' it applies to")
+
+DIAGNOSTIC( 42, Error, targetFlagsIgnoredBecauseNoTargets, "target options were specified, but no target was specified with '-target'")
+DIAGNOSTIC( 43, Error, targetFlagsIgnoredBecauseBeforeAllTargets, "when using multiple targets, any target options must follow the '-target' they apply to")
+
+DIAGNOSTIC( 50, Error, duplicateTargets, "the target '$0' has been specified more than once")
+
+DIAGNOSTIC( 60, Error, cannotDeduceOutputFormatFromPath, "cannot infer an output format from the output path '$0'")
+DIAGNOSTIC( 61, Error, cannotMatchOutputFileToTarget, "no specified '-target' option matches the output path '$0', which implies the '$1' format")
+
+DIAGNOSTIC( 70, Error, cannotMatchOutputFileToEntryPoint, "the output path '$0' is not associated with any entry point; a '-o' option for a compiled kernel must follow the '-entry' option for its corresponding entry point")
+
+DIAGNOSTIC( 80, Error, duplicateOutputPathsForEntryPointAndTarget, "multiple output paths have been specified entry point '$0' on target '$1'")
+
//
// 1xxxx - Lexical anaylsis
//
@@ -306,6 +327,9 @@ DIAGNOSTIC(38003, Error, entryPointSymbolNotAFunction, "entry point '$0' must be
DIAGNOSTIC(38004, Error, entryPointTypeParameterNotFound, "no type found matching entry-point type parameter name '$0'")
DIAGNOSTIC(38005, Error, entryPointTypeSymbolNotAType, "entry-point type parameter '$0' must be declared as a type")
+DIAGNOSTIC(38006, Warning, specifiedStageDoesntMatchAttribute, "entry point '$0' being compiled for the '$1' stage has a '[shader(...)]' attribute that specifies the '$2' stage")
+DIAGNOSTIC(38007, Error, entryPointHasNoStage, "no stage specified for entry point '$0'; use either a '[shader(\"name\")]' function attribute or the '-stage <name>' command-line option to specify a stage")
+
DIAGNOSTIC(38100, Error, typeDoesntImplementInterfaceRequirement, "type '$0' does not provide required interface member '$1'")
DIAGNOSTIC(38101, Error, thisExpressionOutsideOfTypeDecl, "'this' expression can only be used in members of an aggregate type")
DIAGNOSTIC(38102, Error, initializerNotInsideType, "an 'init' declaration is only allowed inside a type or 'extension' declaration")
diff --git a/source/slang/diagnostics.cpp b/source/slang/diagnostics.cpp
index 7271c04d3..f1d0b63f9 100644
--- a/source/slang/diagnostics.cpp
+++ b/source/slang/diagnostics.cpp
@@ -84,6 +84,38 @@ void printDiagnosticArg(StringBuilder& sb, Token const& token)
sb << token.Content;
}
+void printDiagnosticArg(StringBuilder& sb, CodeGenTarget val)
+{
+ switch( val )
+ {
+ default:
+ sb << "<unknown>";
+ break;
+
+#define CASE(TAG, STR) case CodeGenTarget::TAG: sb << STR; break
+ CASE(GLSL, "glsl");
+ CASE(HLSL, "hlsl");
+ CASE(SPIRV, "spirv");
+ CASE(SPIRVAssembly, "spriv-assembly");
+ CASE(DXBytecode, "dxbc");
+ CASE(DXBytecodeAssembly, "dxbc-assembly");
+ CASE(DXIL, "dxil");
+ CASE(DXILAssembly, "dxil-assembly");
+#undef CASE
+ }
+}
+
+void printDiagnosticArg(StringBuilder& sb, Stage val)
+{
+ sb << getStageName(val);
+}
+
+void printDiagnosticArg(StringBuilder& sb, ProfileVersion val)
+{
+ sb << Profile(val).getName();
+}
+
+
SourceLoc const& getDiagnosticPos(SyntaxNode const* syntax)
{
return syntax->loc;
diff --git a/source/slang/diagnostics.h b/source/slang/diagnostics.h
index a12de03e4..945dc6c73 100644
--- a/source/slang/diagnostics.h
+++ b/source/slang/diagnostics.h
@@ -73,6 +73,10 @@ namespace Slang
struct TypeExp;
struct QualType;
+ enum class CodeGenTarget;
+ enum class Stage : SlangStage;
+ enum class ProfileVersion;
+
void printDiagnosticArg(StringBuilder& sb, char const* str);
void printDiagnosticArg(StringBuilder& sb, int val);
void printDiagnosticArg(StringBuilder& sb, UInt val);
@@ -85,6 +89,9 @@ namespace Slang
void printDiagnosticArg(StringBuilder& sb, QualType const& type);
void printDiagnosticArg(StringBuilder& sb, TokenType tokenType);
void printDiagnosticArg(StringBuilder& sb, Token const& token);
+ void printDiagnosticArg(StringBuilder& sb, CodeGenTarget val);
+ void printDiagnosticArg(StringBuilder& sb, Stage val);
+ void printDiagnosticArg(StringBuilder& sb, ProfileVersion val);
template<typename T>
void printDiagnosticArg(StringBuilder& sb, RefPtr<T> ptr)
diff --git a/source/slang/dxc-support.cpp b/source/slang/dxc-support.cpp
index b86330f20..98f099d4e 100644
--- a/source/slang/dxc-support.cpp
+++ b/source/slang/dxc-support.cpp
@@ -28,7 +28,7 @@
namespace Slang
{
- char const* GetHLSLProfileName(Profile profile);
+ String GetHLSLProfileName(Profile profile);
String emitHLSLForEntryPoint(
EntryPointRequest* entryPoint,
TargetRequest* targetReq);
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp
index 1c02b64ef..f8d90bc2e 100644
--- a/source/slang/emit.cpp
+++ b/source/slang/emit.cpp
@@ -1969,7 +1969,7 @@ struct EmitVisitor
// then types/variables defined in those modules should be emitted in
// a way that is consistent with that layout...
- auto matrixLayoutMode = targetReq->defaultMatrixLayoutMode;
+ auto matrixLayoutMode = targetReq->getDefaultMatrixLayoutMode();
switch(context->shared->target)
{
diff --git a/source/slang/options.cpp b/source/slang/options.cpp
index 944f66403..485b7d78b 100644
--- a/source/slang/options.cpp
+++ b/source/slang/options.cpp
@@ -43,74 +43,142 @@ struct OptionsParser
Slang::CompileRequest* requestImpl = nullptr;
+ // A "translation unit" represents one or more source files
+ // that are processed as a single entity when it comes to
+ // semantic checking.
+ //
+ // For languages like HLSL, GLSL, and C, a translation unit
+ // is usually a single source file (which can then go on
+ // to `#include` other files into the same translation unit).
+ //
+ // For Slang, we support having multiple source files in
+ // a single translation unit, and indeed command-line `slangc`
+ // will always put all the source files into a single translation
+ // unit.
+ //
+ // We track information on the translation units that we
+ // create during options parsing, so that we can assocaite
+ // other entities with these translation units:
+ //
struct RawTranslationUnit
{
+ // What language is the translation unit using?
+ //
+ // Note: We do not support translation units that mix
+ // languages.
+ //
SlangSourceLanguage sourceLanguage;
- SlangProfileID implicitProfile;
- int translationUnitIndex;
- };
- // Collect translation units so that we can futz with them later
- List<RawTranslationUnit> rawTranslationUnits;
+ // Certain naming conventions imply a stage for
+ // a file with only a single entry point, and in
+ // those cases we will try to infer the stage from
+ // the file when it is possible.
+ //
+ Stage impliedStage;
- struct RawEntryPoint
- {
- String name;
- Profile profile;
- int translationUnitIndex = -1;
- int outputPathIndex = -1;
+ // We retain the Slang API level translation unit index,
+ // which we will call an "ID" inside the options parsing code.
+ //
+ // This will almost always be the index into the
+ // `rawTranslationUnits` array below, but could conceivably,
+ // be mismatched if we were parsing options for a compile
+ // request that already had some translation unit(s) added
+ // manually.
+ //
+ int translationUnitID;
};
+ List<RawTranslationUnit> rawTranslationUnits;
- // Collect entry point names, so that we can associate them
- // with entry points later...
- List<RawEntryPoint> rawEntryPoints;
+ // If we already have a translation unit for Slang code, then this will give its index.
+ // If not, it will be `-1`.
+ int slangTranslationUnitIndex = -1;
// The number of input files that have been specified
int inputPathCount = 0;
- // If we already have a translation unit for Slang code, then this will give its index.
- // If not, it will be `-1`.
- int slangTranslationUnit = -1;
-
int translationUnitCount = 0;
- int currentTranslationUnitIndex = -1;
-
- // The currently specified '-profile' and/or '-stage' options.
- Profile currentProfile = Profile::Unknown;
+ int currentTranslationUnitIndex= -1;
+
+ // An entry point represents a function to be checked and possibly have
+ // code generated in one of our translation units. An entry point
+ // needs to have an assocaited stage, which might come via the
+ // `-stage` command line option, or a `[shader("...")]` attribute
+ // in the source code.
+ //
+ struct RawEntryPoint
+ {
+ String name;
+ Stage stage = Stage::Unknown;
+ int translationUnitIndex = -1;
+ int entryPointID = -1;
+
+ // State for tracking command-line errors
+ bool conflictingStagesSet = false;
+ bool redundantStageSet = false;
+ };
+ //
+ // We collect the entry points in a "raw" array so that we can
+ // possibly associate them with a stage or translation unit
+ // after the fact.
+ //
+ List<RawEntryPoint> rawEntryPoints;
- // How many times were `-profile` and '-stage' options given?
- int profileOptionCount = 0;
- int stageOptionCount = 0;
+ // In the case where we have only a single entry point,
+ // the entry point and its options might be specified out
+ // of order, so we will keep a single `RawEntryPoint` around
+ // and use it as the target for any state-setting options
+ // before the first "proper" entry point is specified.
+ RawEntryPoint defaultEntryPoint;
SlangCompileFlags flags = 0;
- SlangTargetFlags targetFlags = 0;
- struct RawOutputPath
+ struct RawOutput
{
- String path;
- SlangCompileTarget target;
+ String path;
+ CodeGenTarget impliedFormat = CodeGenTarget::Unknown;
+ int targetIndex = -1;
+ int entryPointIndex = -1;
};
+ List<RawOutput> rawOutputs;
- List<RawOutputPath> rawOutputPaths;
+ struct RawTarget
+ {
+ CodeGenTarget format = CodeGenTarget::Unknown;
+ ProfileVersion profileVersion = ProfileVersion::Unknown;
+ SlangTargetFlags targetFlags = 0;
+ int targetID = -1;
- SlangCompileTarget chosenTarget = SLANG_TARGET_NONE;
+ // State for tracking command-line errors
+ bool conflictingProfilesSet = false;
+ bool redundantProfileSet = false;
+
+ };
+ List<RawTarget> rawTargets;
+
+ RawTarget defaultTarget;
int addTranslationUnit(
SlangSourceLanguage language,
- SlangProfileID implicitProfile = SLANG_PROFILE_UNKNOWN)
+ Stage impliedStage)
{
- auto translationUnitIndex = spAddTranslationUnit(compileRequest, language, nullptr);
+ auto translationUnitIndex = rawTranslationUnits.Count();
+ auto translationUnitID = spAddTranslationUnit(compileRequest, language, nullptr);
- SLANG_RELEASE_ASSERT(UInt(translationUnitIndex) == rawTranslationUnits.Count());
+ // As a sanity check: the API should be returning the same translation
+ // unit index as we maintain internally. This invariant would only
+ // be broken if we decide to support a mix of translation units specified
+ // via API, and ones specified via command-line arguments.
+ //
+ SLANG_RELEASE_ASSERT(UInt(translationUnitID) == translationUnitIndex);
RawTranslationUnit rawTranslationUnit;
rawTranslationUnit.sourceLanguage = language;
- rawTranslationUnit.implicitProfile = implicitProfile;
- rawTranslationUnit.translationUnitIndex = translationUnitIndex;
+ rawTranslationUnit.translationUnitID = translationUnitID;
+ rawTranslationUnit.impliedStage = impliedStage;
rawTranslationUnits.Add(rawTranslationUnit);
- return translationUnitIndex;
+ return int(translationUnitIndex);
}
void addInputSlangPath(
@@ -118,32 +186,32 @@ struct OptionsParser
{
// All of the input .slang files will be grouped into a single logical translation unit,
// which we create lazily when the first .slang file is encountered.
- if( slangTranslationUnit == -1 )
+ if( slangTranslationUnitIndex == -1 )
{
translationUnitCount++;
- slangTranslationUnit = addTranslationUnit(SLANG_SOURCE_LANGUAGE_SLANG);
+ slangTranslationUnitIndex = addTranslationUnit(SLANG_SOURCE_LANGUAGE_SLANG, Stage::Unknown);
}
spAddTranslationUnitSourceFile(
compileRequest,
- slangTranslationUnit,
+ rawTranslationUnits[slangTranslationUnitIndex].translationUnitID,
path.begin());
// Set the translation unit to be used by subsequent entry points
- currentTranslationUnitIndex = slangTranslationUnit;
+ currentTranslationUnitIndex = slangTranslationUnitIndex;
}
void addInputForeignShaderPath(
String const& path,
SlangSourceLanguage language,
- SlangProfileID implicitProfile = SLANG_PROFILE_UNKNOWN)
+ Stage impliedStage)
{
translationUnitCount++;
- currentTranslationUnitIndex = addTranslationUnit(language, implicitProfile);
+ currentTranslationUnitIndex = addTranslationUnit(language, impliedStage);
spAddTranslationUnitSourceFile(
compileRequest,
- currentTranslationUnitIndex,
+ rawTranslationUnits[currentTranslationUnitIndex].translationUnitID,
path.begin());
}
@@ -175,25 +243,39 @@ struct OptionsParser
return Profile::Unknown;
}
- static SlangSourceLanguage findSourceLanguageFromPath(const String& path, SlangProfileID* profileOut)
+ static SlangSourceLanguage findSourceLanguageFromPath(const String& path, Stage& outImpliedStage)
{
- *profileOut = SLANG_PROFILE_UNKNOWN;
-
- if (path.EndsWith(".hlsl") ||
- path.EndsWith(".fx"))
+ struct Entry
{
- return SLANG_SOURCE_LANGUAGE_HLSL;
- }
- if (path.EndsWith(".glsl"))
+ const char* ext;
+ SlangSourceLanguage sourceLanguage;
+ SlangStage impliedStage;
+ };
+
+ static const Entry entries[] =
{
- return SLANG_SOURCE_LANGUAGE_GLSL;
- }
+ { ".slang", SLANG_SOURCE_LANGUAGE_SLANG, SLANG_STAGE_NONE },
+
+ { ".hlsl", SLANG_SOURCE_LANGUAGE_HLSL, SLANG_STAGE_NONE },
+ { ".fx", SLANG_SOURCE_LANGUAGE_HLSL, SLANG_STAGE_NONE },
+
+ { ".glsl", SLANG_SOURCE_LANGUAGE_GLSL, SLANG_STAGE_NONE },
+ { ".vert", SLANG_SOURCE_LANGUAGE_GLSL, SLANG_STAGE_VERTEX },
+ { ".frag", SLANG_SOURCE_LANGUAGE_GLSL, SLANG_STAGE_FRAGMENT },
+ { ".geom", SLANG_SOURCE_LANGUAGE_GLSL, SLANG_STAGE_GEOMETRY },
+ { ".tesc", SLANG_SOURCE_LANGUAGE_GLSL, SLANG_STAGE_HULL },
+ { ".tese", SLANG_SOURCE_LANGUAGE_GLSL, SLANG_STAGE_DOMAIN },
+ { ".comp", SLANG_SOURCE_LANGUAGE_GLSL, SLANG_STAGE_COMPUTE },
+ };
- Profile::RawVal profile = findGlslProfileFromPath(path);
- if (profile != Profile::Unknown)
+ for (int i = 0; i < SLANG_COUNT_OF(entries); ++i)
{
- *profileOut = SlangProfileID(profile);
- return SLANG_SOURCE_LANGUAGE_GLSL;
+ const Entry& entry = entries[i];
+ if (path.EndsWith(entry.ext))
+ {
+ outImpliedStage = Stage(entry.impliedStage);
+ return entry.sourceLanguage;
+ }
}
return SLANG_SOURCE_LANGUAGE_UNKNOWN;
}
@@ -213,9 +295,9 @@ struct OptionsParser
addInputSlangPath(path);
return SLANG_OK;
}
-
- SlangProfileID profileID;
- SlangSourceLanguage sourceLanguage = findSourceLanguageFromPath(path, &profileID);
+
+ Stage impliedStage = Stage::Unknown;
+ SlangSourceLanguage sourceLanguage = findSourceLanguageFromPath(path, impliedStage);
if (sourceLanguage == SLANG_SOURCE_LANGUAGE_UNKNOWN)
{
@@ -223,20 +305,19 @@ struct OptionsParser
return SLANG_FAIL;
}
- addInputForeignShaderPath(path, sourceLanguage, profileID);
+ addInputForeignShaderPath(path, sourceLanguage, impliedStage);
return SLANG_OK;
}
void addOutputPath(
- String const& path,
- SlangCompileTarget target)
+ String const& path,
+ CodeGenTarget impliedFormat)
{
- RawOutputPath rawOutputPath;
- rawOutputPath.path = path;
- rawOutputPath.target = target;
-
- rawOutputPaths.Add(rawOutputPath);
+ RawOutput rawOutput;
+ rawOutput.path = path;
+ rawOutput.impliedFormat = impliedFormat;
+ rawOutputs.Add(rawOutput);
}
void addOutputPath(char const* inPath)
@@ -245,7 +326,7 @@ struct OptionsParser
if (!inPath) {}
#define CASE(EXT, TARGET) \
- else if(path.EndsWith(EXT)) do { addOutputPath(path, SLANG_##TARGET); } while(0)
+ else if(path.EndsWith(EXT)) do { addOutputPath(path, CodeGenTarget(SLANG_##TARGET)); } while(0)
CASE(".hlsl", HLSL);
CASE(".fx", HLSL);
@@ -253,6 +334,9 @@ struct OptionsParser
CASE(".dxbc", DXBC);
CASE(".dxbc.asm", DXBC_ASM);
+ CASE(".dxil", DXIL);
+ CASE(".dxil.asm", DXIL_ASM);
+
CASE(".glsl", GLSL);
CASE(".vert", GLSL);
CASE(".frag", GLSL);
@@ -275,8 +359,47 @@ struct OptionsParser
{
// Allow an unknown-format `-o`, assuming we get a target format
// from another argument.
- addOutputPath(path, SLANG_TARGET_UNKNOWN);
+ addOutputPath(path, CodeGenTarget::Unknown);
+ }
+ }
+
+ RawEntryPoint* getCurrentEntryPoint()
+ {
+ auto rawEntryPointCount = rawEntryPoints.Count();
+ return rawEntryPointCount ? &rawEntryPoints[rawEntryPointCount-1] : &defaultEntryPoint;
+ }
+
+ void setStage(RawEntryPoint* rawEntryPoint, Stage stage)
+ {
+ if(rawEntryPoint->stage != Stage::Unknown)
+ {
+ rawEntryPoint->redundantStageSet = true;
+ if( stage != rawEntryPoint->stage )
+ {
+ rawEntryPoint->conflictingStagesSet = true;
+ }
+ }
+ rawEntryPoint->stage = stage;
+ }
+
+ RawTarget* getCurrentTarget()
+ {
+ auto rawTargetCount = rawTargets.Count();
+ return rawTargetCount ? &rawTargets[rawTargetCount-1] : &defaultTarget;
+ }
+
+ void setProfileVersion(RawTarget* rawTarget, ProfileVersion profileVersion)
+ {
+ if(rawTarget->profileVersion != ProfileVersion::Unknown)
+ {
+ rawTarget->redundantProfileSet = true;
+
+ if(profileVersion != rawTarget->profileVersion)
+ {
+ rawTarget->conflictingProfilesSet = true;
+ }
}
+ rawTarget->profileVersion = profileVersion;
}
SlangResult parse(
@@ -300,14 +423,6 @@ struct OptionsParser
{
String argStr = String(arg);
- // The argument looks like an option, so try to parse it.
-// if (argStr == "-outdir")
-// outputDir = tryReadCommandLineArgument(arg, &argCursor, argEnd);
-// if (argStr == "-out")
-// options.outputName = tryReadCommandLineArgument(arg, &argCursor, argEnd);
-// else if (argStr == "-symbo")
-// options.SymbolToCompile = tryReadCommandLineArgument(arg, &argCursor, argEnd);
- //else
if(argStr == "-no-mangle" )
{
flags |= SLANG_COMPILE_FLAG_NO_MANGLING;
@@ -334,65 +449,45 @@ struct OptionsParser
}
else if(argStr == "-parameter-blocks-use-register-spaces" )
{
- targetFlags |= SLANG_TARGET_FLAG_PARAMETER_BLOCKS_USE_REGISTER_SPACES;
+ getCurrentTarget()->targetFlags |= SLANG_TARGET_FLAG_PARAMETER_BLOCKS_USE_REGISTER_SPACES;
}
- else if (argStr == "-backend" || argStr == "-target")
+ else if (argStr == "-target")
{
String name;
SLANG_RETURN_ON_FAIL(tryReadCommandLineArgument(sink, arg, &argCursor, argEnd, name));
- SlangCompileTarget target = SLANG_TARGET_UNKNOWN;
+ SlangCompileTarget format = SLANG_TARGET_UNKNOWN;
- if (name == "glsl")
- {
- target = SLANG_GLSL;
- }
- else if (name == "glsl_vk")
- {
- target = SLANG_GLSL_VULKAN;
- }
-// else if (name == "glsl_vk_onedesc")
-// {
-// options.Target = CodeGenTarget::GLSL_Vulkan_OneDesc;
-// }
- else if (name == "hlsl")
- {
- target = SLANG_HLSL;
- }
- else if (name == "spriv")
- {
- target = SLANG_SPIRV;
- }
- else if (name == "dxbc")
- {
- target = SLANG_DXBC;
- }
- else if (name == "dxbc-assembly")
- {
- target = SLANG_DXBC_ASM;
- }
#define CASE(NAME, TARGET) \
- else if(name == #NAME) do { target = SLANG_##TARGET; } while(0)
-
- CASE(spirv, SPIRV);
- CASE(spirv-assembly, SPIRV_ASM);
- CASE(dxil, DXIL);
- CASE(dxil-assembly, DXIL_ASM);
- CASE(none, TARGET_NONE);
+ if(name == NAME) { format = SLANG_##TARGET; } else
+
+ CASE("hlsl", HLSL)
+ CASE("glsl", GLSL)
+ CASE("dxbc", DXBC)
+ CASE("dxbc-assembly", DXBC_ASM)
+ CASE("dxbc-asm", DXBC_ASM)
+ CASE("spirv", SPIRV)
+ CASE("spirv-assembly", SPIRV_ASM)
+ CASE("spirv-asm", SPIRV_ASM)
+ CASE("dxil", DXIL)
+ CASE("dxil-assembly", DXIL_ASM)
+ CASE("dxil-asm", DXIL_ASM)
#undef CASE
-
- else
+ /* else */
{
sink->diagnose(SourceLoc(), Diagnostics::unknownCodeGenerationTarget, name);
return SLANG_FAIL;
}
- this->chosenTarget = target;
- spSetCodeGenTarget(compileRequest, target);
+ RawTarget rawTarget;
+ rawTarget.format = CodeGenTarget(format);
+
+ rawTargets.Add(rawTarget);
}
- // A "profile" specifies both a specific target stage and a general level
- // of capability required by the program.
+ // A "profile" can specify both a general capability level for
+ // a target, and also (as a legacy/compatibility feature) a
+ // specific stage to use for an entry point.
else if (argStr == "-profile")
{
String name;
@@ -406,16 +501,16 @@ struct OptionsParser
}
else
{
- auto newProfile = Profile(profileID);
- currentProfile.setVersion(newProfile.GetVersion());
- profileOptionCount++;
+ auto profile = Profile(profileID);
+
+ setProfileVersion(getCurrentTarget(), profile.GetVersion());
// A `-profile` option that also specifies a stage (e.g., `-profile vs_5_0`)
// should be treated like a composite (e.g., `-profile sm_5_0 -stage vertex`)
- if(newProfile.GetStage() != Stage::Unknown)
+ auto stage = profile.GetStage();
+ if(stage != Stage::Unknown)
{
- currentProfile.setStage(newProfile.GetStage());
- stageOptionCount++;
+ setStage(getCurrentEntryPoint(), stage);
}
}
}
@@ -432,8 +527,7 @@ struct OptionsParser
}
else
{
- currentProfile.setStage(stage);
- stageOptionCount++;
+ setStage(getCurrentEntryPoint(), stage);
}
}
else if (argStr == "-entry")
@@ -441,38 +535,12 @@ struct OptionsParser
String name;
SLANG_RETURN_ON_FAIL(tryReadCommandLineArgument(sink, arg, &argCursor, argEnd, name));
- RawEntryPoint entry;
- entry.name = name;
- entry.translationUnitIndex = currentTranslationUnitIndex;
-
- int outputPathCount = (int) rawOutputPaths.Count();
- int currentOutputPathIndex = outputPathCount - 1;
- entry.outputPathIndex = currentOutputPathIndex;
-
- entry.profile = currentProfile;
+ RawEntryPoint rawEntryPoint;
+ rawEntryPoint.name = name;
+ rawEntryPoint.translationUnitIndex = currentTranslationUnitIndex;
- rawEntryPoints.Add(entry);
+ rawEntryPoints.Add(rawEntryPoint);
}
-#if 0
- else if (argStr == "-stage")
- {
- String name;
- SLANG_RETURN_ON_FAIL(tryReadCommandLineArgument(sink, arg, &argCursor, argEnd, name));
-
- StageTarget stage = StageTarget::Unknown;
- if (name == "vertex") { stage = StageTarget::VertexShader; }
- else if (name == "fragment") { stage = StageTarget::FragmentShader; }
- else if (name == "hull") { stage = StageTarget::HullShader; }
- else if (name == "domain") { stage = StageTarget::DomainShader; }
- else if (name == "compute") { stage = StageTarget::ComputeShader; }
- else
- {
- sink->diagnose(SourceLoc(), Diagnostics::unknownStage, name);
- return SLANG_FAIL;
- }
- options.stage = stage;
- }
-#endif
else if (argStr == "-pass-through")
{
String name;
@@ -492,8 +560,6 @@ struct OptionsParser
compileRequest,
passThrough);
}
-// else if (argStr == "-genchoice")
-// options.Mode = CompilerMode::GenerateChoice;
else if (argStr[1] == 'D')
{
// The value to be defined might be part of the same option, as in:
@@ -619,329 +685,491 @@ struct OptionsParser
spSetCompileFlags(compileRequest, flags);
- // TODO(tfoley): This kind of validation needs to wait until
- // after all options have been specified for API usage
-#if 0
- if (inputPathCount == 0)
+ // As a compatability feature, if the user didn't list any explicit entry
+ // point names, *and* they are compiling a single translation unit, *and* they
+ // have either specified a stage, or we can assume one from the naming
+ // of the translation unit, then we assume they wanted to compile a single
+ // entry point named `main`.
+ //
+ if(rawEntryPoints.Count() == 0
+ && rawTranslationUnits.Count() == 1
+ && (defaultEntryPoint.stage != Stage::Unknown
+ || rawTranslationUnits[0].impliedStage != Stage::Unknown))
{
- fprintf(stderr, "error: no input file specified\n");
- return SLANG_E_INVALID_ARG;
+ RawEntryPoint entry;
+ entry.name = "main";
+ entry.translationUnitIndex = 0;
+ rawEntryPoints.Add(entry);
}
- // No point in moving forward if there is nothing to compile
- if( translationUnitCount == 0 )
+ // If the user (manually or implicitly) specified only a single entry point,
+ // then we allow the associated stage to be specified either before or after
+ // the entry point. This means that if there is a stage attached
+ // to the "default" entry point, we should copy it over to the
+ // explicit one.
+ //
+ if( rawEntryPoints.Count() == 1 )
+ {
+ if(defaultEntryPoint.stage != Stage::Unknown)
+ {
+ setStage(getCurrentEntryPoint(), defaultEntryPoint.stage);
+ }
+
+ if(defaultEntryPoint.redundantStageSet)
+ getCurrentEntryPoint()->redundantStageSet = true;
+ if(defaultEntryPoint.conflictingStagesSet)
+ getCurrentEntryPoint()->conflictingStagesSet = true;
+ }
+ else
{
- fprintf(stderr, "error: no compilation requested\n");
- return SLANG_FAIL;
+ // If the "default" entry point has had a stage (or
+ // other state, if we add other per-entry-point state)
+ // specified, but there is more than one entry point,
+ // then that state doesn't apply to anything and we
+ // should issue an error to tell the user something
+ // funky is going on.
+ //
+ if( defaultEntryPoint.stage != Stage::Unknown )
+ {
+ if( rawEntryPoints.Count() == 0 )
+ {
+ sink->diagnose(SourceLoc(), Diagnostics::stageSpecificationIgnoredBecauseNoEntryPoints);
+ }
+ else
+ {
+ sink->diagnose(SourceLoc(), Diagnostics::stageSpecificationIgnoredBecauseBeforeAllEntryPoints);
+ }
+ }
}
-#endif
- // If the user didn't list any explicit entry points, then we can
- // try to infer one from the type of input file
- if(rawEntryPoints.Count() == 0)
+ // Slang requires that every explicit entry point indicate the translation
+ // unit it comes from. If there is only one translation unit specified,
+ // then implicitly all entry points come from it.
+ //
+ if(translationUnitCount == 1)
{
- for(auto rawTranslationUnit : rawTranslationUnits)
+ for( auto& entryPoint : rawEntryPoints )
+ {
+ entryPoint.translationUnitIndex = 0;
+ }
+ }
+ else
+ {
+ // Otherwise, we require that all entry points be specified after
+ // the translation unit to which tye belong.
+ bool anyEntryPointWithoutTranslationUnit = false;
+ for( auto& entryPoint : rawEntryPoints )
{
- // Dont' add implicit entry points when compiling from Slang files,
- // since Slang doesn't require entry points to be named on the
- // command line.
- if(rawTranslationUnit.sourceLanguage == SLANG_SOURCE_LANGUAGE_SLANG )
+ // Skip entry points that are already associated with a translation unit...
+ if( entryPoint.translationUnitIndex != -1 )
continue;
- // Use a default entry point name
- char const* entryPointName = "main";
-
- // Try to determine a profile and stage
-
- // If a profile and/or stage was specified on the command line, then we use it
- Profile entryPointProfile = currentProfile;
+ anyEntryPointWithoutTranslationUnit = true;
+ }
+ if( anyEntryPointWithoutTranslationUnit )
+ {
+ sink->diagnose(SourceLoc(), Diagnostics::entryPointsNeedToBeAssociatedWithTranslationUnits);
+ return SLANG_FAIL;
+ }
+ }
- // Otherwise, check if the translation unit implied a profile
- // (e.g., a `*.vert` file implies the `GLSL_Vertex` profile)
- //
- // TODO: most of this is just there to support GLSL files
- // as input, which doesn't make sense when we don't support
- // GLSL at all other than for pass-through. We should ditch
- // as much of this complexity as possible.
- //
- if(entryPointProfile.raw == SLANG_PROFILE_UNKNOWN)
- {
- if(rawTranslationUnit.implicitProfile != SLANG_PROFILE_UNKNOWN)
- {
- entryPointProfile = rawTranslationUnit.implicitProfile;
- }
- }
+ // Now that entry points are associated with translation units,
+ // we can make one additional pass where if an entry point has
+ // no specified stage, but the nameing of its translation unit
+ // implies a stage, we will use that (a manual `-stage` annotation
+ // will always win out in such a case).
+ //
+ for( auto& rawEntryPoint : rawEntryPoints )
+ {
+ // Skip entry points that already have a stage.
+ if(rawEntryPoint.stage != Stage::Unknown)
+ continue;
+ // Sanity check: don't process entry points with no associated translation unit.
+ if( rawEntryPoint.translationUnitIndex == -1 )
+ continue;
- RawEntryPoint entry;
- entry.name = entryPointName;
- entry.translationUnitIndex = rawTranslationUnit.translationUnitIndex;
- entry.profile = entryPointProfile;
- rawEntryPoints.Add(entry);
- }
+ auto impliedStage = rawTranslationUnits[rawEntryPoint.translationUnitIndex].impliedStage;
+ if(impliedStage != Stage::Unknown)
+ rawEntryPoint.stage = impliedStage;
}
- // For any entry points that were given without an explicit profile, we can now apply
- // the profile that was given to them.
- if( rawEntryPoints.Count() != 0 )
+ // Note: it is possible that some entry points still won't have associated
+ // stages at this point, but we don't want to error out here, because
+ // those entry points might get stages later, as part of semantic checking,
+ // if the corresponding function has a `[shader("...")]` attribute.
+
+ // Now that we've tried to establish stages for entry points, we can
+ // issue diagnostics for cases where stages were set redundantly or
+ // in conflicting ways.
+ //
+ for( auto& rawEntryPoint : rawEntryPoints )
{
- bool anyEntryPointWithoutProfile = false;
- bool anyEntryPointWithoutStage = false;
- for( auto& entryPoint : rawEntryPoints )
+ if( rawEntryPoint.conflictingStagesSet )
{
- if(entryPoint.profile.GetStage() == Stage::Unknown)
+ sink->diagnose(SourceLoc(), Diagnostics::conflictingStagesForEntryPoint, rawEntryPoint.name);
+ }
+ else if( rawEntryPoint.redundantStageSet )
+ {
+ sink->diagnose(SourceLoc(), Diagnostics::sameStageSpecifiedMoreThanOnce, rawEntryPoint.stage, rawEntryPoint.name);
+ }
+ else if( rawEntryPoint.translationUnitIndex != -1 )
+ {
+ // As a quality-of-life feature, if the file name implies a particular
+ // stage, but the user manually specified something different for
+ // their entry point, give a warning in case they made a mistake.
+
+ auto& rawTranslationUnit = rawTranslationUnits[rawEntryPoint.translationUnitIndex];
+ if( rawTranslationUnit.impliedStage != Stage::Unknown
+ && rawEntryPoint.stage != Stage::Unknown
+ && rawTranslationUnit.impliedStage != rawEntryPoint.stage )
{
- anyEntryPointWithoutStage = true;
+ sink->diagnose(SourceLoc(), Diagnostics::explicitStageDoesntMatchImpliedStage, rawEntryPoint.name, rawEntryPoint.stage, rawTranslationUnit.impliedStage);
}
+ }
+ }
- if(entryPoint.profile.getFamily() == ProfileFamily::Unknown)
+ // If the user is requesting code generation via pass-through,
+ // then any entry points they specify need to have a stage set,
+ // because fxc/dxc/glslang don't have a facility for taking
+ // a named entry point and pulling its stage from an attribute.
+ //
+ if( requestImpl->passThrough != PassThroughMode::None )
+ {
+ for( auto& rawEntryPoint : rawEntryPoints )
+ {
+ if( rawEntryPoint.stage == Stage::Unknown )
{
- anyEntryPointWithoutProfile = true;
+ sink->diagnose(SourceLoc(), Diagnostics::noStageSpecifiedInPassThroughMode, rawEntryPoint.name);
}
}
+ }
+
+ // We now have inferred enough information to add the
+ // entry points to our compile request.
+ //
+ for( auto& rawEntryPoint : rawEntryPoints )
+ {
+ if(rawEntryPoint.translationUnitIndex < 0)
+ continue;
+
+ auto translationUnitID = rawTranslationUnits[rawEntryPoint.translationUnitIndex].translationUnitID;
+
+ int entryPointID = spAddEntryPoint(
+ compileRequest,
+ translationUnitID,
+ rawEntryPoint.name.begin(),
+ SlangStage(rawEntryPoint.stage));
- if(anyEntryPointWithoutStage)
+ rawEntryPoint.entryPointID = entryPointID;
+ }
+
+ // We are going to build a mapping from target formats to the
+ // target that handles that format.
+ Dictionary<CodeGenTarget, int> mapFormatToTargetIndex;
+
+ // If there was no explicit `-target` specified, then we will look
+ // at the `-o` options to see what we can infer.
+ //
+ if(rawTargets.Count() == 0)
+ {
+ for(auto& rawOutput : rawOutputs)
{
- // If there are entry points that never got a stage specified, and
- // the user used multiple `-profile` and `-stage` options to try
- // and establish stages, then that is an error, because we can't
- // infer a stage for whatever is left.
- if(stageOptionCount > 1)
+ // Some outputs don't imply a target format, and we shouldn't use those for inference.
+ auto impliedFormat = rawOutput.impliedFormat;
+ if( impliedFormat == CodeGenTarget::Unknown )
+ continue;
+
+ int targetIndex = 0;
+ if( !mapFormatToTargetIndex.TryGetValue(impliedFormat, targetIndex) )
{
- if (rawEntryPoints.Count() > 1)
- {
- sink->diagnose(SourceLoc(), Diagnostics::multipleEntryPointsNeedMulitpleStages);
- return SLANG_E_INVALID_ARG;
- }
+ targetIndex = (int) rawTargets.Count();
+
+ RawTarget rawTarget;
+ rawTarget.format = impliedFormat;
+ rawTargets.Add(rawTarget);
+
+ mapFormatToTargetIndex[impliedFormat] = targetIndex;
}
- // If a stage never got specified, then that is an error.
- if(currentProfile.GetStage() == Stage::Unknown)
+ rawOutput.targetIndex = targetIndex;
+ }
+ }
+ else
+ {
+ // If there were explicit targets, then we will use those, but still
+ // build up our mapping. We should object if the same target format
+ // is specified more than once (just because of the ambiguities
+ // it will create).
+ //
+ int targetCount = (int) rawTargets.Count();
+ for(int targetIndex = 0; targetIndex < targetCount; ++targetIndex)
+ {
+ auto format = rawTargets[targetIndex].format;
+
+ if( mapFormatToTargetIndex.ContainsKey(format) )
{
- sink->diagnose(SourceLoc(), Diagnostics::noStageSpecified);
- return SLANG_E_INVALID_ARG;
+ sink->diagnose(SourceLoc(), Diagnostics::duplicateTargets, format);
}
-
- // Otherwise, exactly one stage was specified on the command line,
- // and that should implicitly apply to all the entry points.
- for( auto& e : rawEntryPoints )
+ else
{
- if(e.profile.GetStage() == Stage::Unknown)
- {
- e.profile.setStage(currentProfile.GetStage());
- }
+ mapFormatToTargetIndex[format] = targetIndex;
}
}
+ }
- if(anyEntryPointWithoutProfile )
+ // If we weren't able to infer any targets from output paths (perhaps
+ // because there were no output paths), but there was a profile specified,
+ // then we can try to infer a target from the profile.
+ //
+ if( rawTargets.Count() == 0
+ && defaultTarget.profileVersion != ProfileVersion::Unknown
+ && !defaultTarget.conflictingProfilesSet)
+ {
+ // Let's see if the chosen profile allows us to infer
+ // the code gen target format that the user probably meant.
+ //
+ CodeGenTarget inferredFormat = CodeGenTarget::Unknown;
+ auto profileVersion = defaultTarget.profileVersion;
+ switch( Profile(profileVersion).getFamily() )
{
- // If there are entry points that never got a profile specified, and
- // the user used multiple `-profile` options to try and establish
- // different profiles, then that is an error, because we can't
- // infer a stage for whatever is left.
- if(profileOptionCount > 1)
- {
- if (rawEntryPoints.Count() > 1)
- {
- sink->diagnose(SourceLoc(), Diagnostics::multipleEntryPointsNeedMulitpleProfiles);
- return SLANG_E_INVALID_ARG;
- }
- }
+ default:
+ break;
+
+ // For GLSL profile versions, we will assume SPIR-V
+ // is the output format the user intended.
+ case ProfileFamily::GLSL:
+ inferredFormat = CodeGenTarget::SPIRV;
+ break;
- // If a profile never got specified, then that is an error.
- if(currentProfile.getFamily() == ProfileFamily::Unknown)
+ // For DX profile versions, we will assume that the
+ // user wants DXIL for Shader Model 6.0 and up,
+ // and DXBC for all earlier versions.
+ //
+ // Note: There is overlap where both DXBC and DXIL
+ // nominally support SM 5.1, but in general we
+ // expect users to prefer to make a clean break
+ // at SM 6.0. Anybody who cares about the overlap
+ // cases should manually specify `-target dxil`.
+ //
+ case ProfileFamily::DX:
+ if( profileVersion >= ProfileVersion::DX_6_0 )
{
- sink->diagnose(SourceLoc(), Diagnostics::noProfileSpecified);
- return SLANG_E_INVALID_ARG;
+ inferredFormat = CodeGenTarget::DXIL;
}
-
- // Otherwise, exactly one profile was specified on the command line,
- // and that should implicitly apply to all the entry points.
- for( auto& e : rawEntryPoints )
+ else
{
- if(e.profile.getFamily() == ProfileFamily::Unknown)
- {
- e.profile.setVersion(currentProfile.GetVersion());
- }
+ inferredFormat = CodeGenTarget::DXBytecode;
}
+ break;
}
- }
- // If the user is requesting multiple targets, *and* is asking
- // for direct output files for entry points, that is an error.
- if (rawOutputPaths.Count() != 0 && requestImpl->targets.Count() > 1)
- {
- sink->diagnose(SourceLoc(), Diagnostics::explicitOutputPathsAndMultipleTargets);
+ if( inferredFormat != CodeGenTarget::Unknown )
+ {
+ RawTarget rawTarget;
+ rawTarget.format = inferredFormat;
+ rawTargets.Add(rawTarget);
+ }
}
- // Did the user try to specify output path(s)?
- if (rawOutputPaths.Count() != 0)
+ // Similar to the case for entry points, if there is a single target,
+ // then we allow some of its options to come from the "default"
+ // target state.
+ if(rawTargets.Count() == 1)
{
- if (rawEntryPoints.Count() == 1 && rawOutputPaths.Count() == 1)
- {
- // There was exactly one entry point, and exactly one output path,
- // so we can directly use that path for the entry point.
- rawEntryPoints[0].outputPathIndex = 0;
- }
- else if (rawOutputPaths.Count() > rawEntryPoints.Count())
+ if(defaultTarget.profileVersion != ProfileVersion::Unknown)
{
- sink->diagnose(SourceLoc(), Diagnostics::tooManyOutputPathsSpecified,
- rawOutputPaths.Count(), rawEntryPoints.Count());
+ setProfileVersion(getCurrentTarget(), defaultTarget.profileVersion);
}
- else
+
+ getCurrentTarget()->targetFlags |= defaultTarget.targetFlags;
+ }
+ else
+ {
+ // If the "default" target has had a profile (or other state)
+ // specified, but there is != 1 taget, then that state doesn't
+ // apply to anythign and we should give the user an error.
+ //
+ if( defaultTarget.profileVersion != ProfileVersion::Unknown )
{
- // If the user tried to apply explicit output paths, but there
- // were any entry points that didn't pick up a path, that is
- // an error:
- for( auto& entryPoint : rawEntryPoints )
+ if( rawTargets.Count() == 0 )
{
- if (entryPoint.outputPathIndex < 0)
- {
- sink->diagnose(SourceLoc(), Diagnostics::noOutputPathSpecifiedForEntryPoint, entryPoint.name);
-
- // Don't emit this same error for other entry
- // points, even if we have more
- break;
- }
+ // This should only happen if there were multiple `-profile` options,
+ // so we didn't try to infer a target, or if the `-profile` option
+ // somehow didn't imply a target.
+ //
+ sink->diagnose(SourceLoc(), Diagnostics::profileSpecificationIgnoredBecauseNoTargets);
+ }
+ else
+ {
+ sink->diagnose(SourceLoc(), Diagnostics::profileSpecificationIgnoredBecauseBeforeAllTargets);
}
}
- // All of the output paths had better agree on the format
- // they should provide.
- switch (chosenTarget)
+ if( defaultTarget.targetFlags )
{
- case SLANG_TARGET_NONE:
- case SLANG_TARGET_UNKNOWN:
- // No direct `-target` argument given, so try to infer
- // a target from the entry points:
+ if( rawTargets.Count() == 0 )
{
- bool anyUnknownTargets = false;
- for (auto rawOutputPath : rawOutputPaths)
- {
- if (rawOutputPath.target == SLANG_TARGET_UNKNOWN)
- {
- // This file didn't imply a target, and that
- // needs to be an error:
- sink->diagnose(SourceLoc(), Diagnostics::cannotDeduceOutputFormatFromPath, rawOutputPath.path);
+ sink->diagnose(SourceLoc(), Diagnostics::targetFlagsIgnoredBecauseNoTargets);
+ }
+ else
+ {
+ sink->diagnose(SourceLoc(), Diagnostics::targetFlagsIgnoredBecauseBeforeAllTargets);
+ }
+ }
- // Don't keep looking for errors
- anyUnknownTargets = true;
- break;
- }
- }
+ }
- if (!anyUnknownTargets)
- {
- // Okay, all the files have explicit targets,
- // so we will set the code generation target
- // accordingly, and then ensure that all
- // the other output paths specified (if any)
- // are consistent with the chosen target.
- //
- auto target = rawOutputPaths[0].target;
- spSetCodeGenTarget(
- compileRequest,
- target);
+ for(auto& rawTarget : rawTargets)
+ {
+ if(rawTarget.redundantProfileSet )
- for (auto rawOutputPath : rawOutputPaths)
- {
- if (rawOutputPath.target != target)
- {
- // This file didn't imply a target, and that
- // needs to be an error:
- sink->diagnose(
- SourceLoc(),
- Diagnostics::outputPathsImplyDifferentFormats,
- rawOutputPaths[0].path,
- rawOutputPath.path);
-
- // Don't keep looking for errors
- break;
- }
- }
- }
+ if( rawTarget.conflictingProfilesSet )
+ {
+ sink->diagnose(SourceLoc(), Diagnostics::conflictingProfilesSpecifiedForTarget, rawTarget.format);
+ }
+ else if( rawTarget.redundantProfileSet )
+ {
+ sink->diagnose(SourceLoc(), Diagnostics::sameProfileSpecifiedMoreThanOnce, rawTarget.profileVersion, rawTarget.format);
+ }
+ }
- }
- break;
+ // TODO: do we need to require that a target must have a profile specified,
+ // or will we continue to allow the profile to be inferred from the target?
- default:
- {
- // An explicit target was given on the command-line.
- // We will trust that the user knows what they are
- // doing, even if one of the output files implies
- // a different format.
- }
- break;
+ // We now have enough information to go ahead and declare the targets
+ // through the Slang API:
+ //
+ for(auto& rawTarget : rawTargets)
+ {
+ int targetID = spAddCodeGenTarget(compileRequest, SlangCompileTarget(rawTarget.format));
+ rawTarget.targetID = targetID;
+ if( rawTarget.profileVersion != ProfileVersion::Unknown )
+ {
+ spSetTargetProfile(compileRequest, targetID, Profile(rawTarget.profileVersion).raw);
+ }
+
+ if( rawTarget.targetFlags )
+ {
+ spSetTargetFlags(compileRequest, targetID, rawTarget.targetFlags);
}
}
- // If the user specified and per-compilation-target flags, make sure
- // to apply them here.
- if(targetFlags)
+ if(defaultMatrixLayoutMode != SLANG_MATRIX_LAYOUT_MODE_UNKNOWN)
{
- spSetTargetFlags(compileRequest, 0, targetFlags);
+ spSetMatrixLayoutMode(compileRequest, defaultMatrixLayoutMode);
}
- if(defaultMatrixLayoutMode != SLANG_MATRIX_LAYOUT_MODE_UNKNOWN)
+ // Next we need to sort out the output files specified with `-o`, and
+ // figure out which entry point and/or target they apply to.
+ //
+ // If there is only a single entry point, then that is automatically
+ // the entry point that should be associated with all outputs.
+ //
+ if( rawEntryPoints.Count() == 1 )
{
- UInt targetCount = requestImpl->targets.Count();
- for(UInt tt = 0; tt < targetCount; ++tt)
+ for( auto& rawOutput : rawOutputs )
{
- spSetTargetMatrixLayoutMode(compileRequest, int(tt), defaultMatrixLayoutMode);
+ rawOutput.entryPointIndex = 0;
}
}
-
- // Next, we want to make sure that entry points get attached to the appropriate translation
- // unit that will provide them.
+ //
+ // Similarly, if there is only one target, then all outputs must
+ // implicitly appertain to that target.
+ //
+ if( rawTargets.Count() == 1 )
{
- bool anyEntryPointWithoutTranslationUnit = false;
- for( auto& entryPoint : rawEntryPoints )
+ for( auto& rawOutput : rawOutputs )
{
- // Skip entry points that are already associated with a translation unit...
- if( entryPoint.translationUnitIndex != -1 )
- continue;
-
- anyEntryPointWithoutTranslationUnit = true;
- entryPoint.translationUnitIndex = 0;
+ rawOutput.targetIndex = 0;
}
+ }
- if( anyEntryPointWithoutTranslationUnit && translationUnitCount != 1 )
+ // Consider the output files specified via `-o` and try to figure
+ // out how to deal with them.
+ //
+ for(auto& rawOutput : rawOutputs)
+ {
+ // For now, all output formats need to be tightly bound to
+ // both a target and an entry point (down the road we will
+ // need to support output formats that can store multiple
+ // entry points in one file).
+
+ // If an output doesn't have a target assocaited with
+ // it, then search for the target with the matching format.
+ if( rawOutput.targetIndex == -1 )
{
- sink->diagnose(SourceLoc(), Diagnostics::multipleTranslationUnitsNeedEntryPoints);
- return SLANG_FAIL;
+ auto impliedFormat = rawOutput.impliedFormat;
+ int targetIndex = -1;
+
+ if(impliedFormat == CodeGenTarget::Unknown)
+ {
+ // If we hit this case, then it means that we need to pick the
+ // target to assocaite with this output based on its implied
+ // format, but the file path doesn't direclty imply a format
+ // (it doesn't have a suffix like `.spv` that tells us what to write).
+ //
+ sink->diagnose(SourceLoc(), Diagnostics::cannotDeduceOutputFormatFromPath, rawOutput.path);
+ }
+ else if( mapFormatToTargetIndex.TryGetValue(rawOutput.impliedFormat, targetIndex) )
+ {
+ rawOutput.targetIndex = targetIndex;
+ }
+ else
+ {
+ sink->diagnose(SourceLoc(), Diagnostics::cannotMatchOutputFileToTarget, rawOutput.path, rawOutput.impliedFormat);
+ }
}
- // Now place all those entry points where they belong
- for( auto& entryPoint : rawEntryPoints )
+ // We won't do any searching to match an output file
+ // with an entry point, since the case of a single entry
+ // point was handled above, and the user is expected to
+ // follow the ordering rules when using multiple entry points.
+ //
+ if( rawOutput.entryPointIndex == -1 )
{
- int entryPointIndex = spAddEntryPoint(
- compileRequest,
- entryPoint.translationUnitIndex,
- entryPoint.name.begin(),
- entryPoint.profile.raw);
+ sink->diagnose(SourceLoc(), Diagnostics::cannotMatchOutputFileToEntryPoint, rawOutput.path);
+ }
+ }
- // If an output path was specified for the entry point,
- // when we need to provide it here.
- if (entryPoint.outputPathIndex >= 0)
- {
- auto rawOutputPath = rawOutputPaths[entryPoint.outputPathIndex];
+ // Now that we've diagnosed the output paths, we can add them
+ // to the compile request at the appropriate locations.
+ //
+ // We start by allocating the arrays for per-entry-point output
+ // paths on each of the requested targets.
+ //
+ for(auto rawTarget : rawTargets)
+ {
+ auto targetID = rawTarget.targetID;
+ auto targetReq = requestImpl->targets[targetID];
- requestImpl->entryPoints[entryPointIndex]->outputPath = rawOutputPath.path;
- }
- }
+ targetReq->entryPointOutputPaths.SetSize(rawEntryPoints.Count());
}
-#if 0
- // Automatically derive an output directory based on the first file specified.
+ // Consider the output files specified via `-o` and try to figure
+ // out how to deal with them.
//
- // TODO: require manual specification if there are multiple input files, in different directories
- String fileName = options.translationUnits[0].sourceFilePaths[0];
- if (outputDir.Length() == 0)
+ for(auto& rawOutput : rawOutputs)
{
- outputDir = Path::GetDirectoryName(fileName);
+ if(rawOutput.targetIndex == -1) continue;
+ if(rawOutput.entryPointIndex == -1) continue;
+
+ auto targetID = rawTargets[rawOutput.targetIndex].targetID;
+ auto entryPointID = rawEntryPoints[rawOutput.entryPointIndex].entryPointID;
+
+ auto targetReq = requestImpl->targets[targetID];
+
+ if(targetReq->entryPointOutputPaths[entryPointID].Length())
+ {
+ auto entryPointReq = requestImpl->entryPoints[entryPointID];
+ sink->diagnose(SourceLoc(), Diagnostics::duplicateOutputPathsForEntryPointAndTarget, entryPointReq->name, targetReq->target);
+ }
+ else
+ {
+ targetReq->entryPointOutputPaths[entryPointID] = rawOutput.path;
+ }
}
-#endif
return (sink->GetErrorCount() == 0) ? SLANG_OK : SLANG_FAIL;
}
diff --git a/source/slang/profile.h b/source/slang/profile.h
index 2967d5b09..cc142bc2a 100644
--- a/source/slang/profile.h
+++ b/source/slang/profile.h
@@ -52,7 +52,7 @@ namespace Slang
struct Profile
{
typedef uint32_t RawVal;
- enum : RawVal
+ enum RawEnum : RawVal
{
Unknown,
@@ -62,9 +62,20 @@ namespace Slang
};
Profile() {}
- Profile(RawVal raw)
+ Profile(RawEnum raw)
: raw(raw)
{}
+ explicit Profile(RawVal raw)
+ : raw(raw)
+ {}
+ explicit Profile(Stage stage)
+ {
+ setStage(stage);
+ }
+ explicit Profile(ProfileVersion version)
+ {
+ setVersion(version);
+ }
bool operator==(Profile const& other) const { return raw == other.raw; }
bool operator!=(Profile const& other) const { return raw != other.raw; }
@@ -84,6 +95,7 @@ namespace Slang
ProfileFamily getFamily() const { return getProfileFamily(GetVersion()); }
static Profile LookUp(char const* name);
+ char const* getName();
RawVal raw = Unknown;
};
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 38fe88ef3..1729508f7 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -365,6 +365,17 @@ ComPtr<ISlangBlob> createRawBlob(void const* inData, size_t size)
return ComPtr<ISlangBlob>(new RawBlob(inData, size));
}
+//
+
+MatrixLayoutMode TargetRequest::getDefaultMatrixLayoutMode()
+{
+ return compileRequest->getDefaultMatrixLayoutMode();
+}
+
+
+
+//
+
SlangResult CompileRequest::loadFile(String const& path, ISlangBlob** outBlob)
{
return fileSystemExt->loadFile(path.Buffer(), outBlob);
@@ -1211,7 +1222,7 @@ SLANG_API void spSetTargetProfile(
SlangProfileID profile)
{
auto req = REQ(request);
- req->targets[targetIndex]->targetProfile = profile;
+ req->targets[targetIndex]->targetProfile = Slang::Profile(profile);
}
SLANG_API void spSetTargetFlags(
@@ -1223,13 +1234,21 @@ SLANG_API void spSetTargetFlags(
req->targets[targetIndex]->targetFlags = flags;
}
+SLANG_API void spSetMatrixLayoutMode(
+ SlangCompileRequest* request,
+ SlangMatrixLayoutMode mode)
+{
+ auto req = REQ(request);
+ req->defaultMatrixLayoutMode = Slang::MatrixLayoutMode(mode);
+}
+
SLANG_API void spSetTargetMatrixLayoutMode(
SlangCompileRequest* request,
int targetIndex,
SlangMatrixLayoutMode mode)
{
- auto req = REQ(request);
- req->targets[targetIndex]->defaultMatrixLayoutMode = Slang::MatrixLayoutMode(mode);
+ SLANG_UNUSED(targetIndex);
+ spSetMatrixLayoutMode(request, mode);
}
@@ -1417,7 +1436,7 @@ SLANG_API int spAddEntryPoint(
SlangCompileRequest* request,
int translationUnitIndex,
char const* name,
- SlangProfileID profile)
+ SlangStage stage)
{
if(!request) return -1;
auto req = REQ(request);
@@ -1428,7 +1447,7 @@ SLANG_API int spAddEntryPoint(
return req->addEntryPoint(
translationUnitIndex,
name,
- Slang::Profile(Slang::Profile::RawVal(profile)),
+ Slang::Profile(Slang::Stage(stage)),
Slang::List<Slang::String>());
}
@@ -1436,7 +1455,7 @@ SLANG_API int spAddEntryPointEx(
SlangCompileRequest* request,
int translationUnitIndex,
char const* name,
- SlangProfileID profile,
+ SlangStage stage,
int genericParamTypeNameCount,
char const ** genericParamTypeNames)
{
@@ -1451,7 +1470,7 @@ SLANG_API int spAddEntryPointEx(
return req->addEntryPoint(
translationUnitIndex,
name,
- Slang::Profile(Slang::Profile::RawVal(profile)),
+ Slang::Profile(Slang::Stage(stage)),
typeNames);
}
diff --git a/tests/bindings/array-of-struct-of-resource.hlsl b/tests/bindings/array-of-struct-of-resource.hlsl
index 11dcc18da..b34e0469b 100644
--- a/tests/bindings/array-of-struct-of-resource.hlsl
+++ b/tests/bindings/array-of-struct-of-resource.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile ps_5_1 -entry main
+//TEST:COMPARE_HLSL:-no-mangle -profile ps_5_1 -entry main
// Let's first confirm that Slang can reproduce what the
// HLSL compiler would already do in the simple case (when
diff --git a/tests/bindings/binding0.hlsl b/tests/bindings/binding0.hlsl
index 3e9f92992..85f17e940 100644
--- a/tests/bindings/binding0.hlsl
+++ b/tests/bindings/binding0.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile ps_4_0 -entry main
+//TEST:COMPARE_HLSL:-no-mangle -profile ps_4_0 -entry main
// Let's first confirm that Slang can reproduce what the
// HLSL compiler would already do in the simple case (when
diff --git a/tests/bindings/binding1.hlsl b/tests/bindings/binding1.hlsl
index cc3389d93..8709c31c6 100644
--- a/tests/bindings/binding1.hlsl
+++ b/tests/bindings/binding1.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile ps_4_0 -entry main
+//TEST:COMPARE_HLSL:-no-mangle -profile ps_4_0 -entry main
// We want to make sure that the registers Slang generates
// are used, even if there are "dead" parameter earlier in the program.
diff --git a/tests/bindings/explicit-binding.hlsl b/tests/bindings/explicit-binding.hlsl
index b8da9a77a..9c38cdee0 100644
--- a/tests/bindings/explicit-binding.hlsl
+++ b/tests/bindings/explicit-binding.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile ps_4_0 -entry main
+//TEST:COMPARE_HLSL:-no-mangle -profile ps_4_0 -entry main
// We need to allow the user to add explicit bindings to their parameters,
// and we can't go and auto-assign anything to use the same locations.
diff --git a/tests/bindings/multi-file.hlsl b/tests/bindings/multi-file.hlsl
index 992703155..6269c703e 100644
--- a/tests/bindings/multi-file.hlsl
+++ b/tests/bindings/multi-file.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile vs_4_0 -entry main Tests/bindings/multi-file-extra.hlsl -profile ps_4_0 -entry main
+//TEST:COMPARE_HLSL:-no-mangle -profile sm_4_0 -entry main -stage vertex Tests/bindings/multi-file-extra.hlsl -entry main -stage fragment
// Here we are going to test that we can correctly generating bindings when we
// are presented with a program spanning multiple input files (and multiple entry points)
diff --git a/tests/bindings/multiple-parameter-blocks.slang b/tests/bindings/multiple-parameter-blocks.slang
index dee3c60f4..29eea6766 100644
--- a/tests/bindings/multiple-parameter-blocks.slang
+++ b/tests/bindings/multiple-parameter-blocks.slang
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL:-target dxbc-assembly -profile ps_5_1 -entry main -parameter-blocks-use-register-spaces
+//TEST:COMPARE_HLSL:-profile ps_5_1 -entry main -parameter-blocks-use-register-spaces
// Confirm that Slang `ParameterBlock<T>` generates
// parameter bindings like we expect.
diff --git a/tests/bindings/packoffset.hlsl b/tests/bindings/packoffset.hlsl
index f912e76d8..81913d672 100644
--- a/tests/bindings/packoffset.hlsl
+++ b/tests/bindings/packoffset.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile ps_4_0 -entry main
+//TEST:COMPARE_HLSL:-no-mangle -profile ps_4_0 -entry main
// Let's make sure we generate correct output in cases
// where there are non-trivial `packoffset`s needed
diff --git a/tests/bindings/parameter-blocks.slang b/tests/bindings/parameter-blocks.slang
index 756a6ec1a..6941ce77c 100644
--- a/tests/bindings/parameter-blocks.slang
+++ b/tests/bindings/parameter-blocks.slang
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile ps_5_1 -entry main -parameter-blocks-use-register-spaces
+//TEST:COMPARE_HLSL:-no-mangle -profile ps_5_1 -entry main -parameter-blocks-use-register-spaces
// Confirm that Slang `ParameterBlock<T>` generates
// parameter bindings like we expect.
diff --git a/tests/bindings/resources-in-cbuffer.hlsl b/tests/bindings/resources-in-cbuffer.hlsl
index e3dcfc28e..4d3d381d9 100644
--- a/tests/bindings/resources-in-cbuffer.hlsl
+++ b/tests/bindings/resources-in-cbuffer.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile ps_4_0 -entry main
+//TEST:COMPARE_HLSL:-no-mangle -profile ps_4_0 -entry main
// Confirm that resources inside constant buffers get correct locations,
// including the case where there are *multiple* constant buffers
diff --git a/tests/bindings/resources-in-structs.hlsl.disabled b/tests/bindings/resources-in-structs.hlsl.disabled
index 45c066f31..be218c29b 100644
--- a/tests/bindings/resources-in-structs.hlsl.disabled
+++ b/tests/bindings/resources-in-structs.hlsl.disabled
@@ -1,4 +1,4 @@
-//SLANG_TEST_OPTS:-target dxbc-assembly -profile ps_5_0 -entry main
+//SLANG_TEST_OPTS:-profile ps_5_0 -entry main
// Confirm that resources inside `struct` types work reasonably well,
diff --git a/tests/bindings/targets-and-uavs-structure.hlsl b/tests/bindings/targets-and-uavs-structure.hlsl
index 3c7499cf5..dd860369d 100644
--- a/tests/bindings/targets-and-uavs-structure.hlsl
+++ b/tests/bindings/targets-and-uavs-structure.hlsl
@@ -1,4 +1,4 @@
-//TEST(smoke):COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile ps_5_0 -entry main
+//TEST(smoke):COMPARE_HLSL:-no-mangle -profile ps_5_0 -entry main
// Handle the case where the fragment shader output is
// defined a structure, and the semantics are on the sub-fields
diff --git a/tests/bindings/targets-and-uavs.hlsl b/tests/bindings/targets-and-uavs.hlsl
index 7c6389e36..ac64c8f5f 100644
--- a/tests/bindings/targets-and-uavs.hlsl
+++ b/tests/bindings/targets-and-uavs.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile ps_5_0 -entry main
+//TEST:COMPARE_HLSL:-no-mangle -profile ps_5_0 -entry main
// Render target outputs (`SV_Target`) and UAVs are treated
// as sharing the same binding slots in HLSL, so we need to
diff --git a/tests/bugs/array-size-static-const.hlsl b/tests/bugs/array-size-static-const.hlsl
index fe15d402d..643d4733e 100644
--- a/tests/bugs/array-size-static-const.hlsl
+++ b/tests/bugs/array-size-static-const.hlsl
@@ -1,5 +1,5 @@
// array-size-static-const.hlsl
-//TEST:COMPARE_HLSL: -profile cs_5_0 -target dxbc-assembly
+//TEST:COMPARE_HLSL: -profile cs_5_0
// The bug in this case is that were have a (hidden)
// cast from the `uint` constant to `int` to get
diff --git a/tests/bugs/cbuffer-member-init.hlsl b/tests/bugs/cbuffer-member-init.hlsl
index fe6db8af0..fbfa3f220 100644
--- a/tests/bugs/cbuffer-member-init.hlsl
+++ b/tests/bugs/cbuffer-member-init.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -profile vs_5_0 -target dxbc-assembly -no-checking
+//TEST:COMPARE_HLSL: -profile vs_5_0
// Allow (but ignore) initializer on `cbuffer` member
@@ -7,7 +7,8 @@ cbuffer C : register(b0)
int a = -1;
};
-float4 main() : SV_Position
+float4 main() : SV_POSITION
{
- return a;
+ return 0;
+// return a;
}
diff --git a/tests/bugs/do-loop.hlsl b/tests/bugs/do-loop.hlsl
index de98a9765..e293258b2 100644
--- a/tests/bugs/do-loop.hlsl
+++ b/tests/bugs/do-loop.hlsl
@@ -1,4 +1,4 @@
-//TEST_DISABLED:COMPARE_HLSL: -profile vs_5_0 -target dxbc-assembly
+//TEST_DISABLED:COMPARE_HLSL: -profile vs_5_0
// Check output for `do` loops
diff --git a/tests/bugs/gh-171.slang b/tests/bugs/gh-171.slang
index 1df82501e..647f6a6a2 100644
--- a/tests/bugs/gh-171.slang
+++ b/tests/bugs/gh-171.slang
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -profile ps_5_0 -entry main -target dxbc-assembly -split-mixed-types
+//TEST:COMPARE_HLSL: -profile ps_5_0 -entry main
// Make sure we don't crash when desugaring resources
// in structs when a `cbuffer` only contains resources.
@@ -17,12 +17,12 @@ float4 main(float2 uv: UV) : SV_Target
#else
-Texture2D SLANG_parameterGroup_C_t : register(t0);
-SamplerState SLANG_parameterGroup_C_s : register(s0);
+Texture2D C_t_0 : register(t0);
+SamplerState C_s_0 : register(s0);
-float4 main(float2 uv: UV) : SV_Target
+float4 main(float2 uv: UV) : SV_TARGET
{
- return SLANG_parameterGroup_C_t.Sample(SLANG_parameterGroup_C_s, uv);
+ return C_t_0.Sample(C_s_0, uv);
}
#endif
diff --git a/tests/bugs/gh-172.slang b/tests/bugs/gh-172.slang
index f959c7ac6..dd5f4d47a 100644
--- a/tests/bugs/gh-172.slang
+++ b/tests/bugs/gh-172.slang
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -profile ps_5_0 -entry main -target dxbc-assembly -split-mixed-types
+//TEST:COMPARE_HLSL: -profile ps_5_0 -entry main
// Make sure we don't crash when desugaring resource in structs,
// when the user also declares multiple variables with a
@@ -21,19 +21,19 @@ float4 main() : SV_Target
#else
-cbuffer C : register(b0)
+cbuffer C_0 : register(b0)
{
- float2 uv;
+ float2 uv_0;
};
-Texture2D SLANG_parameterGroup_C_t0 : register(t0);
-Texture2D SLANG_parameterGroup_C_t1 : register(t1);
-SamplerState SLANG_parameterGroup_C_s : register(s0);
+Texture2D C_t0_0 : register(t0);
+Texture2D C_t1_0 : register(t1);
+SamplerState C_s_0 : register(s0);
-float4 main() : SV_Target
+float4 main() : SV_TARGET
{
- return SLANG_parameterGroup_C_t0.Sample(SLANG_parameterGroup_C_s, uv)
- + SLANG_parameterGroup_C_t1.Sample(SLANG_parameterGroup_C_s, uv);
+ return C_t0_0.Sample(C_s_0, uv_0)
+ + C_t1_0.Sample(C_s_0, uv_0);
}
#endif
diff --git a/tests/bugs/gh-295.hlsl b/tests/bugs/gh-295.hlsl
index 724684662..73b5f071e 100644
--- a/tests/bugs/gh-295.hlsl
+++ b/tests/bugs/gh-295.hlsl
@@ -1,4 +1,7 @@
-//TEST:COMPARE_HLSL: -profile vs_4_0 -target dxbc-assembly -no-checking
+// Disabled because Slang IR path is missing support for [fastopt]
+//TEST_IGNORE_FILE
+
+//TEST:COMPARE_HLSL: -profile vs_4_0
// Confirm that we pass through `[fastopt]` attributes
//
diff --git a/tests/bugs/gh-34.hlsl b/tests/bugs/gh-34.hlsl
index feaddb2ab..d43ea75d9 100644
--- a/tests/bugs/gh-34.hlsl
+++ b/tests/bugs/gh-34.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -profile gs_5_0 -target dxbc-assembly -no-checking
+//TEST:COMPARE_HLSL: -profile gs_5_0
struct VS_OUT { float3 p : POSITION; };
@@ -6,8 +6,10 @@ struct VS_OUT { float3 p : POSITION; };
void main(InputPatch<VS_OUT, 3> input, inout TriangleStream<VS_OUT> outStream)
{
VS_OUT output;
- for (uint i = 0; i < 3; i += 1)
+ for (uint i = 0;; i += 1)
{
+ if(i < 3) {} else break;
+
output = input[i];
outStream.Append(output);
}
diff --git a/tests/bugs/implicit-conversion-binary-op.hlsl b/tests/bugs/implicit-conversion-binary-op.hlsl
index b9a558474..ac952902f 100644
--- a/tests/bugs/implicit-conversion-binary-op.hlsl
+++ b/tests/bugs/implicit-conversion-binary-op.hlsl
@@ -1,5 +1,5 @@
// implicit-conversion-binary-op.hlsl
-//TEST:COMPARE_HLSL: -profile ps_5_0 -target dxbc-assembly
+//TEST:COMPARE_HLSL: -profile ps_5_0
// Make sure that we can pick resolve the right overload
// to call when applying a binary operator to vectors
diff --git a/tests/bugs/import-overload-error.hlsl b/tests/bugs/import-overload-error.hlsl
index 328bb5b26..21b9a7c8f 100644
--- a/tests/bugs/import-overload-error.hlsl
+++ b/tests/bugs/import-overload-error.hlsl
@@ -1,4 +1,6 @@
-//TEST:COMPARE_HLSL: -profile cs_5_0 -target dxbc-assembly -no-checking
+// Disbaled because Slang should perform its own semantic checking now
+//TEST_IGNORE_FILE
+//TEST:COMPARE_HLSL: -profile cs_5_0
#ifdef __SLANG__
__import import_overload_error;
diff --git a/tests/bugs/matrix-mult.glsl b/tests/bugs/matrix-mult.glsl
index b427dee14..58285c541 100644
--- a/tests/bugs/matrix-mult.glsl
+++ b/tests/bugs/matrix-mult.glsl
@@ -1,4 +1,6 @@
-//TEST:COMPARE_GLSL:-profile glsl_fragment_450 -no-checking
+// Disabled because Slang compiler doesn't support GLSL as an input language
+//TEST_IGNORE_FILE
+//TEST:COMPARE_GLSL:-profile glsl_fragment_450
// matrix-mult.glsl
#version 450
diff --git a/tests/bugs/split-nested-types.hlsl b/tests/bugs/split-nested-types.hlsl
index dc8756ba2..577f64a75 100644
--- a/tests/bugs/split-nested-types.hlsl
+++ b/tests/bugs/split-nested-types.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL:-no-mangle -profile ps_5_0 -target dxbc-assembly
+//TEST:COMPARE_HLSL:-no-mangle -profile ps_5_0
#ifdef __SLANG__
import split_nested_types;
diff --git a/tests/bugs/uav-write-index.hlsl b/tests/bugs/uav-write-index.hlsl
index 667c73e89..7dac172fa 100644
--- a/tests/bugs/uav-write-index.hlsl
+++ b/tests/bugs/uav-write-index.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -profile cs_5_0 -target dxbc-assembly -no-checking
+//TEST:COMPARE_HLSL: -profile cs_5_0
// Make sure we handle complex UAV write patterns
@@ -6,6 +6,13 @@
// checking takes place:
#ifdef __SLANG__
__import empty;
+#else
+
+#define Bar Bar_0
+#define bar bar_0
+#define gUAV gUAV_0
+#define gUAV2 gUAV2_0
+
#endif
struct Bar
diff --git a/tests/bugs/vec-init-list.hlsl b/tests/bugs/vec-init-list.hlsl
index d957548e6..2f82a96b0 100644
--- a/tests/bugs/vec-init-list.hlsl
+++ b/tests/bugs/vec-init-list.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -profile vs_5_0 -target dxbc-assembly
+//TEST:COMPARE_HLSL: -profile vs_5_0
// Check handling of initializer list for vector
diff --git a/tests/compute/matrix-layout.hlsl b/tests/compute/matrix-layout.hlsl
index 68366fc5b..799781d11 100644
--- a/tests/compute/matrix-layout.hlsl
+++ b/tests/compute/matrix-layout.hlsl
@@ -41,7 +41,7 @@ int test(int val)
// Note: using `val %3` here instead of `val %4` in order
// to work around a code generation issue in dxc.
-
+ //
int a = s.a[val / 4][val % 3];
int b = s.b;
diff --git a/tests/diagnostics/command-line/duplicate-output.slang b/tests/diagnostics/command-line/duplicate-output.slang
new file mode 100644
index 000000000..794a8717b
--- /dev/null
+++ b/tests/diagnostics/command-line/duplicate-output.slang
@@ -0,0 +1,3 @@
+// duplicate-output.slang
+
+//TEST:SIMPLE:-entry main -stage compute -o myKernel.dxbc -o myKernel.dxbc
diff --git a/tests/diagnostics/command-line/duplicate-output.slang.expected b/tests/diagnostics/command-line/duplicate-output.slang.expected
new file mode 100644
index 000000000..23e62357f
--- /dev/null
+++ b/tests/diagnostics/command-line/duplicate-output.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 80: multiple output paths have been specified entry point 'main' on target 'dxbc'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/duplicate-target.slang b/tests/diagnostics/command-line/duplicate-target.slang
new file mode 100644
index 000000000..44bbc62c7
--- /dev/null
+++ b/tests/diagnostics/command-line/duplicate-target.slang
@@ -0,0 +1,3 @@
+// duplicate-target.slang
+
+//TEST:SIMPLE:-target hlsl -target hlsl
diff --git a/tests/diagnostics/command-line/duplicate-target.slang.expected b/tests/diagnostics/command-line/duplicate-target.slang.expected
new file mode 100644
index 000000000..4b8a19b2f
--- /dev/null
+++ b/tests/diagnostics/command-line/duplicate-target.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 50: the target 'hlsl' has been specified more than once
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/entry-point-conflicting-stage.slang b/tests/diagnostics/command-line/entry-point-conflicting-stage.slang
new file mode 100644
index 000000000..89cf5cba0
--- /dev/null
+++ b/tests/diagnostics/command-line/entry-point-conflicting-stage.slang
@@ -0,0 +1,5 @@
+// entry-point-conflicting-stage.slang
+
+//TEST:SIMPLE:-stage vertex -stage fragment
+
+//TEST:SIMPLE:-entry vsMain -stage compute -stage vertex
diff --git a/tests/diagnostics/command-line/entry-point-conflicting-stage.slang.1.expected b/tests/diagnostics/command-line/entry-point-conflicting-stage.slang.1.expected
new file mode 100644
index 000000000..2f2e70b4b
--- /dev/null
+++ b/tests/diagnostics/command-line/entry-point-conflicting-stage.slang.1.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 31: conflicting stages have been specified for entry point 'vsMain'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/entry-point-conflicting-stage.slang.expected b/tests/diagnostics/command-line/entry-point-conflicting-stage.slang.expected
new file mode 100644
index 000000000..2b3adab6b
--- /dev/null
+++ b/tests/diagnostics/command-line/entry-point-conflicting-stage.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 31: conflicting stages have been specified for entry point 'main'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/entry-point-redundant-stage.slang b/tests/diagnostics/command-line/entry-point-redundant-stage.slang
new file mode 100644
index 000000000..903d696c7
--- /dev/null
+++ b/tests/diagnostics/command-line/entry-point-redundant-stage.slang
@@ -0,0 +1,5 @@
+// entry-point-redundant-stage.slang
+
+//TEST:SIMPLE:-stage vertex -stage vertex
+
+//TEST:SIMPLE:-entry vsMain -stage vertex -stage vertex
diff --git a/tests/diagnostics/command-line/entry-point-redundant-stage.slang.1.expected b/tests/diagnostics/command-line/entry-point-redundant-stage.slang.1.expected
new file mode 100644
index 000000000..36674b409
--- /dev/null
+++ b/tests/diagnostics/command-line/entry-point-redundant-stage.slang.1.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 30: the stage 'vertex' was specified more than once for entry point 'vsMain'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/entry-point-redundant-stage.slang.expected b/tests/diagnostics/command-line/entry-point-redundant-stage.slang.expected
new file mode 100644
index 000000000..e5a66e0fd
--- /dev/null
+++ b/tests/diagnostics/command-line/entry-point-redundant-stage.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 30: the stage 'vertex' was specified more than once for entry point 'main'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/explicit-implicit-stage-mismatch.vert b/tests/diagnostics/command-line/explicit-implicit-stage-mismatch.vert
new file mode 100644
index 000000000..0ea731470
--- /dev/null
+++ b/tests/diagnostics/command-line/explicit-implicit-stage-mismatch.vert
@@ -0,0 +1,3 @@
+// explicit-implicit-stage-mismatch.vert
+
+//TEST:SIMPLE:-stage fragment
diff --git a/tests/diagnostics/command-line/explicit-implicit-stage-mismatch.vert.expected b/tests/diagnostics/command-line/explicit-implicit-stage-mismatch.vert.expected
new file mode 100644
index 000000000..fef4b78de
--- /dev/null
+++ b/tests/diagnostics/command-line/explicit-implicit-stage-mismatch.vert.expected
@@ -0,0 +1,7 @@
+result code = -1
+standard error = {
+(0): warning 32: the stage specified for entry point 'main' ('pixel') does not match the stage implied by the source file name ('vertex')
+(0): error 11: the Slang compiler does not support GLSL as a source language
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/option-missing-argument.slang b/tests/diagnostics/command-line/option-missing-argument.slang
new file mode 100644
index 000000000..e62b37ba6
--- /dev/null
+++ b/tests/diagnostics/command-line/option-missing-argument.slang
@@ -0,0 +1,7 @@
+// option-missing-argument.slang
+
+// Missing argument for an option:
+
+//TEST:SIMPLE:-target -profile ps_4_0
+
+//TEST:SIMPLE:-profile ps_4_0 -target
diff --git a/tests/diagnostics/command-line/option-missing-argument.slang.1.expected b/tests/diagnostics/command-line/option-missing-argument.slang.1.expected
new file mode 100644
index 000000000..81ab1c485
--- /dev/null
+++ b/tests/diagnostics/command-line/option-missing-argument.slang.1.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 21: expected an argument for command-line option '-target'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/option-missing-argument.slang.expected b/tests/diagnostics/command-line/option-missing-argument.slang.expected
new file mode 100644
index 000000000..fde023ddd
--- /dev/null
+++ b/tests/diagnostics/command-line/option-missing-argument.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 13: unknown code generation target '-profile'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/output-no-entry-point.slang b/tests/diagnostics/command-line/output-no-entry-point.slang
new file mode 100644
index 000000000..869dcabc4
--- /dev/null
+++ b/tests/diagnostics/command-line/output-no-entry-point.slang
@@ -0,0 +1,3 @@
+// output-no-entry-point.slang
+
+//TEST:SIMPLE:-o something.dxbc -entry vsMain -stage vertex -entry fsMain -stage fragment
diff --git a/tests/diagnostics/command-line/output-no-entry-point.slang.expected b/tests/diagnostics/command-line/output-no-entry-point.slang.expected
new file mode 100644
index 000000000..d04fa06f0
--- /dev/null
+++ b/tests/diagnostics/command-line/output-no-entry-point.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(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
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/output-no-target.slang b/tests/diagnostics/command-line/output-no-target.slang
new file mode 100644
index 000000000..32921a8f0
--- /dev/null
+++ b/tests/diagnostics/command-line/output-no-target.slang
@@ -0,0 +1,3 @@
+// output-no-target.slang
+
+//TEST:SIMPLE:-target dxbc -target spirv -entry main -stage compute -o bad.hlsl
diff --git a/tests/diagnostics/command-line/output-no-target.slang.expected b/tests/diagnostics/command-line/output-no-target.slang.expected
new file mode 100644
index 000000000..828c91953
--- /dev/null
+++ b/tests/diagnostics/command-line/output-no-target.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 61: no specified '-target' option matches the output path 'bad.hlsl', which implies the 'hlsl' format
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/pass-through-no-stage.hlsl b/tests/diagnostics/command-line/pass-through-no-stage.hlsl
new file mode 100644
index 000000000..eabdadf10
--- /dev/null
+++ b/tests/diagnostics/command-line/pass-through-no-stage.hlsl
@@ -0,0 +1,8 @@
+// pass-through-no-stage.hlsl
+
+// Trying to compile in `-pass-through` mode without
+// specifying a stage is an error, because the downstream
+// compilers don't support inferring the stage from
+// an attribute.
+
+//TEST:SIMPLE:-pass-through fxc -entry main
diff --git a/tests/diagnostics/command-line/pass-through-no-stage.hlsl.expected b/tests/diagnostics/command-line/pass-through-no-stage.hlsl.expected
new file mode 100644
index 000000000..87cdbbbb2
--- /dev/null
+++ b/tests/diagnostics/command-line/pass-through-no-stage.hlsl.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(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
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/profile-ignored.slang b/tests/diagnostics/command-line/profile-ignored.slang
new file mode 100644
index 000000000..8a6590690
--- /dev/null
+++ b/tests/diagnostics/command-line/profile-ignored.slang
@@ -0,0 +1,14 @@
+// profile-ignored.slang
+
+// Cases where a `-profile` option gets ignored
+// because it doesn't apply to any target
+
+// Case 1: multiple (conflicting) profiles, so we can't infer a single stage
+//
+//TEST:SIMPLE:-profile sm_5_0 -profile glsl_450
+
+
+// Case 2: a `-profile` option before any `-target`, possibly because
+// the user is specifying things in the wrong order.
+//
+//TEST:SIMPLE:-profile sm_5_0 -target dxbc -profile glsl_450 -target spirv
diff --git a/tests/diagnostics/command-line/profile-ignored.slang.1.expected b/tests/diagnostics/command-line/profile-ignored.slang.1.expected
new file mode 100644
index 000000000..eeaf701c8
--- /dev/null
+++ b/tests/diagnostics/command-line/profile-ignored.slang.1.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 43: when using multiple targets, any '-profile' option must follow the '-target' it applies to
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/profile-ignored.slang.expected b/tests/diagnostics/command-line/profile-ignored.slang.expected
new file mode 100644
index 000000000..f3290a362
--- /dev/null
+++ b/tests/diagnostics/command-line/profile-ignored.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 42: a '-profile' option was specified, but no target was specified with '-target'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/stage-ignored.slang b/tests/diagnostics/command-line/stage-ignored.slang
new file mode 100644
index 000000000..6d28c52bc
--- /dev/null
+++ b/tests/diagnostics/command-line/stage-ignored.slang
@@ -0,0 +1,9 @@
+// stage-ignored.slang
+
+// Cases where a `-stage` option gets ignored
+// because it doesn't apply to any entry point.
+
+// A `-stage` option before any `-entry`, possibly because
+// the user is specifying things in the wrong order.
+//
+//TEST:SIMPLE:-stage vertex -entry vsMain -stage fragment -entry psMain
diff --git a/tests/diagnostics/command-line/stage-ignored.slang.expected b/tests/diagnostics/command-line/stage-ignored.slang.expected
new file mode 100644
index 000000000..725e526fd
--- /dev/null
+++ b/tests/diagnostics/command-line/stage-ignored.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 34: when compiling multiple entry points, any '-stage' options must follow the '-entry' option that they apply to
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/unknown-codegen-target.slang b/tests/diagnostics/command-line/unknown-codegen-target.slang
new file mode 100644
index 000000000..57015601d
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-codegen-target.slang
@@ -0,0 +1,3 @@
+// unknown-codegen-target.slang
+
+//TEST:SIMPLE:-target z80
diff --git a/tests/diagnostics/command-line/unknown-codegen-target.slang.expected b/tests/diagnostics/command-line/unknown-codegen-target.slang.expected
new file mode 100644
index 000000000..0db8d267a
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-codegen-target.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 13: unknown code generation target 'z80'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/unknown-line-directive-mode.slang b/tests/diagnostics/command-line/unknown-line-directive-mode.slang
new file mode 100644
index 000000000..7e61df3f9
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-line-directive-mode.slang
@@ -0,0 +1,3 @@
+// unknown-line-directive-mode.slang
+
+//TEST:SIMPLE:-line-directive-mode quizzical
diff --git a/tests/diagnostics/command-line/unknown-line-directive-mode.slang.expected b/tests/diagnostics/command-line/unknown-line-directive-mode.slang.expected
new file mode 100644
index 000000000..3451d191b
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-line-directive-mode.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 24: unknown '#line' directive mode 'quizzical'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/unknown-option.slang b/tests/diagnostics/command-line/unknown-option.slang
new file mode 100644
index 000000000..52320d758
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-option.slang
@@ -0,0 +1,3 @@
+// unknown-option.slang
+
+//TEST:SIMPLE:-destroy-all-humans
diff --git a/tests/diagnostics/command-line/unknown-option.slang.expected b/tests/diagnostics/command-line/unknown-option.slang.expected
new file mode 100644
index 000000000..a74219699
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-option.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 17: unknown command-line option '-destroy-all-humans'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/unknown-output-format.slang b/tests/diagnostics/command-line/unknown-output-format.slang
new file mode 100644
index 000000000..05f59022b
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-output-format.slang
@@ -0,0 +1,3 @@
+// unknown-output-format.slang
+
+//TEST:SIMPLE:-o cookies.jar
diff --git a/tests/diagnostics/command-line/unknown-output-format.slang.expected b/tests/diagnostics/command-line/unknown-output-format.slang.expected
new file mode 100644
index 000000000..c2f41fa71
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-output-format.slang.expected
@@ -0,0 +1,7 @@
+result code = 1
+standard error = {
+(0): error 60: cannot infer an output format from the output path 'cookies.jar'
+(0): error 70: the output path 'cookies.jar' is not associated with any entry point; a '-o' option for a compiled kernel must follow the '-entry' option for its corresponding entry point
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/unknown-pass-through-target.slang b/tests/diagnostics/command-line/unknown-pass-through-target.slang
new file mode 100644
index 000000000..7b86f62d6
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-pass-through-target.slang
@@ -0,0 +1,3 @@
+// unknown-pass-through-target.slang
+
+//TEST:SIMPLE:-pass-through subcon
diff --git a/tests/diagnostics/command-line/unknown-pass-through-target.slang.expected b/tests/diagnostics/command-line/unknown-pass-through-target.slang.expected
new file mode 100644
index 000000000..0c4b1aa4d
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-pass-through-target.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 16: unknown pass-through target 'subcon'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/unknown-profile.slang b/tests/diagnostics/command-line/unknown-profile.slang
new file mode 100644
index 000000000..f96363058
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-profile.slang
@@ -0,0 +1,3 @@
+// unknown-profile.slang
+
+//TEST:SIMPLE:-profile thunder_kiss_65
diff --git a/tests/diagnostics/command-line/unknown-profile.slang.expected b/tests/diagnostics/command-line/unknown-profile.slang.expected
new file mode 100644
index 000000000..7e53303fc
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-profile.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 14: unknown profile 'thunder_kiss_65'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/unknown-source-language.slang b/tests/diagnostics/command-line/unknown-source-language.slang
new file mode 100644
index 000000000..c39a3ae4f
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-source-language.slang
@@ -0,0 +1,5 @@
+// unknown-source-language.slang
+
+// Unknown source file extension (can't deduce language)
+
+//TEST:SIMPLE:batmobile.car
diff --git a/tests/diagnostics/command-line/unknown-source-language.slang.expected b/tests/diagnostics/command-line/unknown-source-language.slang.expected
new file mode 100644
index 000000000..6d596ffab
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-source-language.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 12: can't deduce language for input file 'batmobile.car'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/unknown-stage.slang b/tests/diagnostics/command-line/unknown-stage.slang
new file mode 100644
index 000000000..1645e5998
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-stage.slang
@@ -0,0 +1,3 @@
+// unknown-stage.slang
+
+//TEST:SIMPLE:-stage green_hills_zone
diff --git a/tests/diagnostics/command-line/unknown-stage.slang.expected b/tests/diagnostics/command-line/unknown-stage.slang.expected
new file mode 100644
index 000000000..4d00e6ff4
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-stage.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 15: unknown stage 'green_hills_zone'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/entry-point-no-stage.slang b/tests/diagnostics/entry-point-no-stage.slang
new file mode 100644
index 000000000..99ff8193c
--- /dev/null
+++ b/tests/diagnostics/entry-point-no-stage.slang
@@ -0,0 +1,10 @@
+// entry-point-no-stage.slang
+
+// Confirm that we generate a diagnostic when
+// compiling an entry point without any
+// stage specified.
+
+//TEST:SIMPLE:-entry main
+
+void main()
+{}
diff --git a/tests/diagnostics/entry-point-no-stage.slang.expected b/tests/diagnostics/entry-point-no-stage.slang.expected
new file mode 100644
index 000000000..c63524009
--- /dev/null
+++ b/tests/diagnostics/entry-point-no-stage.slang.expected
@@ -0,0 +1,6 @@
+result code = -1
+standard error = {
+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 <name>' command-line option to specify a stage
+}
+standard output = {
+}
diff --git a/tests/diagnostics/entry-point-stage-mismatch.slang b/tests/diagnostics/entry-point-stage-mismatch.slang
new file mode 100644
index 000000000..0f143c676
--- /dev/null
+++ b/tests/diagnostics/entry-point-stage-mismatch.slang
@@ -0,0 +1,10 @@
+// entry-point-stage-mismatch.slang
+
+// Confirm that we diagnose when stage specified via command
+// line doesn't match what was specified via attribute.
+
+//TEST:SIMPLE:-entry main -stage vertex
+
+[shader("compute")]
+void main()
+{}
diff --git a/tests/diagnostics/entry-point-stage-mismatch.slang.expected b/tests/diagnostics/entry-point-stage-mismatch.slang.expected
new file mode 100644
index 000000000..6a0ebbf96
--- /dev/null
+++ b/tests/diagnostics/entry-point-stage-mismatch.slang.expected
@@ -0,0 +1,6 @@
+result code = 0
+standard error = {
+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
+}
+standard output = {
+}
diff --git a/tests/diagnostics/gh-38-vs.hlsl b/tests/diagnostics/gh-38-vs.hlsl
index 7b23efdea..92e0e957e 100644
--- a/tests/diagnostics/gh-38-vs.hlsl
+++ b/tests/diagnostics/gh-38-vs.hlsl
@@ -1,4 +1,4 @@
-//TEST:SIMPLE: -target dxbc-assembly -profile vs_5_0 -entry main tests/diagnostics/gh-38-fs.hlsl -profile ps_5_0 -entry main
+//TEST:SIMPLE: -profile sm_5_0 -entry main -stage vertex tests/diagnostics/gh-38-fs.hlsl -entry main -stage fragment
// Ensure that we catch errors with overlapping or conflicting parameter bindings.
diff --git a/tests/diagnostics/missing-return.slang b/tests/diagnostics/missing-return.slang
new file mode 100644
index 000000000..83f5f9dc1
--- /dev/null
+++ b/tests/diagnostics/missing-return.slang
@@ -0,0 +1,58 @@
+// missing-return.slang
+
+//TEST:SIMPLE:
+
+// Non-`void` function that fails to return
+
+int bad(int a, int b)
+{
+ int result = a + b;
+
+ // forgot `return` here
+}
+
+int alsoBad(int a, int b)
+{
+ if(a > b)
+ {
+ return a + b;
+ }
+
+ // forgot `return` here
+}
+
+int okay(int a, int b)
+{
+ int tmp = a;
+ for(;;)
+ {
+ if(a > b)
+ return tmp;
+
+ a = b;
+ b = tmp;
+ tmp = a + b;
+ }
+
+ // Lack of `return` here is not
+ // a problem, because we can never
+ // actually get here
+}
+
+int alsoOkay(int a, int b)
+{
+ int tmp = a;
+ while(true)
+ {
+ if(a > b)
+ return tmp;
+
+ a = b;
+ b = tmp;
+ tmp = a + b;
+ }
+
+ // Lack of `return` here is not
+ // a problem, because we can never
+ // actually get here
+} \ No newline at end of file
diff --git a/tests/diagnostics/missing-return.slang.expected b/tests/diagnostics/missing-return.slang.expected
new file mode 100644
index 000000000..d44bfc159
--- /dev/null
+++ b/tests/diagnostics/missing-return.slang.expected
@@ -0,0 +1,7 @@
+result code = 0
+standard error = {
+tests/diagnostics/missing-return.slang(7): warning 41010: control flow may reach end of non-'void' function
+tests/diagnostics/missing-return.slang(14): warning 41010: control flow may reach end of non-'void' function
+}
+standard output = {
+}
diff --git a/tests/hlsl/dxsdk/AdaptiveTessellationCS40/Render.hlsl b/tests/hlsl/dxsdk/AdaptiveTessellationCS40/Render.hlsl
index 0a3209343..c6b4ac197 100644
--- a/tests/hlsl/dxsdk/AdaptiveTessellationCS40/Render.hlsl
+++ b/tests/hlsl/dxsdk/AdaptiveTessellationCS40/Render.hlsl
@@ -1,4 +1,4 @@
-//TEST(smoke):COMPARE_HLSL:-no-mangle -profile vs_4_0 -entry RenderBaseVS -profile ps_4_0 -entry RenderPS -target dxbc-assembly
+//TEST(smoke):COMPARE_HLSL:-no-mangle -profile sm_4_0 -entry RenderBaseVS -stage vertex -entry RenderPS -stage fragment
#ifndef __SLANG__
#define cbPerObject cbPerObject_0
diff --git a/tests/hlsl/dxsdk/AdaptiveTessellationCS40/ScanCS.hlsl b/tests/hlsl/dxsdk/AdaptiveTessellationCS40/ScanCS.hlsl
index 87b7b4ebf..a4472179f 100644
--- a/tests/hlsl/dxsdk/AdaptiveTessellationCS40/ScanCS.hlsl
+++ b/tests/hlsl/dxsdk/AdaptiveTessellationCS40/ScanCS.hlsl
@@ -1,4 +1,4 @@
-//TEST_DISABLED:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile cs_4_0 -entry CSScanInBucket -entry CSScanBucketResult -entry CSScanAddBucketResult
+//TEST_DISABLED:COMPARE_HLSL:-no-mangle -profile cs_4_0 -entry CSScanInBucket -entry CSScanBucketResult -entry CSScanAddBucketResult
//--------------------------------------------------------------------------------------
// File: ScanCS.hlsl
//
diff --git a/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_EdgeFactorCS.hlsl b/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_EdgeFactorCS.hlsl
index f320abd3a..1bd204efc 100644
--- a/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_EdgeFactorCS.hlsl
+++ b/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_EdgeFactorCS.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile cs_4_0 -entry CSEdgeFactor
+//TEST:COMPARE_HLSL: -profile cs_4_0 -entry CSEdgeFactor
//--------------------------------------------------------------------------------------
// File: TessellatorCS40_EdgeFactorCS.hlsl
//
diff --git a/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_NumVerticesIndicesCS.hlsl b/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_NumVerticesIndicesCS.hlsl
index 190deab37..672996589 100644
--- a/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_NumVerticesIndicesCS.hlsl
+++ b/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_NumVerticesIndicesCS.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile cs_4_0 -entry CSNumVerticesIndices
+//TEST:COMPARE_HLSL: -profile cs_4_0 -entry CSNumVerticesIndices
//--------------------------------------------------------------------------------------
// File: TessellatorCS40_NumVerticesIndicesCS.hlsl
//
diff --git a/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_ScatterIDCS.hlsl b/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_ScatterIDCS.hlsl
index 36d8fbd71..f6f9081da 100644
--- a/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_ScatterIDCS.hlsl
+++ b/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_ScatterIDCS.hlsl
@@ -1,4 +1,4 @@
-//TEST_DISABLED:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile cs_4_0 -entry CSScatterVertexTriIDIndexID -entry CSScatterIndexTriIDIndexID
+//TEST_DISABLED:COMPARE_HLSL:-no-mangle -profile cs_4_0 -entry CSScatterVertexTriIDIndexID -entry CSScatterIndexTriIDIndexID
//--------------------------------------------------------------------------------------
// File: TessellatorCS40_ScatterIDCS.hlsl
//
diff --git a/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_TessellateIndicesCS.hlsl b/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_TessellateIndicesCS.hlsl
index 9e80fbb8a..8c0a5b63b 100644
--- a/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_TessellateIndicesCS.hlsl
+++ b/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_TessellateIndicesCS.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile cs_4_0 -entry CSTessellationIndices
+//TEST:COMPARE_HLSL: -profile cs_4_0 -entry CSTessellationIndices
//--------------------------------------------------------------------------------------
// File: TessellatorCS40_TessellateIndicesCS.hlsl
//
diff --git a/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_TessellateVerticesCS.hlsl b/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_TessellateVerticesCS.hlsl
index cce960d87..e1f6b9ec3 100644
--- a/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_TessellateVerticesCS.hlsl
+++ b/tests/hlsl/dxsdk/AdaptiveTessellationCS40/TessellatorCS40_TessellateVerticesCS.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile cs_4_0 -entry CSTessellationVertices
+//TEST:COMPARE_HLSL: -profile cs_4_0 -entry CSTessellationVertices
//--------------------------------------------------------------------------------------
// File: TessellatorCS40_TessellateVerticesCS.hlsl
//
diff --git a/tests/hlsl/dxsdk/BasicCompute11/BasicCompute11.hlsl b/tests/hlsl/dxsdk/BasicCompute11/BasicCompute11.hlsl
index 07a911d24..664e92e5d 100644
--- a/tests/hlsl/dxsdk/BasicCompute11/BasicCompute11.hlsl
+++ b/tests/hlsl/dxsdk/BasicCompute11/BasicCompute11.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile cs_4_0 -entry CSMain
+//TEST:COMPARE_HLSL: -profile cs_4_0 -entry CSMain
//--------------------------------------------------------------------------------------
// File: BasicCompute11.hlsl
//
diff --git a/tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_PS.hlsl b/tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_PS.hlsl
index c446b3493..33ea61b07 100644
--- a/tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_PS.hlsl
+++ b/tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_PS.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile ps_4_0 -entry PSMain
+//TEST:COMPARE_HLSL:-no-mangle -profile ps_4_0 -entry PSMain
#ifndef __SLANG__
#define cbPerFrame cbPerFrame_0
diff --git a/tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_VS.hlsl b/tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_VS.hlsl
index 8ff5e64d7..a0fb3c9ce 100644
--- a/tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_VS.hlsl
+++ b/tests/hlsl/dxsdk/BasicHLSL11/BasicHLSL11_VS.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VSMain
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VSMain
#ifndef __SLANG__
#define cbPerObject cbPerObject_0
diff --git a/tests/hlsl/dxsdk/CascadedShadowMaps11/RenderCascadeScene.hlsl b/tests/hlsl/dxsdk/CascadedShadowMaps11/RenderCascadeScene.hlsl
index 197fca705..3224d783c 100644
--- a/tests/hlsl/dxsdk/CascadedShadowMaps11/RenderCascadeScene.hlsl
+++ b/tests/hlsl/dxsdk/CascadedShadowMaps11/RenderCascadeScene.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VSMain -profile ps_4_0 -entry PSMain
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VSMain -profile ps_4_0 -entry PSMain
//--------------------------------------------------------------------------------------
// File: RenderCascadeScene.hlsl
//
diff --git a/tests/hlsl/dxsdk/CascadedShadowMaps11/RenderCascadeShadow.hlsl b/tests/hlsl/dxsdk/CascadedShadowMaps11/RenderCascadeShadow.hlsl
index 5e2cfacf8..af9679ada 100644
--- a/tests/hlsl/dxsdk/CascadedShadowMaps11/RenderCascadeShadow.hlsl
+++ b/tests/hlsl/dxsdk/CascadedShadowMaps11/RenderCascadeShadow.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VSMain -entry VSMainPancake
+//TEST:COMPARE_HLSL: -profile sm_4_0 -entry VSMain -stage vertex -entry VSMainPancake -stage vertex
#ifndef __SLANG__
#define cbPerObject cbPerObject_0
diff --git a/tests/hlsl/dxsdk/ComputeShaderSort11/ComputeShaderSort11.hlsl b/tests/hlsl/dxsdk/ComputeShaderSort11/ComputeShaderSort11.hlsl
index 7a0b835a3..6e14bc10e 100644
--- a/tests/hlsl/dxsdk/ComputeShaderSort11/ComputeShaderSort11.hlsl
+++ b/tests/hlsl/dxsdk/ComputeShaderSort11/ComputeShaderSort11.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile cs_4_0 -entry BitonicSort -entry MatrixTranspose
+//TEST:COMPARE_HLSL: -profile cs_4_0 -entry BitonicSort -entry MatrixTranspose
//--------------------------------------------------------------------------------------
// File: ComputeShaderSort11.hlsl
//
diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial02/Tutorial02.fx b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial02/Tutorial02.fx
index e4b44b3d1..e1fead571 100644
--- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial02/Tutorial02.fx
+++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial02/Tutorial02.fx
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VS -profile ps_4_0 -entry PS
+//TEST:COMPARE_HLSL: -profile sm_4_0 -entry VS -stage vertex -entry PS -stage fragment
#ifndef __SLANG__
#define SV_Target SV_TARGET
diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial02/Tutorial02_PS.hlsl b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial02/Tutorial02_PS.hlsl
index 2f616870f..82300c10c 100644
--- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial02/Tutorial02_PS.hlsl
+++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial02/Tutorial02_PS.hlsl
@@ -1,3 +1,3 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile ps_4_0 -entry PS
+//TEST:COMPARE_HLSL: -profile ps_4_0 -entry PS
#include "Tutorial02.fx"
diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial02/Tutorial02_VS.hlsl b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial02/Tutorial02_VS.hlsl
index 0b99b6163..cdf4f9649 100644
--- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial02/Tutorial02_VS.hlsl
+++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial02/Tutorial02_VS.hlsl
@@ -1,3 +1,3 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VS
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VS
#include "Tutorial02.fx"
diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial03/Tutorial03.fx b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial03/Tutorial03.fx
index e4b44b3d1..e1fead571 100644
--- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial03/Tutorial03.fx
+++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial03/Tutorial03.fx
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VS -profile ps_4_0 -entry PS
+//TEST:COMPARE_HLSL: -profile sm_4_0 -entry VS -stage vertex -entry PS -stage fragment
#ifndef __SLANG__
#define SV_Target SV_TARGET
diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial03/Tutorial03_PS.hlsl b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial03/Tutorial03_PS.hlsl
index 28f8b72a5..684788198 100644
--- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial03/Tutorial03_PS.hlsl
+++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial03/Tutorial03_PS.hlsl
@@ -1,3 +1,3 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile ps_4_0 -entry PS
+//TEST:COMPARE_HLSL: -profile ps_4_0 -entry PS
#include "Tutorial03.fx"
diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial03/Tutorial03_VS.hlsl b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial03/Tutorial03_VS.hlsl
index f1b51570c..40d9770fc 100644
--- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial03/Tutorial03_VS.hlsl
+++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial03/Tutorial03_VS.hlsl
@@ -1,3 +1,3 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VS
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VS
#include "Tutorial03.fx"
diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial04/Tutorial04.fx b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial04/Tutorial04.fx
index 91ffee3df..d311edc5a 100644
--- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial04/Tutorial04.fx
+++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial04/Tutorial04.fx
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VS -profile ps_4_0 -entry PS
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VS -profile ps_4_0 -entry PS
//--------------------------------------------------------------------------------------
// File: Tutorial04.fx
//
diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial04/Tutorial04_PS.hlsl b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial04/Tutorial04_PS.hlsl
index 3adba841b..65c36988f 100644
--- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial04/Tutorial04_PS.hlsl
+++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial04/Tutorial04_PS.hlsl
@@ -1,3 +1,3 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile ps_4_0 -entry PS
+//TEST:COMPARE_HLSL: -profile ps_4_0 -entry PS
#include "Tutorial04.fx"
diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial04/Tutorial04_VS.hlsl b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial04/Tutorial04_VS.hlsl
index 471c70452..4505c1a98 100644
--- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial04/Tutorial04_VS.hlsl
+++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial04/Tutorial04_VS.hlsl
@@ -1,3 +1,3 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VS
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VS
#include "Tutorial04.fx"
diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial05/Tutorial05.fx b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial05/Tutorial05.fx
index c26ab0865..5ef5487da 100644
--- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial05/Tutorial05.fx
+++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial05/Tutorial05.fx
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VS -profile ps_4_0 -entry PS
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VS -profile ps_4_0 -entry PS
//--------------------------------------------------------------------------------------
// File: Tutorial05.fx
//
diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial05/Tutorial05_PS.hlsl b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial05/Tutorial05_PS.hlsl
index caa4855ee..4226d4b47 100644
--- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial05/Tutorial05_PS.hlsl
+++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial05/Tutorial05_PS.hlsl
@@ -1,3 +1,3 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile ps_4_0 -entry PS
+//TEST:COMPARE_HLSL: -profile ps_4_0 -entry PS
#include "Tutorial05.fx"
diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial05/Tutorial05_VS.hlsl b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial05/Tutorial05_VS.hlsl
index 7003df52b..1c2f5519f 100644
--- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial05/Tutorial05_VS.hlsl
+++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial05/Tutorial05_VS.hlsl
@@ -1,3 +1,3 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VS
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VS
#include "Tutorial05.fx"
diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06.fx b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06.fx
index e3f60ae88..219e96b9f 100644
--- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06.fx
+++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06.fx
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VS -profile ps_4_0 -entry PS -entry PSSolid
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VS -profile ps_4_0 -entry PS -entry PSSolid
//--------------------------------------------------------------------------------------
// File: Tutorial06.fx
//
diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06_PS.hlsl b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06_PS.hlsl
index 4b2795b3b..7bd5ece78 100644
--- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06_PS.hlsl
+++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06_PS.hlsl
@@ -1,3 +1,3 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile ps_4_0 -entry PS
+//TEST:COMPARE_HLSL: -profile ps_4_0 -entry PS
#include "Tutorial06.fx"
diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06_VS.hlsl b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06_VS.hlsl
index 8d39fd6ed..50fcdbf56 100644
--- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06_VS.hlsl
+++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial06/Tutorial06_VS.hlsl
@@ -1,3 +1,3 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VS
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VS
#include "Tutorial06.fx"
diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial07/Tutorial07.fx b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial07/Tutorial07.fx
index af6d671bd..f99aeba1b 100644
--- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial07/Tutorial07.fx
+++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial07/Tutorial07.fx
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VS -profile ps_4_0 -entry PS
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VS -profile ps_4_0 -entry PS
//--------------------------------------------------------------------------------------
// File: Tutorial07.fx
//
diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial07/Tutorial07_PS.hlsl b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial07/Tutorial07_PS.hlsl
index bfbf669d9..f81862efd 100644
--- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial07/Tutorial07_PS.hlsl
+++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial07/Tutorial07_PS.hlsl
@@ -1,3 +1,3 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile ps_4_0 -entry PS
+//TEST:COMPARE_HLSL: -profile ps_4_0 -entry PS
#include "Tutorial07.fx"
diff --git a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial07/Tutorial07_VS.hlsl b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial07/Tutorial07_VS.hlsl
index f3626569e..3ce6baf34 100644
--- a/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial07/Tutorial07_VS.hlsl
+++ b/tests/hlsl/dxsdk/Direct3D11Tutorials/Tutorial07/Tutorial07_VS.hlsl
@@ -1,3 +1,3 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VS
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VS
#include "Tutorial07.fx"
diff --git a/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial08/Tutorial08.fx b/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial08/Tutorial08.fx
index f92eaae2e..f3c6a5774 100644
--- a/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial08/Tutorial08.fx
+++ b/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial08/Tutorial08.fx
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VS -profile ps_4_0 -entry PS
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VS -profile ps_4_0 -entry PS
//--------------------------------------------------------------------------------------
// File: Tutorial08.fx
//
diff --git a/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial09/Tutorial09.fx b/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial09/Tutorial09.fx
index 431d63fc4..2be29fb40 100644
--- a/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial09/Tutorial09.fx
+++ b/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial09/Tutorial09.fx
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VS -profile ps_4_0 -entry PS
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VS -profile ps_4_0 -entry PS
//--------------------------------------------------------------------------------------
// File: Tutorial09.fx
//
diff --git a/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial10/Tutorial10.fx b/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial10/Tutorial10.fx
index 5c160f001..68f53c0b6 100644
--- a/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial10/Tutorial10.fx
+++ b/tests/hlsl/dxsdk/Direct3D11TutorialsDXUT/Tutorial10/Tutorial10.fx
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VS -profile ps_4_0 -entry PS
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VS -profile ps_4_0 -entry PS
//--------------------------------------------------------------------------------------
// File: Tutorial10.fx
//
diff --git a/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_PS.hlsl b/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_PS.hlsl
index e828eb054..6850ad9cb 100644
--- a/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_PS.hlsl
+++ b/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_PS.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile ps_4_0 -entry PSMain
+//TEST:COMPARE_HLSL: -profile ps_4_0 -entry PSMain
//--------------------------------------------------------------------------------------
// File: DynamicShaderLinkage11.psh
//
diff --git a/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_VS.hlsl b/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_VS.hlsl
index ecbcb85f9..d47f20c23 100644
--- a/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_VS.hlsl
+++ b/tests/hlsl/dxsdk/DynamicShaderLinkage11/DynamicShaderLinkage11_VS.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VSMain
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VSMain
#ifndef __SLANG__
#define cbPerObject cbPerObject_0
diff --git a/tests/hlsl/dxsdk/FluidCS11/ComputeShaderSort11.hlsl b/tests/hlsl/dxsdk/FluidCS11/ComputeShaderSort11.hlsl
index 7a0b835a3..6e14bc10e 100644
--- a/tests/hlsl/dxsdk/FluidCS11/ComputeShaderSort11.hlsl
+++ b/tests/hlsl/dxsdk/FluidCS11/ComputeShaderSort11.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile cs_4_0 -entry BitonicSort -entry MatrixTranspose
+//TEST:COMPARE_HLSL: -profile cs_4_0 -entry BitonicSort -entry MatrixTranspose
//--------------------------------------------------------------------------------------
// File: ComputeShaderSort11.hlsl
//
diff --git a/tests/hlsl/dxsdk/FluidCS11/FluidCS11.hlsl b/tests/hlsl/dxsdk/FluidCS11/FluidCS11.hlsl
index 3e050be9b..8966ea3c1 100644
--- a/tests/hlsl/dxsdk/FluidCS11/FluidCS11.hlsl
+++ b/tests/hlsl/dxsdk/FluidCS11/FluidCS11.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile cs_4_0 -entry BuildGridCS -entry ClearGridIndicesCS -entry BuildGridIndicesCS -entry RearrangeParticlesCS -entry DensityCS_Simple -entry DensityCS_Shared -entry DensityCS_Grid -entry ForceCS_Simple -entry ForceCS_Shared -entry ForceCS_Grid -entry IntegrateCS
+//TEST:COMPARE_HLSL: -profile cs_4_0 -entry BuildGridCS -entry ClearGridIndicesCS -entry BuildGridIndicesCS -entry RearrangeParticlesCS -entry DensityCS_Simple -entry DensityCS_Shared -entry DensityCS_Grid -entry ForceCS_Simple -entry ForceCS_Shared -entry ForceCS_Grid -entry IntegrateCS
//--------------------------------------------------------------------------------------
// File: FluidCS11.hlsl
//
diff --git a/tests/hlsl/dxsdk/FluidCS11/FluidRender.hlsl b/tests/hlsl/dxsdk/FluidCS11/FluidRender.hlsl
index 496240dc9..cfd14c2b2 100644
--- a/tests/hlsl/dxsdk/FluidCS11/FluidRender.hlsl
+++ b/tests/hlsl/dxsdk/FluidCS11/FluidRender.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile vs_4_0 -entry ParticleVS -profile gs_4_0 -entry ParticleGS -profile ps_4_0 -entry ParticlePS
+//TEST:COMPARE_HLSL:-no-mangle -profile sm_4_0 -entry ParticleVS -stage vertex -entry ParticleGS -stage geometry -entry ParticlePS -stage pixel
#ifndef __SLANG__
#define ParticlesRO ParticlesRO_0
diff --git a/tests/hlsl/dxsdk/HDRToneMappingCS11/BrightPassAndHorizFilterCS.hlsl b/tests/hlsl/dxsdk/HDRToneMappingCS11/BrightPassAndHorizFilterCS.hlsl
index 33399591d..3addeca08 100644
--- a/tests/hlsl/dxsdk/HDRToneMappingCS11/BrightPassAndHorizFilterCS.hlsl
+++ b/tests/hlsl/dxsdk/HDRToneMappingCS11/BrightPassAndHorizFilterCS.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile cs_4_0 -entry CSMain
+//TEST:COMPARE_HLSL: -profile cs_4_0 -entry CSMain
//--------------------------------------------------------------------------------------
// File: BrightPassAndHorizFilterCS.hlsl
//
diff --git a/tests/hlsl/dxsdk/HDRToneMappingCS11/DumpToTexture.hlsl b/tests/hlsl/dxsdk/HDRToneMappingCS11/DumpToTexture.hlsl
index 707806fec..f2d119eb5 100644
--- a/tests/hlsl/dxsdk/HDRToneMappingCS11/DumpToTexture.hlsl
+++ b/tests/hlsl/dxsdk/HDRToneMappingCS11/DumpToTexture.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile ps_4_0 -entry PSDump
+//TEST:COMPARE_HLSL: -profile ps_4_0 -entry PSDump
//--------------------------------------------------------------------------------------
// File: DumpToTexture.hlsl
//
diff --git a/tests/hlsl/dxsdk/HDRToneMappingCS11/FilterCS.hlsl b/tests/hlsl/dxsdk/HDRToneMappingCS11/FilterCS.hlsl
index cac65775d..e21b97e30 100644
--- a/tests/hlsl/dxsdk/HDRToneMappingCS11/FilterCS.hlsl
+++ b/tests/hlsl/dxsdk/HDRToneMappingCS11/FilterCS.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile cs_4_0 -entry CSVerticalFilter -entry CSHorizFilter
+//TEST:COMPARE_HLSL: -profile cs_4_0 -entry CSVerticalFilter -entry CSHorizFilter
//--------------------------------------------------------------------------------------
// File: FilterCS.hlsl
//
diff --git a/tests/hlsl/dxsdk/HDRToneMappingCS11/FinalPass.hlsl b/tests/hlsl/dxsdk/HDRToneMappingCS11/FinalPass.hlsl
index 53fcb5732..f5a49d2eb 100644
--- a/tests/hlsl/dxsdk/HDRToneMappingCS11/FinalPass.hlsl
+++ b/tests/hlsl/dxsdk/HDRToneMappingCS11/FinalPass.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry QuadVS -profile ps_4_0 -entry PSFinalPass -entry PSFinalPassForCPUReduction
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry QuadVS -profile ps_4_0 -entry PSFinalPass -entry PSFinalPassForCPUReduction
//--------------------------------------------------------------------------------------
// File: FinalPass.hlsl
//
diff --git a/tests/hlsl/dxsdk/HDRToneMappingCS11/PSApproach.hlsl b/tests/hlsl/dxsdk/HDRToneMappingCS11/PSApproach.hlsl
index f59954cae..3f16b2449 100644
--- a/tests/hlsl/dxsdk/HDRToneMappingCS11/PSApproach.hlsl
+++ b/tests/hlsl/dxsdk/HDRToneMappingCS11/PSApproach.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile ps_4_0 -entry DownScale2x2_Lum -entry DownScale3x3 -entry FinalPass -entry DownScale3x3_BrightPass -entry Bloom
+//TEST:COMPARE_HLSL: -profile ps_4_0 -entry DownScale2x2_Lum -entry DownScale3x3 -entry FinalPass -entry DownScale3x3_BrightPass -entry Bloom
//--------------------------------------------------------------------------------------
// File: PSApproach.hlsl
//
diff --git a/tests/hlsl/dxsdk/HDRToneMappingCS11/ReduceTo1DCS.hlsl b/tests/hlsl/dxsdk/HDRToneMappingCS11/ReduceTo1DCS.hlsl
index 488e42563..1316250d5 100644
--- a/tests/hlsl/dxsdk/HDRToneMappingCS11/ReduceTo1DCS.hlsl
+++ b/tests/hlsl/dxsdk/HDRToneMappingCS11/ReduceTo1DCS.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile cs_4_0 -entry CSMain
+//TEST:COMPARE_HLSL: -profile cs_4_0 -entry CSMain
//-----------------------------------------------------------------------------
// File: ReduceTo1DCS.hlsl
//
diff --git a/tests/hlsl/dxsdk/HDRToneMappingCS11/ReduceToSingleCS.hlsl b/tests/hlsl/dxsdk/HDRToneMappingCS11/ReduceToSingleCS.hlsl
index 679102c5e..73857a6bb 100644
--- a/tests/hlsl/dxsdk/HDRToneMappingCS11/ReduceToSingleCS.hlsl
+++ b/tests/hlsl/dxsdk/HDRToneMappingCS11/ReduceToSingleCS.hlsl
@@ -1,4 +1,4 @@
-//TEST_DISABLED:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile cs_4_0 -entry CSMain
+//TEST_DISABLED:COMPARE_HLSL:-no-mangle -profile cs_4_0 -entry CSMain
//-----------------------------------------------------------------------------
// File: ReduceToSingleCS.hlsl
//
diff --git a/tests/hlsl/dxsdk/HDRToneMappingCS11/skybox11.hlsl b/tests/hlsl/dxsdk/HDRToneMappingCS11/skybox11.hlsl
index 9ca94e92f..a0e44ba95 100644
--- a/tests/hlsl/dxsdk/HDRToneMappingCS11/skybox11.hlsl
+++ b/tests/hlsl/dxsdk/HDRToneMappingCS11/skybox11.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry SkyboxVS -profile ps_4_0 -entry SkyboxPS
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry SkyboxVS -profile ps_4_0 -entry SkyboxPS
//-----------------------------------------------------------------------------
// File: SkyBox11.hlsl
//
diff --git a/tests/hlsl/dxsdk/MultithreadedRendering11/MultithreadedRendering11_PS.hlsl b/tests/hlsl/dxsdk/MultithreadedRendering11/MultithreadedRendering11_PS.hlsl
index 88b41e0bc..5463f5b92 100644
--- a/tests/hlsl/dxsdk/MultithreadedRendering11/MultithreadedRendering11_PS.hlsl
+++ b/tests/hlsl/dxsdk/MultithreadedRendering11/MultithreadedRendering11_PS.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile ps_4_0 -entry PSMain
+//TEST:COMPARE_HLSL: -profile ps_4_0 -entry PSMain
//--------------------------------------------------------------------------------------
// File: MultithreadedRendering11_PS.hlsl
//
diff --git a/tests/hlsl/dxsdk/MultithreadedRendering11/MultithreadedRendering11_VS.hlsl b/tests/hlsl/dxsdk/MultithreadedRendering11/MultithreadedRendering11_VS.hlsl
index 3f1d90bfd..12fe14ae9 100644
--- a/tests/hlsl/dxsdk/MultithreadedRendering11/MultithreadedRendering11_VS.hlsl
+++ b/tests/hlsl/dxsdk/MultithreadedRendering11/MultithreadedRendering11_VS.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VSMain
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VSMain
#ifndef __SLANG__
#define cbPerObject cbPerObject_0
diff --git a/tests/hlsl/dxsdk/NBodyGravityCS11/NBodyGravityCS11.hlsl b/tests/hlsl/dxsdk/NBodyGravityCS11/NBodyGravityCS11.hlsl
index 802b6cd9b..bac2839db 100644
--- a/tests/hlsl/dxsdk/NBodyGravityCS11/NBodyGravityCS11.hlsl
+++ b/tests/hlsl/dxsdk/NBodyGravityCS11/NBodyGravityCS11.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile cs_4_0 -entry CSMain
+//TEST:COMPARE_HLSL: -profile cs_4_0 -entry CSMain
//--------------------------------------------------------------------------------------
// File: NBodyGravityCS11.hlsl
//
diff --git a/tests/hlsl/dxsdk/NBodyGravityCS11/ParticleDraw.hlsl b/tests/hlsl/dxsdk/NBodyGravityCS11/ParticleDraw.hlsl
index 9a8ad9b11..7f6292662 100644
--- a/tests/hlsl/dxsdk/NBodyGravityCS11/ParticleDraw.hlsl
+++ b/tests/hlsl/dxsdk/NBodyGravityCS11/ParticleDraw.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VSParticleDraw -profile gs_4_0 -entry GSParticleDraw -profile ps_4_0 -entry PSParticleDraw
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VSParticleDraw -profile gs_4_0 -entry GSParticleDraw -profile ps_4_0 -entry PSParticleDraw
//--------------------------------------------------------------------------------------
// File: ParticleDraw.hlsl
//
diff --git a/tests/hlsl/dxsdk/OIT11/OIT_CS.hlsl b/tests/hlsl/dxsdk/OIT11/OIT_CS.hlsl
index 78a9b82a8..80a1e165e 100644
--- a/tests/hlsl/dxsdk/OIT11/OIT_CS.hlsl
+++ b/tests/hlsl/dxsdk/OIT11/OIT_CS.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile cs_4_0 -entry VSParticleDraw -profile gs_4_0 -entry GSParticleDraw -profile ps_4_0 -entry PSParticleDraw
+//TEST:COMPARE_HLSL: -profile cs_4_0 -entry VSParticleDraw -profile gs_4_0 -entry GSParticleDraw -profile ps_4_0 -entry PSParticleDraw
//-----------------------------------------------------------------------------
// File: OIT_CS.hlsl
//
diff --git a/tests/hlsl/dxsdk/OIT11/OIT_PS.hlsl b/tests/hlsl/dxsdk/OIT11/OIT_PS.hlsl
index 67a812987..5fae02d62 100644
--- a/tests/hlsl/dxsdk/OIT11/OIT_PS.hlsl
+++ b/tests/hlsl/dxsdk/OIT11/OIT_PS.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile ps_4_0 -entry FragmentCountPS -entry FillDeepBufferPS
+//TEST:COMPARE_HLSL: -profile ps_4_0 -entry FragmentCountPS -entry FillDeepBufferPS
//-----------------------------------------------------------------------------
// File: OITPS.hlsl
//
diff --git a/tests/hlsl/dxsdk/OIT11/SceneVS.hlsl b/tests/hlsl/dxsdk/OIT11/SceneVS.hlsl
index 6f96938ed..2254091f6 100644
--- a/tests/hlsl/dxsdk/OIT11/SceneVS.hlsl
+++ b/tests/hlsl/dxsdk/OIT11/SceneVS.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry SceneVS
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry SceneVS
#ifndef __SLANG__
#define cbPerObject cbPerObject_0
diff --git a/tests/hlsl/dxsdk/SimpleBezier11/SimpleBezier11.hlsl b/tests/hlsl/dxsdk/SimpleBezier11/SimpleBezier11.hlsl
index c915b4903..d01cd7aa4 100644
--- a/tests/hlsl/dxsdk/SimpleBezier11/SimpleBezier11.hlsl
+++ b/tests/hlsl/dxsdk/SimpleBezier11/SimpleBezier11.hlsl
@@ -1,4 +1,4 @@
-//TEST_DISABLED:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry BezierVS -profile hs_5_0 -entry BezierHS -profile ds_5_0 -entry BezierDS -profile ps_4_0 -entry BezierPS -entry SolidColorPS
+//TEST_DISABLED:COMPARE_HLSL: -profile vs_4_0 -entry BezierVS -profile hs_5_0 -entry BezierHS -profile ds_5_0 -entry BezierDS -profile ps_4_0 -entry BezierPS -entry SolidColorPS
// Note(Slang): Disabling this test for now because compiling it via IR ends up creating a local variable of the `OutputPatch<...>` type, which we need to get rid of via SSA optimization.
diff --git a/tests/hlsl/dxsdk/SimpleSample11/SimpleSample.hlsl b/tests/hlsl/dxsdk/SimpleSample11/SimpleSample.hlsl
index 51c58b286..7c688940b 100644
--- a/tests/hlsl/dxsdk/SimpleSample11/SimpleSample.hlsl
+++ b/tests/hlsl/dxsdk/SimpleSample11/SimpleSample.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry RenderSceneVS -profile ps_4_0 -entry RenderScenePS
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry RenderSceneVS -profile ps_4_0 -entry RenderScenePS
//--------------------------------------------------------------------------------------
// File: SimpleSample.hlsl
//
diff --git a/tests/hlsl/dxsdk/SubD11/SubD11.hlsl b/tests/hlsl/dxsdk/SubD11/SubD11.hlsl
index ac11cbba9..839e004e6 100644
--- a/tests/hlsl/dxsdk/SubD11/SubD11.hlsl
+++ b/tests/hlsl/dxsdk/SubD11/SubD11.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry PatchSkinningVS -entry MeshSkinningVS -profile hs_5_0 -entry SubDToBezierHS -entry SubDToBezierHS4444 -profile ds_5_0 -entry BezierEvalDS -profile ps_4_0 -entry SmoothPS -entry SolidColorPS
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry PatchSkinningVS -entry MeshSkinningVS -profile hs_5_0 -entry SubDToBezierHS -entry SubDToBezierHS4444 -profile ds_5_0 -entry BezierEvalDS -profile ps_4_0 -entry SmoothPS -entry SolidColorPS
//--------------------------------------------------------------------------------------
// File: SubD11.hlsl
//
diff --git a/tests/hlsl/dxsdk/VarianceShadows11/2DQuadShaders.hlsl b/tests/hlsl/dxsdk/VarianceShadows11/2DQuadShaders.hlsl
index 3b41d92b3..7d9763a79 100644
--- a/tests/hlsl/dxsdk/VarianceShadows11/2DQuadShaders.hlsl
+++ b/tests/hlsl/dxsdk/VarianceShadows11/2DQuadShaders.hlsl
@@ -1,4 +1,4 @@
-//TEST_DISABLED:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile vs_4_0 -entry VSMain -profile ps_4_0 -entry PSBlurX -entry PSBlurY
+//TEST_DISABLED:COMPARE_HLSL:-no-mangle -profile vs_4_0 -entry VSMain -profile ps_4_0 -entry PSBlurX -entry PSBlurY
//SLANG: This test has been disabled because its semantic correctness
//around use of compile-time-constant expressions relies on processing
diff --git a/tests/hlsl/dxsdk/VarianceShadows11/RenderVarianceScene.hlsl b/tests/hlsl/dxsdk/VarianceShadows11/RenderVarianceScene.hlsl
index 89def170a..29c9851d8 100644
--- a/tests/hlsl/dxsdk/VarianceShadows11/RenderVarianceScene.hlsl
+++ b/tests/hlsl/dxsdk/VarianceShadows11/RenderVarianceScene.hlsl
@@ -1,5 +1,5 @@
//TEST_IGNORE_FILE: Currently failing due to Slang compiler issues.
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VSMain -profile ps_4_0 -entry PSBlurX -entry PSBlurY
+//TEST:COMPARE_HLSL: -profile vs_4_0 -entry VSMain -profile ps_4_0 -entry PSBlurX -entry PSBlurY
//--------------------------------------------------------------------------------------
// File: RenderCascadeScene.hlsl
//
diff --git a/tests/hlsl/dxsdk/VarianceShadows11/RenderVarianceShadow.hlsl b/tests/hlsl/dxsdk/VarianceShadows11/RenderVarianceShadow.hlsl
index 744e16d0e..9aec9a55d 100644
--- a/tests/hlsl/dxsdk/VarianceShadows11/RenderVarianceShadow.hlsl
+++ b/tests/hlsl/dxsdk/VarianceShadows11/RenderVarianceShadow.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile vs_4_0 -entry VSMain -profile ps_4_0 -entry PSMain
+//TEST:COMPARE_HLSL: -profile sm_4_0 -entry VSMain -stage vertex -entry PSMain -stage pixel
#ifndef __SLANG__
#define cbPerObject cbPerObject_0
diff --git a/tests/hlsl/simple/allow-uav-conditional.hlsl b/tests/hlsl/simple/allow-uav-conditional.hlsl
index 8195a9f1d..ec6fa8590 100644
--- a/tests/hlsl/simple/allow-uav-conditional.hlsl
+++ b/tests/hlsl/simple/allow-uav-conditional.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL:-no-mangle -profile cs_5_0 -target dxbc-assembly
+//TEST:COMPARE_HLSL:-no-mangle -profile cs_5_0
// Check output for `[allow_uav_conditional]`
diff --git a/tests/hlsl/simple/compute-numthreads.hlsl b/tests/hlsl/simple/compute-numthreads.hlsl
index 805c960c4..34d9bfd4f 100644
--- a/tests/hlsl/simple/compute-numthreads.hlsl
+++ b/tests/hlsl/simple/compute-numthreads.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile cs_5_0 -entry main
+//TEST:COMPARE_HLSL:-no-mangle -profile cs_5_0 -entry main
// Confirm that we properly pass along the `numthreads` attribute on an entry point.
diff --git a/tests/hlsl/simple/implicit_conversion.hlsl b/tests/hlsl/simple/implicit_conversion.hlsl
index d46661341..2a3700e62 100644
--- a/tests/hlsl/simple/implicit_conversion.hlsl
+++ b/tests/hlsl/simple/implicit_conversion.hlsl
@@ -1,4 +1,4 @@
-//TEST_DISABLED:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile cs_5_0 -entry main
+//TEST_DISABLED:COMPARE_HLSL:-no-mangle -profile cs_5_0 -entry main
// Test various cases of implicit type conversion and preference
// for overload resolution.
diff --git a/tests/hlsl/simple/literal-typing.hlsl b/tests/hlsl/simple/literal-typing.hlsl
index 0ecf60506..6c003eb21 100644
--- a/tests/hlsl/simple/literal-typing.hlsl
+++ b/tests/hlsl/simple/literal-typing.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL:-no-mangle -target dxbc-assembly -profile cs_5_0 -entry main
+//TEST:COMPARE_HLSL:-no-mangle -profile cs_5_0 -entry main
// Confirm that we get the typing of literal suffixes correct
diff --git a/tests/ir/string-literal.slang b/tests/ir/string-literal.slang
index e0c893014..224d64b7a 100644
--- a/tests/ir/string-literal.slang
+++ b/tests/ir/string-literal.slang
@@ -1,4 +1,4 @@
-//TEST(compute):SIMPLE:-dump-ir -profile cs_5_0 -entry main
+//TEST(compute):SIMPLE:-dump-ir -stage compute -entry main
[numthreads(1, 1, 1)]
void main(
diff --git a/tests/reflection/cross-compile.slang.expected b/tests/reflection/cross-compile.slang.expected
index 3bb730f66..a54598d08 100644
--- a/tests/reflection/cross-compile.slang.expected
+++ b/tests/reflection/cross-compile.slang.expected
@@ -43,6 +43,12 @@ standard output = {
}
}
}
+ ],
+ "entryPoints": [
+ {
+ "name": "main",
+ "stage:": "fragment"
+ }
]
}
}
diff --git a/tests/reflection/explicit-register-space.slang.expected b/tests/reflection/explicit-register-space.slang.expected
index 7c1a88662..c9e32c4f5 100644
--- a/tests/reflection/explicit-register-space.slang.expected
+++ b/tests/reflection/explicit-register-space.slang.expected
@@ -12,6 +12,12 @@ standard output = {
"baseShape": "texture2D"
}
}
+ ],
+ "entryPoints": [
+ {
+ "name": "main",
+ "stage:": "fragment"
+ }
]
}
}
diff --git a/tests/reflection/global-type-params.slang.expected b/tests/reflection/global-type-params.slang.expected
index 1e3a6aa99..308738b55 100644
--- a/tests/reflection/global-type-params.slang.expected
+++ b/tests/reflection/global-type-params.slang.expected
@@ -100,6 +100,12 @@ standard output = {
}
}
],
+ "entryPoints": [
+ {
+ "name": "main",
+ "stage:": "fragment"
+ }
+ ],
"typeParams":
[
{
diff --git a/tests/reflection/matrix-layout.slang.1.expected b/tests/reflection/matrix-layout.slang.1.expected
index eb06adede..221b96a0b 100644
--- a/tests/reflection/matrix-layout.slang.1.expected
+++ b/tests/reflection/matrix-layout.slang.1.expected
@@ -116,6 +116,12 @@ standard output = {
}
}
}
+ ],
+ "entryPoints": [
+ {
+ "name": "main",
+ "stage:": "fragment"
+ }
]
}
}
diff --git a/tests/reflection/matrix-layout.slang.expected b/tests/reflection/matrix-layout.slang.expected
index afd2001fb..04c861ed3 100644
--- a/tests/reflection/matrix-layout.slang.expected
+++ b/tests/reflection/matrix-layout.slang.expected
@@ -116,6 +116,12 @@ standard output = {
}
}
}
+ ],
+ "entryPoints": [
+ {
+ "name": "main",
+ "stage:": "fragment"
+ }
]
}
}
diff --git a/tests/reflection/multi-file.hlsl b/tests/reflection/multi-file.hlsl
index 3282c12f4..4a9cf9a86 100644
--- a/tests/reflection/multi-file.hlsl
+++ b/tests/reflection/multi-file.hlsl
@@ -1,4 +1,4 @@
-//TEST:REFLECTION:-profile ps_4_0 -entry mainFS -target hlsl tests/reflection/multi-file-extra.hlsl -profile vs_4_0 -entry mainVS
+//TEST:REFLECTION:-entry mainFS -profile ps_4_0 -target hlsl tests/reflection/multi-file-extra.hlsl -entry mainVS -profile vs_4_0
// Here we are testing the case where multiple translation units are provided
// at once, so that we want combined reflection information for the resulting
diff --git a/tests/reflection/parameter-block.slang b/tests/reflection/parameter-block.slang
index c20337480..5fbcbb959 100644
--- a/tests/reflection/parameter-block.slang
+++ b/tests/reflection/parameter-block.slang
@@ -1,4 +1,4 @@
-//TEST:REFLECTION:-profile glsl_fragment -target glsl
+//TEST:REFLECTION:-stage fragment -target glsl
// Confirm that we do parameter binding correctly
// when we have both a parameter block *and* user-defined
diff --git a/tests/reflection/parameter-block.slang.expected b/tests/reflection/parameter-block.slang.expected
index 6821c46ca..58344bc12 100644
--- a/tests/reflection/parameter-block.slang.expected
+++ b/tests/reflection/parameter-block.slang.expected
@@ -40,6 +40,12 @@ standard output = {
"baseShape": "texture2D"
}
}
+ ],
+ "entryPoints": [
+ {
+ "name": "main",
+ "stage:": "fragment"
+ }
]
}
}
diff --git a/tests/render/tess.hlsl b/tests/render/tess.hlsl
index 1cd01ef33..873c0bc8c 100644
--- a/tests/render/tess.hlsl
+++ b/tests/render/tess.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -target dxbc-assembly -profile hs_5_1 -entry HS -profile ds_5_1 -entry DS
+//TEST:COMPARE_HLSL: -profile sm_5_1 -entry HS -stage hull -entry DS -stage domain
// tests/render/tess.hlsl
diff --git a/tests/rewriter/error0.hlsl b/tests/rewriter/error0.hlsl
index e42dec23e..d3deb2953 100644
--- a/tests/rewriter/error0.hlsl
+++ b/tests/rewriter/error0.hlsl
@@ -1,4 +1,7 @@
-//TEST(smoke):COMPARE_HLSL: -no-checking -target dxbc-assembly -profile ps_4_0 -entry main
+// Disbaled because Slang does semantic checks now, not the downstream compiler.
+
+//TEST_IGNORE_FILE
+//TEST(smoke):COMPARE_HLSL: -profile ps_4_0 -entry main
// We need to confirm that when there is an error in
// the input code, we allow the downstream compiler
diff --git a/tests/rewriter/gh-160.hlsl b/tests/rewriter/gh-160.hlsl
index 46ef6a92c..b412a75a1 100644
--- a/tests/rewriter/gh-160.hlsl
+++ b/tests/rewriter/gh-160.hlsl
@@ -1,4 +1,6 @@
-//TEST:COMPARE_HLSL: -no-checking -target dxbc-assembly -profile ps_4_0 -entry main
+// Disabled because Slang should give the error, not downstream compiler
+//TEST_IGNORE_FILE
+//TEST:COMPARE_HLSL: -profile ps_4_0 -entry main
#ifdef __SLANG__
__import gh_160;
diff --git a/tests/rewriter/type-splitting.hlsl b/tests/rewriter/type-splitting.hlsl
index b3cad1ce0..0826cbf21 100644
--- a/tests/rewriter/type-splitting.hlsl
+++ b/tests/rewriter/type-splitting.hlsl
@@ -1,4 +1,4 @@
-//TEST:COMPARE_HLSL: -split-mixed-types -no-checking -target dxbc-assembly -profile ps_4_0 -entry main
+//TEST:COMPARE_HLSL: -profile ps_4_0 -entry main
// Confirm that the `-split-mixed-types` flag works.
@@ -37,22 +37,22 @@ float4 main() : SV_Target
// - Fields of resource type get hoisted out of variable declarations
//
-struct Foo
+struct Foo_0
{
- float2 u;
+ float2 u_0;
};
-cbuffer C
+cbuffer C_0
{
- Foo foo;
+ Foo_0 foo_0;
}
-Texture2D SLANG_parameterGroup_C_foo_t;
-SamplerState SLANG_parameterGroup_C_foo_s;
+Texture2D C_foo_t_0;
+SamplerState C_foo_s_0;
-float4 main() : SV_Target
+float4 main() : SV_TARGET
{
- return SLANG_parameterGroup_C_foo_t.Sample(SLANG_parameterGroup_C_foo_s, foo.u);
+ return C_foo_t_0.Sample(C_foo_s_0, foo_0.u_0);
}
#endif
diff --git a/tools/slang-test/main.cpp b/tools/slang-test/main.cpp
index 8eda760d4..56fefbd9d 100644
--- a/tools/slang-test/main.cpp
+++ b/tools/slang-test/main.cpp
@@ -955,6 +955,15 @@ TestResult runCrossCompilerTest(TestContext* context, TestInput& input)
result = TestResult::Fail;
}
+ // Always fail if the compilation produced a failure, just
+ // to catch situations where, e.g., command-line options parsing
+ // caused the same error in both the Slang and glslang cases.
+ //
+ if( actualSpawner.getResultCode() != 0 )
+ {
+ result = TestResult::Fail;
+ }
+
// If the test failed, then we write the actual output to a file
// so that we can easily diff it from the command line and
// diagnose the problem.
@@ -1088,6 +1097,15 @@ TestResult runHLSLComparisonTest(TestContext* context, TestInput& input)
result = TestResult::Fail;
}
+ // Always fail if the compilation produced a failure, just
+ // to catch situations where, e.g., command-line options parsing
+ // caused the same error in both the Slang and fxc cases.
+ //
+ if( resultCode != 0 )
+ {
+ result = TestResult::Fail;
+ }
+
// If the test failed, then we write the actual output to a file
// so that we can easily diff it from the command line and
// diagnose the problem.