Skip to content

Commit

Permalink
Merge branch 'main' into normal_map_branch
Browse files Browse the repository at this point in the history
  • Loading branch information
cmhhelgeson authored Oct 27, 2023
2 parents 8d98133 + 7349a25 commit cafd907
Show file tree
Hide file tree
Showing 33 changed files with 36 additions and 36 deletions.
Binary file added public/img/brickwall_diffuse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/brickwall_height.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/brickwall_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/spiral_height.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/spiral_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/toybox_height.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/toybox_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/wood_diffuse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/sample/a-buffer/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => {
};

const configure = () => {
let devicePixelRatio = window.devicePixelRatio || 1;
let devicePixelRatio = window.devicePixelRatio;

// The default maximum storage buffer binding size is 128Mib. The amount
// of memory we need to store transparent fragments depends on the size
Expand Down
4 changes: 2 additions & 2 deletions src/sample/animometer/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => {

const context = canvas.getContext('webgpu') as GPUCanvasContext;

const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down Expand Up @@ -283,7 +283,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => {
const renderPassDescriptor = {
colorAttachments: [
{
view: undefined as any, // Assigned later
view: undefined as GPUTextureView, // Assigned later
clearValue: { r: 0.0, g: 0.0, b: 0.0, a: 1.0 },
loadOp: 'clear' as const,
storeOp: 'store' as const,
Expand Down
20 changes: 10 additions & 10 deletions src/sample/bitonicSort/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ export const createBindGroupDescriptor = (
): BindGroupsObjectsAndLayout => {
const layoutEntries: GPUBindGroupLayoutEntry[] = [];
for (let i = 0; i < bindings.length; i++) {
const layoutEntry: any = {};
layoutEntry.binding = bindings[i];
layoutEntry.visibility = visibilities[i % visibilities.length];
layoutEntry[resourceTypes[i]] = resourceLayouts[i];
layoutEntries.push(layoutEntry);
layoutEntries.push({
binding: bindings[i],
visibility: visibilities[i % visibilities.length],
[resourceTypes[i]]: resourceLayouts[i],
});
}

const bindGroupLayout = device.createBindGroupLayout({
Expand All @@ -58,10 +58,10 @@ export const createBindGroupDescriptor = (
for (let i = 0; i < resources.length; i++) {
const groupEntries: GPUBindGroupEntry[] = [];
for (let j = 0; j < resources[0].length; j++) {
const groupEntry: any = {};
groupEntry.binding = j;
groupEntry.resource = resources[i][j];
groupEntries.push(groupEntry);
groupEntries.push({
binding: j,
resource: resources[i][j],
});
}
const newBindGroup = device.createBindGroup({
label: `${label}.bindGroup${i}`,
Expand Down Expand Up @@ -112,7 +112,7 @@ export const SampleInitFactoryWebGPU = async (
const device = await adapter.requestDevice();
if (!pageState.active) return;
const context = canvas.getContext('webgpu') as GPUCanvasContext;
const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/cameras/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => {
const device = await adapter.requestDevice();
const context = canvas.getContext('webgpu') as GPUCanvasContext;

const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down
4 changes: 2 additions & 2 deletions src/sample/computeBoids/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => {

if (!pageState.active) return;
const context = canvas.getContext('webgpu') as GPUCanvasContext;
const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down Expand Up @@ -89,7 +89,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => {
const renderPassDescriptor = {
colorAttachments: [
{
view: undefined as any, // Assigned later
view: undefined as GPUTextureView, // Assigned later
clearValue: { r: 0.0, g: 0.0, b: 0.0, a: 1.0 },
loadOp: 'clear' as const,
storeOp: 'store' as const,
Expand Down
2 changes: 1 addition & 1 deletion src/sample/cornell/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => {
gui.add(params, 'renderer', ['rasterizer', 'raytracer']);
gui.add(params, 'rotateCamera', true);

const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;

Expand Down
2 changes: 1 addition & 1 deletion src/sample/cubemap/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const init: SampleInit = async ({ canvas, pageState }) => {
if (!pageState.active) return;
const context = canvas.getContext('webgpu') as GPUCanvasContext;

const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/deferredRendering/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => {
if (!pageState.active) return;
const context = canvas.getContext('webgpu') as GPUCanvasContext;

const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const aspect = canvas.width / canvas.height;
Expand Down
2 changes: 1 addition & 1 deletion src/sample/fractalCube/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const init: SampleInit = async ({ canvas, pageState }) => {
if (!pageState.active) return;
const context = canvas.getContext('webgpu') as GPUCanvasContext;

const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/gameOfLife/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => {
const device = await adapter.requestDevice();
if (!pageState.active) return;
const context = canvas.getContext('webgpu') as GPUCanvasContext;
const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/helloTriangle/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const init: SampleInit = async ({ canvas, pageState }) => {
if (!pageState.active) return;
const context = canvas.getContext('webgpu') as GPUCanvasContext;

const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/helloTriangleMSAA/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const init: SampleInit = async ({ canvas, pageState }) => {
if (!pageState.active) return;
const context = canvas.getContext('webgpu') as GPUCanvasContext;

const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/imageBlur/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => {
if (!pageState.active) return;
const context = canvas.getContext('webgpu') as GPUCanvasContext;

const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/instancedCube/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const init: SampleInit = async ({ canvas, pageState }) => {
if (!pageState.active) return;
const context = canvas.getContext('webgpu') as GPUCanvasContext;

const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/particles/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => {
if (!pageState.active) return;
const context = canvas.getContext('webgpu') as GPUCanvasContext;

const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/renderBundles/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const init: SampleInit = async ({ canvas, pageState, gui, stats }) => {

const context = canvas.getContext('webgpu') as GPUCanvasContext;

const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/resizeCanvas/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const init: SampleInit = async ({ canvas, pageState }) => {

const presentationFormat = navigator.gpu.getPreferredCanvasFormat();

const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;

Expand Down
2 changes: 1 addition & 1 deletion src/sample/reversedZ/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => {

const context = canvas.getContext('webgpu') as GPUCanvasContext;

const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/rotatingCube/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const init: SampleInit = async ({ canvas, pageState }) => {
if (!pageState.active) return;
const context = canvas.getContext('webgpu') as GPUCanvasContext;

const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/shadowMapping/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const init: SampleInit = async ({ canvas, pageState }) => {

const context = canvas.getContext('webgpu') as GPUCanvasContext;

const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const aspect = canvas.width / canvas.height;
Expand Down
2 changes: 1 addition & 1 deletion src/sample/texturedCube/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const init: SampleInit = async ({ canvas, pageState }) => {
if (!pageState.active) return;
const context = canvas.getContext('webgpu') as GPUCanvasContext;

const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/twoCubes/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const init: SampleInit = async ({ canvas, pageState }) => {
if (!pageState.active) return;
const context = canvas.getContext('webgpu') as GPUCanvasContext;

const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/videoUploading/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => {
if (!pageState.active) return;

const context = canvas.getContext('webgpu') as GPUCanvasContext;
const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/videoUploadingWebCodecs/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => {
if (!pageState.active) return;

const context = canvas.getContext('webgpu') as GPUCanvasContext;
const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
canvas.width = canvas.clientWidth * devicePixelRatio;
canvas.height = canvas.clientHeight * devicePixelRatio;
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
Expand Down
2 changes: 1 addition & 1 deletion src/sample/worker/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const init: SampleInit = async ({ canvas, pageState }) => {
// Anything drawn to the OffscreenCanvas that call returns will automatically be displayed on
// the source canvas on the page.
const offscreenCanvas = canvas.transferControlToOffscreen();
const devicePixelRatio = window.devicePixelRatio || 1;
const devicePixelRatio = window.devicePixelRatio;
offscreenCanvas.width = canvas.clientWidth * devicePixelRatio;
offscreenCanvas.height = canvas.clientHeight * devicePixelRatio;

Expand Down

0 comments on commit cafd907

Please sign in to comment.