Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions apps/typegpu-docs/tests/individual-example-tests/3d-fish.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,6 @@ describe('3d fish example', () => {
return vertexShader_Output(worldPosition.xyz, worldNormal, canvasPosition, (*currentModelData).variant, _arg_textureUV, (*currentModelData).applySeaFog, (*currentModelData).applySeaDesaturation);
}

struct fragmentShader_Input {
@location(0) worldPosition: vec3f,
@location(1) worldNormal: vec3f,
@location(2) variant: f32,
@location(3) textureUV: vec2f,
@location(4) @interpolate(flat) applySeaFog: u32,
@location(5) @interpolate(flat) applySeaDesaturation: u32,
}

@group(0) @binding(1) var modelTexture: texture_2d<f32>;

@group(0) @binding(3) var sampler_1: sampler;
Expand Down Expand Up @@ -418,6 +409,15 @@ describe('3d fish example', () => {
return vec3f(r, g, b);
}

struct fragmentShader_Input {
@location(0) worldPosition: vec3f,
@location(1) worldNormal: vec3f,
@location(2) variant: f32,
@location(3) textureUV: vec2f,
@location(4) @interpolate(flat) applySeaFog: u32,
@location(5) @interpolate(flat) applySeaDesaturation: u32,
}

@fragment fn fragmentShader(_arg_0: fragmentShader_Input) -> @location(0) vec4f {
var textureColorWithAlpha = textureSample(modelTexture, sampler_1, _arg_0.textureUV);
var textureColor = textureColorWithAlpha.rgb;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ describe('bitonic sort example', () => {
return fullScreenTriangle_Output(vec4f(pos[vertexIndex], 0, 1), uv[vertexIndex]);
}

@group(0) @binding(0) var<storage, read> data_1: array<u32>;

struct fragmentFn_Input {
@location(0) uv: vec2f,
}

@group(0) @binding(0) var<storage, read> data_1: array<u32>;

@fragment fn fragmentFn(_arg_0: fragmentFn_Input) -> @location(0) vec4f {
let data = (&data_1);
let arrayLength_1 = arrayLength(&(*data));
Expand Down
8 changes: 4 additions & 4 deletions apps/typegpu-docs/tests/individual-example-tests/blur.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,14 +470,14 @@ describe('blur example', () => {
return fullScreenTriangle_Output(vec4f(pos[vertexIndex], 0, 1), uv[vertexIndex]);
}

struct renderFragment_Input {
@location(0) uv: vec2f,
}

@group(0) @binding(0) var renderView: texture_2d<f32>;

@group(0) @binding(1) var sampler_1: sampler;

struct renderFragment_Input {
@location(0) uv: vec2f,
}

@fragment fn renderFragment(_arg_0: renderFragment_Input) -> @location(0) vec4f {
return textureSample(renderView, sampler_1, _arg_0.uv);
}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ describe('camera thresholding example', () => {
return fullScreenTriangle_Output(vec4f(pos[vertexIndex], 0, 1), uv[vertexIndex]);
}

struct mainFrag_Input {
@location(0) uv: vec2f,
}

@group(0) @binding(0) var<uniform> uvTransformUniform: mat2x2f;

@group(1) @binding(0) var inputTexture: texture_external;
Expand All @@ -48,6 +44,10 @@ describe('camera thresholding example', () => {

@group(0) @binding(3) var<uniform> thresholdBuffer: f32;

struct mainFrag_Input {
@location(0) uv: vec2f,
}

@fragment fn mainFrag(_arg_0: mainFrag_Input) -> @location(0) vec4f {
var uv2 = ((uvTransformUniform * (_arg_0.uv - 0.5f)) + 0.5f);
var col = textureSampleBaseClampToEdge(inputTexture, sampler_1, uv2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ describe('caustics example', () => {
return mainVertex_Output(vec4f(pos[vertexIndex], 0f, 1f), uv[vertexIndex]);
}

struct mainFragment_Input {
@location(0) uv: vec2f,
}

@group(0) @binding(0) var<uniform> tileDensity: f32;

fn tilePattern(uv: vec2f) -> f32 {
Expand Down Expand Up @@ -120,6 +116,10 @@ describe('caustics example', () => {
return mat2x2f(vec2f(cos(angle), sin(angle)), vec2f(-(sin(angle)), cos(angle)));
}

struct mainFragment_Input {
@location(0) uv: vec2f,
}

@fragment fn mainFragment(_arg_0: mainFragment_Input) -> @location(0) vec4f {
var skewMat = mat2x2f(vec2f(0.9800665974617004, 0.19866932928562164), vec2f((-1.9866933079506122f + (_arg_0.uv.x * 3f)), 4.900332889206208f));
var skewedUv = (skewMat * _arg_0.uv);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ describe('chroma keying example', () => {
return fullScreenTriangle_Output(vec4f(pos[vertexIndex], 0, 1), uv[vertexIndex]);
}

struct fragment_Input {
@location(0) uv: vec2f,
}

@group(0) @binding(0) var<uniform> uvTransform: mat2x2f;

@group(1) @binding(0) var inputTexture: texture_external;
Expand All @@ -48,6 +44,10 @@ describe('chroma keying example', () => {

@group(0) @binding(3) var<uniform> threshold: f32;

struct fragment_Input {
@location(0) uv: vec2f,
}

@fragment fn fragment(_arg_0: fragment_Input) -> @location(0) vec4f {
var uv2 = ((uvTransform * (_arg_0.uv - 0.5f)) + 0.5f);
var col = textureSampleBaseClampToEdge(inputTexture, sampler_1, uv2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ describe('confetti example', () => {

struct VertexIn {
@location(0) tilt: f32,
@location(1) angle: f32,
@location(2) color: vec4f,
@location(3) center: vec2f,
@builtin(vertex_index) vertexIndex: u32,
@location(1) angle: f32,
@location(2) center: vec2f,
@location(3) color: vec4f,
}

@vertex fn vertex(_arg_0: VertexIn) -> VertexOut {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,14 @@ describe('cubemap reflection example', () => {
return cubeVertexFn_Output((camera.projection * vec4f(viewPos, 1f)), _arg_position.xyz);
}

struct cubeFragmentFn_Input {
@location(0) texCoord: vec3f,
}

@group(1) @binding(0) var cubemap: texture_cube<f32>;

@group(1) @binding(1) var texSampler: sampler;

struct cubeFragmentFn_Input {
@location(0) texCoord: vec3f,
}

@fragment fn cubeFragmentFn(_arg_0: cubeFragmentFn_Input) -> @location(0) vec4f {
return textureSample(cubemap, texSampler, normalize(_arg_0.texCoord));
}
Expand All @@ -287,11 +287,6 @@ describe('cubemap reflection example', () => {
return vertexFn_Output((camera.projection * (camera.view * _arg_position)), _arg_normal, _arg_position);
}

struct fragmentFn_Input {
@location(0) normal: vec4f,
@location(1) worldPos: vec4f,
}

struct DirectionalLight {
direction: vec3f,
color: vec3f,
Expand All @@ -314,6 +309,11 @@ describe('cubemap reflection example', () => {

@group(1) @binding(1) var texSampler: sampler;

struct fragmentFn_Input {
@location(0) normal: vec4f,
@location(1) worldPos: vec4f,
}

@fragment fn fragmentFn(_arg_0: fragmentFn_Input) -> @location(0) vec4f {
var normalizedNormal = normalize(_arg_0.normal.xyz);
var normalizedLightDir = normalize(light.direction);
Expand Down
16 changes: 8 additions & 8 deletions apps/typegpu-docs/tests/individual-example-tests/disco.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ describe('disco example', () => {
return mainVertex_Output(vec4f(pos[vertexIndex], 0f, 1f), uv[vertexIndex]);
}

struct mainFragment2_Input {
@location(0) uv: vec2f,
}

@group(0) @binding(0) var<uniform> resolutionUniform: vec2f;

fn aspectCorrected(uv: vec2f) -> vec2f {
Expand Down Expand Up @@ -65,6 +61,10 @@ describe('disco example', () => {
return (acc + (col * weight));
}

struct mainFragment2_Input {
@location(0) uv: vec2f,
}

@fragment fn mainFragment2(_arg_0: mainFragment2_Input) -> @location(0) vec4f {
var originalUv = aspectCorrected(_arg_0.uv);
var aspectUv = originalUv;
Expand Down Expand Up @@ -243,10 +243,6 @@ describe('disco example', () => {
return mainVertex_Output(vec4f(pos[vertexIndex], 0f, 1f), uv[vertexIndex]);
}

struct mainFragment1_Input {
@location(0) uv: vec2f,
}

@group(0) @binding(0) var<uniform> resolutionUniform: vec2f;

fn aspectCorrected(uv: vec2f) -> vec2f {
Expand Down Expand Up @@ -276,6 +272,10 @@ describe('disco example', () => {
return (acc + (col * weight));
}

struct mainFragment1_Input {
@location(0) uv: vec2f,
}

@fragment fn mainFragment1(_arg_0: mainFragment1_Input) -> @location(0) vec4f {
var originalUv = aspectCorrected(_arg_0.uv);
var aspectUv = originalUv;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,10 +558,6 @@ describe('fluid double buffering example', () => {
return vertexMain_Output(vec4f(pos[_arg_idx].x, pos[_arg_idx].y, 0f, 1f), uv[_arg_idx]);
}

struct fragmentMain_Input {
@location(0) uv: vec2f,
}

fn coordsToIndex(x: i32, y: i32) -> i32 {
return (x + (y * 256i));
}
Expand Down Expand Up @@ -595,6 +591,10 @@ describe('fluid double buffering example', () => {
return false;
}

struct fragmentMain_Input {
@location(0) uv: vec2f,
}

@fragment fn fragmentMain(_arg_0: fragmentMain_Input) -> @location(0) vec4f {
let x = i32((_arg_0.uv.x * 256f));
let y = i32((_arg_0.uv.y * 256f));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,6 @@ describe('game of life example', () => {
return fullScreenTriangle_Output(vec4f(pos[vertexIndex], 0, 1), uv[vertexIndex]);
}

struct displayFragment_Input {
@location(0) uv: vec2f,
}

struct ZoomParams {
enabled: u32,
level: f32,
Expand All @@ -242,6 +238,10 @@ describe('game of life example', () => {

@group(0) @binding(2) var<uniform> viewModeUniform: u32;

struct displayFragment_Input {
@location(0) uv: vec2f,
}

@fragment fn displayFragment(_arg_0: displayFragment_Input) -> @location(0) vec4f {
let zoom = (&zoomUniform);
let gs = f32(gameSizeUniform);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ describe('gradient tiles example', () => {
return fullScreenTriangle_Output(vec4f(pos[vertexIndex], 0, 1), uv[vertexIndex]);
}

@group(0) @binding(0) var<uniform> spanUniform: vec2f;

struct fragment_Input {
@location(0) uv: vec2f,
}

@group(0) @binding(0) var<uniform> spanUniform: vec2f;

@fragment fn fragment(_arg_0: fragment_Input) -> @location(0) vec4f {
let red = (floor((_arg_0.uv.x * spanUniform.x)) / spanUniform.x);
let green = (floor((_arg_0.uv.y * spanUniform.y)) / spanUniform.y);
Expand Down
20 changes: 10 additions & 10 deletions apps/typegpu-docs/tests/individual-example-tests/gravity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,14 @@ describe('gravity example', () => {
return skyBoxVertex_Output((camera.projection * vec4f(viewPos, 1f)), _arg_position.xyz);
}

struct skyBoxFragment_Input {
@location(0) texCoord: vec3f,
}

@group(0) @binding(1) var skyBox: texture_cube<f32>;

@group(0) @binding(2) var sampler_1: sampler;

struct skyBoxFragment_Input {
@location(0) texCoord: vec3f,
}

@fragment fn skyBoxFragment(_arg_0: skyBoxFragment_Input) -> @location(0) vec4f {
return textureSample(skyBox, sampler_1, normalize(_arg_0.texCoord));
}
Expand Down Expand Up @@ -250,6 +250,12 @@ describe('gravity example', () => {
return mainVertex_Output(positionOnCanvas, _arg_uv, _arg_normal, worldPosition, (*currentBody).textureIndex, (*currentBody).destroyed, (*currentBody).ambientLightFactor);
}

@group(1) @binding(0) var celestialBodyTextures: texture_2d_array<f32>;

@group(0) @binding(1) var sampler_1: sampler;

@group(0) @binding(2) var<uniform> lightSource: vec3f;

struct mainFragment_Input {
@location(0) uv: vec2f,
@location(1) normals: vec3f,
Expand All @@ -259,12 +265,6 @@ describe('gravity example', () => {
@location(5) ambientLightFactor: f32,
}

@group(1) @binding(0) var celestialBodyTextures: texture_2d_array<f32>;

@group(0) @binding(1) var sampler_1: sampler;

@group(0) @binding(2) var<uniform> lightSource: vec3f;

@fragment fn mainFragment(_arg_0: mainFragment_Input) -> @location(0) vec4f {
if ((_arg_0.destroyed == 1u)) {
discard;;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ describe('image tuning example', () => {
return fullScreenTriangle_Output(vec4f(pos[vertexIndex], 0, 1), uv[vertexIndex]);
}

struct fragment_Input {
@location(0) uv: vec2f,
}

@group(0) @binding(0) var imageView: texture_2d<f32>;

@group(0) @binding(1) var imageSampler: sampler;
Expand Down Expand Up @@ -68,6 +64,10 @@ describe('image tuning example', () => {

@group(0) @binding(4) var<uniform> adjustments: Adjustments;

struct fragment_Input {
@location(0) uv: vec2f,
}

@fragment fn fragment(_arg_0: fragment_Input) -> @location(0) vec4f {
var color = textureSample(imageView, imageSampler, _arg_0.uv).rgb;
let inputLuminance = dot(color, vec3f(0.29899999499320984, 0.5870000123977661, 0.11400000005960464));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ describe('jelly-slider example', () => {
return fullScreenTriangle_Output(vec4f(pos[vertexIndex], 0, 1), uv[vertexIndex]);
}

struct raymarchFn_Input {
@location(0) uv: vec2f,
}

@group(0) @binding(0) var<uniform> randomUniform: vec2f;

var<private> seed: vec2f;
Expand Down Expand Up @@ -583,6 +579,10 @@ describe('jelly-slider example', () => {
return background;
}

struct raymarchFn_Input {
@location(0) uv: vec2f,
}

@fragment fn raymarchFn(_arg_0: raymarchFn_Input) -> @location(0) vec4f {
randSeed2((randomUniform * _arg_0.uv));
var ndc = vec2f(((_arg_0.uv.x * 2f) - 1f), -(((_arg_0.uv.y * 2f) - 1f)));
Expand Down Expand Up @@ -713,14 +713,14 @@ describe('jelly-slider example', () => {
return fullScreenTriangle_Output(vec4f(pos[vertexIndex], 0, 1), uv[vertexIndex]);
}

struct fragmentMain_Input {
@location(0) uv: vec2f,
}

@group(1) @binding(0) var currentTexture: texture_2d<f32>;

@group(0) @binding(0) var filteringSampler: sampler;

struct fragmentMain_Input {
@location(0) uv: vec2f,
}

@fragment fn fragmentMain(_arg_0: fragmentMain_Input) -> @location(0) vec4f {
return textureSample(currentTexture, filteringSampler, _arg_0.uv);
}
Expand Down
Loading
Loading