diff options
Diffstat (limited to 'docs/user-guide/01-get-started.md')
| -rw-r--r-- | docs/user-guide/01-get-started.md | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/docs/user-guide/01-get-started.md b/docs/user-guide/01-get-started.md index de67bd98f..536203801 100644 --- a/docs/user-guide/01-get-started.md +++ b/docs/user-guide/01-get-started.md @@ -12,7 +12,7 @@ If you are interested in building from source, please refer to the [documentatio In this section we demonstrate how to write a simple compute shader in Slang that adds numbers from two buffers and writes the results into a third buffer. To start, create a text file named `hello-world.slang` in any directory, and paste the following content in the newly created file: -``` +```hlsl // hello-world.slang StructuredBuffer<float> buffer0; StructuredBuffer<float> buffer1; @@ -31,17 +31,17 @@ As you can see, `hello-world.slang` is no different from a normal HLSL shader fi Slang supports compiling shaders into many different targets including Direct3D 11, Direct3D 12, Vulkan, CUDA and C++ (for execution on CPU). You can run `slangc` with the following command line to compile `hello-world.slang` into Vulkan SPIRV: -``` +```bat .\slangc.exe hello-world.slang -profile glsl_450 -target spirv -o hello-world.spv -entry computeMain ``` If you would like to see the equivalent GLSL of the generated SPIRV code, simply change the `-target` argument to `glsl`: -``` +```bat .\slangc.exe hello-world.slang -profile glsl_450 -target glsl -o hello-world.glsl -entry computeMain ``` The resulting `hello-world.glsl` generated by `slangc` is shown below: -``` +```glsl // hello-world.glsl (generated by slangc) #version 450 layout(row_major) uniform; @@ -90,4 +90,8 @@ Note that in the generated GLSL code, all shader parameters are qualified with e ## The full example +> #### Note #### +> The current `hello-world` implementation does not use raw Vulkan API calls; +> this will be addressed in a future revision so that it matches the documentation. + The full Vulkan example that sets up and runs the `hello-world.slang` shader in located in the `/examples/hello-world` directory of the Slang repository. The example code initializes a Vulkan context and runs the compiled SPIRV code. |
