diff options
| author | Matthew Moulton <30711895+mmoult@users.noreply.github.com> | 2024-06-07 10:47:17 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-07 08:47:17 -0700 |
| commit | 78d34f3b3cec6222f87fc69eddfe66f3fc91b1cf (patch) | |
| tree | 3e3b2596e401c722de7c84b1e35a923d2051d0a7 /examples | |
| parent | 7c6faf62158eed309f01bbef8a7b88e0c36459c7 (diff) | |
Improve documentation and example formatting consistency (#4299)
* Improve doc and example consistency
Improve consistency of formatting in example shaders and remove
trailing spaces in documentation files. Fix minor typos.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/autodiff-texture/draw-quad.slang | 2 | ||||
| -rw-r--r-- | examples/autodiff-texture/reconstruct.slang | 4 | ||||
| -rw-r--r-- | examples/autodiff-texture/train.slang | 6 | ||||
| -rw-r--r-- | examples/gpu-printing/printing.slang | 15 | ||||
| -rw-r--r-- | examples/model-viewer/shaders.slang | 5 | ||||
| -rw-r--r-- | examples/shader-toy/example-effect.slang | 16 | ||||
| -rw-r--r-- | examples/shader-toy/shader-toy.slang | 2 |
7 files changed, 25 insertions, 25 deletions
diff --git a/examples/autodiff-texture/draw-quad.slang b/examples/autodiff-texture/draw-quad.slang index 55a33b46b..6742e12fa 100644 --- a/examples/autodiff-texture/draw-quad.slang +++ b/examples/autodiff-texture/draw-quad.slang @@ -25,7 +25,7 @@ struct Fragment struct VertexStageOutput { float2 uv : UV; - float4 sv_position : SV_Position; + float4 sv_position : SV_Position; }; [shader("vertex")] diff --git a/examples/autodiff-texture/reconstruct.slang b/examples/autodiff-texture/reconstruct.slang index c123010e5..8ea033160 100644 --- a/examples/autodiff-texture/reconstruct.slang +++ b/examples/autodiff-texture/reconstruct.slang @@ -28,8 +28,8 @@ void computeMain(uint3 threadIdx : SV_DispatchThreadID) newDstValToAdd = (float3)dstVal.xyz * float3(1.0 / (dstVal.w * 65536.0)); float4 existingVal = 0.0; - - if (dstLayer < layerCount - 1 ) + + if (dstLayer < layerCount - 1) { uint parentOffset = mipOffset[(dstLayer + 1) / 4][(dstLayer + 1) % 4]; uint parentW = dstW / 2; diff --git a/examples/autodiff-texture/train.slang b/examples/autodiff-texture/train.slang index e171d3d71..c6a819d2f 100644 --- a/examples/autodiff-texture/train.slang +++ b/examples/autodiff-texture/train.slang @@ -2,12 +2,12 @@ // This class encapsulates a differentiable texture object that uses // hardware sampling for the primal version, but substitutes a reference -// interpolation implementation to generate backward pass. -// +// interpolation implementation to generate backward pass. +// // This specific implementation also makes the choice to use fast fixed point // atomics to accumulate the derivative (suitable for this example, but maybe // not in general) -// +// struct DifferentiableTexture { RWStructuredBuffer<int> accumulateBuffer; // Per-mip-level accumulate buffer diff --git a/examples/gpu-printing/printing.slang b/examples/gpu-printing/printing.slang index 0abf57e34..dc1ea3d5f 100644 --- a/examples/gpu-printing/printing.slang +++ b/examples/gpu-printing/printing.slang @@ -55,7 +55,8 @@ enum PrintingOp // // The core allocation operation here is `_allocatePrintWords()` - // Allocate space for one or more print commands. +// Allocate space for one or more print commands. +// uint _allocatePrintWords(uint wordCount) { // We allocate the required number of words with an atomic, and @@ -214,12 +215,12 @@ extension String : IPrintable // to scale up to a two-argument `println()` function that can // work for any combination of printable types. - // Print two values, `a` and `b`. - // - // This function ensures that the values of `a` and `b` - // are written out atomically, without values printed - // from other threads spliced in between. - // +// Print two values, `a` and `b`. +// +// This function ensures that the values of `a` and `b` +// are written out atomically, without values printed +// from other threads spliced in between. +// void println<A : IPrintable, B : IPrintable>(A a, B b) { // To print two values atomically, we must first diff --git a/examples/model-viewer/shaders.slang b/examples/model-viewer/shaders.slang index 81ec89d03..d99a4b1da 100644 --- a/examples/model-viewer/shaders.slang +++ b/examples/model-viewer/shaders.slang @@ -90,7 +90,7 @@ struct BlinnPhong : IBRDF // for our example cube, and the result is a non-finite value // coming out of `evaluate()` if we include the specular term. -// return kd*nDotL + ks*pow(nDotH, specularity); + // return kd*nDotL + ks*pow(nDotH, specularity); return kd*nDotL; } }; @@ -142,7 +142,6 @@ interface IMaterial // assumption in the shader code that `gMaterial` will be plugged // in using an instance of `SimpleMaterial` // -// struct SimpleMaterial : IMaterial { // We declare the properties we need as fields of the material type. @@ -200,7 +199,7 @@ interface ILightEnv float3 illuminate<B:IBRDF>(SurfaceGeometry g, B brdf, float3 wo); // // Note that the `illuminate()` method is allowed as an interface - // requirement in Slang even though it is a generic. Constract that + // requirement in Slang even though it is a generic. Contrast that // with C++ where a `template` method cannot be `virtual`. }; diff --git a/examples/shader-toy/example-effect.slang b/examples/shader-toy/example-effect.slang index 966894a87..a79f53192 100644 --- a/examples/shader-toy/example-effect.slang +++ b/examples/shader-toy/example-effect.slang @@ -43,29 +43,29 @@ void mainImage(out vec4 fragColor, in vec2 fragCoord) float frequency = 5.0f; vec2 pos = (uv + iTime*vec2(0.25f, 0.0f)) * frequency; - + vec2 center = floor(pos + vec2(0.5)); - + float r0 = rand(center.x*3.0f + center.y*7.0f); float r1 = rand(center.x*7.0f + center.y*13.0f); float r2 = rand(center.x*13.0f + center.y*3.0f); - + float p = mix(0.0f, 4.0f, r0); float f = mix(5.0f, 8.0f, r1); - + float a = 0.5f * (1.0f + cos(iTime*f + p)); - + float rad0 = mix(0.1, 0.4, r2); float rad1 = mix(0.2, 0.9, r0); - + float radius = 0.5f*mix(rad0, rad1, a); vec2 delta = pos - center; float distance = length(delta); - + fragColor.xyz = vec3(r0, r1, r2); fragColor.w = 1.0f; - + if(distance > radius) fragColor.xyz = vec3(0.25f); } diff --git a/examples/shader-toy/shader-toy.slang b/examples/shader-toy/shader-toy.slang index e434e2680..41949f389 100644 --- a/examples/shader-toy/shader-toy.slang +++ b/examples/shader-toy/shader-toy.slang @@ -330,7 +330,7 @@ struct mat2 // } // // Instead, we will define an ordinary function for the one case that -// we 've run into in a test effect so far: +// we've run into in a test effect so far: // void mulAssign(inout vec2 left, mat2 right) { |
