Skip to content

Commit

Permalink
Deploying to gh-pages from @ 02be18c 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Mar 8, 2024
1 parent 056b6b3 commit f07ca31
Show file tree
Hide file tree
Showing 73 changed files with 587 additions and 587 deletions.
12 changes: 6 additions & 6 deletions sample/a-buffer/composite.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
struct Uniforms {
modelViewProjectionMatrix: mat4x4<f32>,
modelViewProjectionMatrix: mat4x4f,
maxStorableFragments: u32,
targetWidth: u32,
};
Expand All @@ -14,7 +14,7 @@ struct Heads {
};

struct LinkedListElement {
color: vec4<f32>,
color: vec4f,
depth: f32,
next: u32
};
Expand All @@ -30,8 +30,8 @@ struct LinkedList {

// Output a full screen quad
@vertex
fn main_vs(@builtin(vertex_index) vertIndex: u32) -> @builtin(position) vec4<f32> {
const position = array<vec2<f32>, 6>(
fn main_vs(@builtin(vertex_index) vertIndex: u32) -> @builtin(position) vec4f {
const position = array<vec2f, 6>(
vec2(-1.0, -1.0),
vec2(1.0, -1.0),
vec2(1.0, 1.0),
Expand All @@ -44,8 +44,8 @@ fn main_vs(@builtin(vertex_index) vertIndex: u32) -> @builtin(position) vec4<f32
}

@fragment
fn main_fs(@builtin(position) position: vec4<f32>) -> @location(0) vec4<f32> {
let fragCoords = vec2<i32>(position.xy);
fn main_fs(@builtin(position) position: vec4f) -> @location(0) vec4f {
let fragCoords = vec2i(position.xy);
let headsIndex = u32(fragCoords.y - sliceInfo.sliceStartY) * uniforms.targetWidth + u32(fragCoords.x);

// The maximum layers we can process for any pixel
Expand Down
40 changes: 20 additions & 20 deletions sample/a-buffer/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sample/a-buffer/main.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions sample/a-buffer/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const indexBuffer = device.createBuffer({
}

// Uniforms contains:
// * modelViewProjectionMatrix: mat4x4<f32>
// * modelViewProjectionMatrix: mat4x4f
// * maxStorableFragments: u32
// * targetWidth: u32
const uniformsSize = roundUp(
Expand Down Expand Up @@ -365,7 +365,7 @@ const configure = () => {
const averageLayersPerFragment = 4;

// Each element stores
// * color : vec4<f32>
// * color : vec4f
// * depth : f32
// * index of next element in the list : u32
const linkedListElementSize =
Expand Down
10 changes: 5 additions & 5 deletions sample/a-buffer/opaque.wgsl
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
struct Uniforms {
modelViewProjectionMatrix: mat4x4<f32>,
modelViewProjectionMatrix: mat4x4f,
};

@binding(0) @group(0) var<uniform> uniforms: Uniforms;

struct VertexOutput {
@builtin(position) position: vec4<f32>,
@builtin(position) position: vec4f,
@location(0) @interpolate(flat) instance: u32
};

@vertex
fn main_vs(@location(0) position: vec4<f32>, @builtin(instance_index) instance: u32) -> VertexOutput {
fn main_vs(@location(0) position: vec4f, @builtin(instance_index) instance: u32) -> VertexOutput {
var output: VertexOutput;

// distribute instances into a staggered 4x4 grid
Expand All @@ -30,8 +30,8 @@ fn main_vs(@location(0) position: vec4<f32>, @builtin(instance_index) instance:
}

@fragment
fn main_fs(@location(0) @interpolate(flat) instance: u32) -> @location(0) vec4<f32> {
const colors = array<vec3<f32>,6>(
fn main_fs(@location(0) @interpolate(flat) instance: u32) -> @location(0) vec4f {
const colors = array<vec3f,6>(
vec3(1.0, 0.0, 0.0),
vec3(0.0, 1.0, 0.0),
vec3(0.0, 0.0, 1.0),
Expand Down
14 changes: 7 additions & 7 deletions sample/a-buffer/translucent.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
struct Uniforms {
modelViewProjectionMatrix: mat4x4<f32>,
modelViewProjectionMatrix: mat4x4f,
maxStorableFragments: u32,
targetWidth: u32,
};
Expand All @@ -14,7 +14,7 @@ struct Heads {
};

struct LinkedListElement {
color: vec4<f32>,
color: vec4f,
depth: f32,
next: u32
};
Expand All @@ -30,12 +30,12 @@ struct LinkedList {
@binding(4) @group(0) var<uniform> sliceInfo: SliceInfo;

struct VertexOutput {
@builtin(position) position: vec4<f32>,
@builtin(position) position: vec4f,
@location(0) @interpolate(flat) instance: u32
};

@vertex
fn main_vs(@location(0) position: vec4<f32>, @builtin(instance_index) instance: u32) -> VertexOutput {
fn main_vs(@location(0) position: vec4f, @builtin(instance_index) instance: u32) -> VertexOutput {
var output: VertexOutput;

// distribute instances into a staggered 4x4 grid
Expand All @@ -56,8 +56,8 @@ fn main_vs(@location(0) position: vec4<f32>, @builtin(instance_index) instance:
}

@fragment
fn main_fs(@builtin(position) position: vec4<f32>, @location(0) @interpolate(flat) instance: u32) {
const colors = array<vec3<f32>,6>(
fn main_fs(@builtin(position) position: vec4f, @location(0) @interpolate(flat) instance: u32) {
const colors = array<vec3f,6>(
vec3(1.0, 0.0, 0.0),
vec3(0.0, 1.0, 0.0),
vec3(0.0, 0.0, 1.0),
Expand All @@ -66,7 +66,7 @@ fn main_fs(@builtin(position) position: vec4<f32>, @location(0) @interpolate(fla
vec3(0.0, 1.0, 1.0),
);

let fragCoords = vec2<i32>(position.xy);
let fragCoords = vec2i(position.xy);
let opaqueDepth = textureLoad(opaqueDepthTexture, fragCoords, 0);

// reject fragments behind opaque objects
Expand Down
10 changes: 5 additions & 5 deletions sample/animometer/animometer.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ struct Uniforms {
@binding(0) @group(1) var<uniform> uniforms : Uniforms;

struct VertexOutput {
@builtin(position) Position : vec4<f32>,
@location(0) v_color : vec4<f32>,
@builtin(position) Position : vec4f,
@location(0) v_color : vec4f,
}

@vertex
fn vert_main(
@location(0) position : vec4<f32>,
@location(1) color : vec4<f32>
@location(0) position : vec4f,
@location(1) color : vec4f
) -> VertexOutput {
var fade = (uniforms.scalarOffset + time.value * uniforms.scalar / 10.0) % 1.0;
if (fade < 0.5) {
Expand All @@ -44,6 +44,6 @@ fn vert_main(
}

@fragment
fn frag_main(@location(0) v_color : vec4<f32>) -> @location(0) vec4<f32> {
fn frag_main(@location(0) v_color : vec4f) -> @location(0) vec4f {
return v_color;
}
10 changes: 5 additions & 5 deletions sample/animometer/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions sample/bitonicSort/bitonicCompute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ fn local_compare_and_swap(idx_before: u32, idx_after: u32) {
}
// invoke_id goes from 0 to workgroupSize
fn get_flip_indices(invoke_id: u32, block_height: u32) -> vec2<u32> {
fn get_flip_indices(invoke_id: u32, block_height: u32) -> vec2u {
// Caculate index offset (i.e move indices into correct block)
let block_offset: u32 = ((2 * invoke_id) / block_height) * block_height;
let half_height = block_height / 2;
// Calculate index spacing
var idx: vec2<u32> = vec2<u32>(
var idx: vec2u = vec2u(
invoke_id % half_height, block_height - (invoke_id % half_height) - 1,
);
idx.x += block_offset;
idx.y += block_offset;
return idx;
}
fn get_disperse_indices(invoke_id: u32, block_height: u32) -> vec2<u32> {
fn get_disperse_indices(invoke_id: u32, block_height: u32) -> vec2u {
var block_offset: u32 = ((2 * invoke_id) / block_height) * block_height;
let half_height = block_height / 2;
var idx: vec2<u32> = vec2<u32>(
var idx: vec2u = vec2u(
invoke_id % half_height, (invoke_id % half_height) + half_height
);
idx.x += block_offset;
Expand All @@ -76,9 +76,9 @@ const ALGO_GLOBAL_FLIP = 3;
// Our compute shader will execute specified # of invocations or elements / 2 invocations
@compute @workgroup_size(${workgroupSize}, 1, 1)
fn computeMain(
@builtin(global_invocation_id) global_id: vec3<u32>,
@builtin(local_invocation_id) local_id: vec3<u32>,
@builtin(workgroup_id) workgroup_id: vec3<u32>,
@builtin(global_invocation_id) global_id: vec3u,
@builtin(local_invocation_id) local_id: vec3u,
@builtin(workgroup_id) workgroup_id: vec3u,
) {
let offset = ${workgroupSize} * 2 * workgroup_id.x;
Expand Down
Loading

0 comments on commit f07ca31

Please sign in to comment.