Skip to content

Commit

Permalink
2.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
quinton-ashley committed Oct 19, 2024
1 parent 5e89618 commit 85bf3cd
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "q5",
"version": "2.7.1",
"version": "2.7.2",
"description": "A sequel to p5.js that's optimized for interactive art",
"author": "quinton-ashley",
"contributors": [
Expand Down
18 changes: 10 additions & 8 deletions q5.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@ function Q5(scope, parent, renderer) {
$.preload = t.preload;
$.setup = t.setup;
$.draw = t.draw;
} else {
$.preload ??= () => {};
$.setup ??= () => {};
$.draw ??= () => {};
}
$.preload ??= () => {};
$.setup ??= () => {};
$.draw ??= () => {};

let userFns = [
'mouseMoved',
'mousePressed',
Expand Down Expand Up @@ -261,7 +261,7 @@ function Q5(scope, parent, renderer) {
}
}

if (preloadDefined || (arguments.length && scope != 'instance' && renderer != 'webgpu')) {
if (preloadDefined || $._isGlobal) {
_preStart();
} else {
setTimeout(_preStart, 32);
Expand Down Expand Up @@ -4152,7 +4152,8 @@ fn fragmentMain(@location(0) texCoord: vec2f) -> @location(0) vec4f {
entryPoint: 'fragmentMain',
targets: [{ format: 'bgra8unorm', blend: $.blendConfigs.normal }]
},
primitive: { topology: 'triangle-list' }
primitive: { topology: 'triangle-list' },
multisample: { count: 4 }
};

$._pipelines[1] = Q5.device.createRenderPipeline($._pipelineConfigs[1]);
Expand Down Expand Up @@ -4261,7 +4262,7 @@ fn fragmentMain(@location(0) texCoord: vec2f) -> @location(0) vec4f {
mappedAtCreation: true
});

new Float32Array(vertexBuffer.getMappedRange()).set(vertices);
new Float32Array(vertexBuffer.getMappedRange()).set(vertexStack);
vertexBuffer.unmap();

$.pass.setVertexBuffer(1, vertexBuffer);
Expand Down Expand Up @@ -4430,7 +4431,8 @@ fn fragmentMain(input : VertexOutput) -> @location(0) vec4f {
entryPoint: 'fragmentMain',
targets: [{ format: 'bgra8unorm', blend: $.blendConfigs.normal }]
},
primitive: { topology: 'triangle-strip', stripIndexFormat: 'uint32' }
primitive: { topology: 'triangle-strip', stripIndexFormat: 'uint32' },
multisample: { count: 4 }
};
$._pipelines[2] = Q5.device.createRenderPipeline($._pipelineConfigs[2]);

Expand Down
2 changes: 1 addition & 1 deletion q5.min.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/q5-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@ function Q5(scope, parent, renderer) {
$.preload = t.preload;
$.setup = t.setup;
$.draw = t.draw;
} else {
$.preload ??= () => {};
$.setup ??= () => {};
$.draw ??= () => {};
}
$.preload ??= () => {};
$.setup ??= () => {};
$.draw ??= () => {};

let userFns = [
'mouseMoved',
'mousePressed',
Expand Down Expand Up @@ -261,7 +261,7 @@ function Q5(scope, parent, renderer) {
}
}

if (preloadDefined || (arguments.length && scope != 'instance' && renderer != 'webgpu')) {
if (preloadDefined || $._isGlobal) {
_preStart();
} else {
setTimeout(_preStart, 32);
Expand Down
5 changes: 3 additions & 2 deletions src/q5-webgpu-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ fn fragmentMain(@location(0) texCoord: vec2f) -> @location(0) vec4f {
entryPoint: 'fragmentMain',
targets: [{ format: 'bgra8unorm', blend: $.blendConfigs.normal }]
},
primitive: { topology: 'triangle-list' }
primitive: { topology: 'triangle-list' },
multisample: { count: 4 }
};

$._pipelines[1] = Q5.device.createRenderPipeline($._pipelineConfigs[1]);
Expand Down Expand Up @@ -198,7 +199,7 @@ fn fragmentMain(@location(0) texCoord: vec2f) -> @location(0) vec4f {
mappedAtCreation: true
});

new Float32Array(vertexBuffer.getMappedRange()).set(vertices);
new Float32Array(vertexBuffer.getMappedRange()).set(vertexStack);
vertexBuffer.unmap();

$.pass.setVertexBuffer(1, vertexBuffer);
Expand Down
3 changes: 2 additions & 1 deletion src/q5-webgpu-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ fn fragmentMain(input : VertexOutput) -> @location(0) vec4f {
entryPoint: 'fragmentMain',
targets: [{ format: 'bgra8unorm', blend: $.blendConfigs.normal }]
},
primitive: { topology: 'triangle-strip', stripIndexFormat: 'uint32' }
primitive: { topology: 'triangle-strip', stripIndexFormat: 'uint32' },
multisample: { count: 4 }
};
$._pipelines[2] = Q5.device.createRenderPipeline($._pipelineConfigs[2]);

Expand Down

0 comments on commit 85bf3cd

Please sign in to comment.