Skip to content

Commit

Permalink
Stop only clearing the first view in WebGPU samples.
Browse files Browse the repository at this point in the history
  • Loading branch information
toji committed Oct 10, 2024
1 parent 42a42f2 commit 2666b21
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions webgpu/ar-barebones.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
fn vertexMain(@builtin(vertex_index) vert_index: u32,
@builtin(instance_index) view_index: u32) -> VertexOut {
var pos = array<vec4f, 3>(
vec4f(0.0, 0.5, -1, 1),
vec4f(-0.5, -0.5, -1, 1),
vec4f(0.5, -0.5, -1, 1)
vec4f(0.0, 0.25, -0.5, 1),
vec4f(-0.25, -0.25, -0.5, 1),
vec4f(0.25, -0.25, -0.5, 1)
);
var color = array<vec4f, 3>(
Expand Down Expand Up @@ -361,7 +361,7 @@
colorAttachments: [{
view: subImage.colorTexture.createView(subImage.getViewDescriptor()),
// Clear the color texture to a solid color.
loadOp: viewIndex == 0 ? 'clear' : 'load',
loadOp: 'clear',
storeOp: 'store',
// Clear the canvas to transparent black so the user's environment
// shows through.
Expand Down
8 changes: 4 additions & 4 deletions webgpu/vr-barebones.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
fn vertexMain(@builtin(vertex_index) vert_index: u32,
@builtin(instance_index) view_index: u32) -> VertexOut {
var pos = array<vec4f, 3>(
vec4f(0.0, 0.5, -1, 1),
vec4f(-0.5, -0.5, -1, 1),
vec4f(0.5, -0.5, -1, 1)
vec4f(0.0, 0.25, -0.5, 1),
vec4f(-0.25, -0.25, -0.5, 1),
vec4f(0.25, -0.25, -0.5, 1)
);
var color = array<vec4f, 3>(
Expand Down Expand Up @@ -361,7 +361,7 @@
colorAttachments: [{
view: subImage.colorTexture.createView(subImage.getViewDescriptor()),
// Clear the color texture to a solid color.
loadOp: viewIndex == 0 ? 'clear' : 'load',
loadOp: 'clear',
storeOp: 'store',
// Clear to a non-black color so we can see if it's working
// even when the triangle isn't in view.
Expand Down

0 comments on commit 2666b21

Please sign in to comment.