Skip to content

Commit 30777b4

Browse files
authored
Merge pull request #244 from Absulit/dev
v0.6.1
2 parents eaa0be3 + cd078d5 commit 30777b4

8 files changed

Lines changed: 40 additions & 52 deletions

File tree

apidocs/Points.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ <h4 class="name" id="canvas"><span class="attributes"></span>canvas<span class="
146146
<dl class="details">
147147
<dt class="tag-source">Source:</dt>
148148
<dd class="tag-source">
149-
<a href="points.js.html">points.js</a>, <a href="points.js.html#line2611">line 2611</a>
149+
<a href="points.js.html">points.js</a>, <a href="points.js.html#line2614">line 2614</a>
150150
</dd>
151151
</dl>
152152

@@ -169,7 +169,7 @@ <h4 class="name" id="device"><span class="attributes"></span>device<span class="
169169
<dl class="details">
170170
<dt class="tag-source">Source:</dt>
171171
<dd class="tag-source">
172-
<a href="points.js.html">points.js</a>, <a href="points.js.html#line2618">line 2618</a>
172+
<a href="points.js.html">points.js</a>, <a href="points.js.html#line2621">line 2621</a>
173173
</dd>
174174
</dl>
175175

@@ -197,7 +197,7 @@ <h4 class="name" id="fitWindow"><span class="attributes"></span>fitWindow<span c
197197
<dl class="details">
198198
<dt class="tag-source">Source:</dt>
199199
<dd class="tag-source">
200-
<a href="points.js.html">points.js</a>, <a href="points.js.html#line2665">line 2665</a>
200+
<a href="points.js.html">points.js</a>, <a href="points.js.html#line2668">line 2668</a>
201201
</dd>
202202
</dl>
203203

@@ -231,7 +231,7 @@ <h4 class="name" id="fullscreen"><span class="attributes"></span>fullscreen<span
231231
<dl class="details">
232232
<dt class="tag-source">Source:</dt>
233233
<dd class="tag-source">
234-
<a href="points.js.html">points.js</a>, <a href="points.js.html#line2638">line 2638</a>
234+
<a href="points.js.html">points.js</a>, <a href="points.js.html#line2641">line 2641</a>
235235
</dd>
236236
</dl>
237237

@@ -271,7 +271,7 @@ <h4 class="name" id="presentationFormat"><span class="attributes"></span>present
271271
<dl class="details">
272272
<dt class="tag-source">Source:</dt>
273273
<dd class="tag-source">
274-
<a href="points.js.html">points.js</a>, <a href="points.js.html#line2693">line 2693</a>
274+
<a href="points.js.html">points.js</a>, <a href="points.js.html#line2696">line 2696</a>
275275
</dd>
276276
</dl>
277277

@@ -4445,7 +4445,7 @@ <h5>Parameters:</h5>
44454445
Documentation generated by <a rel="external" href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a><wbr>
44464446
using <a rel="external" href="https://github.com/amekusa/docolatte">Docolatte</a> theme
44474447

4448-
<wbr>on <time datetime="2025-12-18T16:00:39.311Z">Thu, 18 Dec 2025 16:00:39 GMT</time>
4448+
<wbr>on <time datetime="2026-01-05T16:20:45.950Z">Mon, 05 Jan 2026 16:20:45 GMT</time>
44494449

44504450
</p>
44514451

apidocs/points.js.html

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,18 +2467,21 @@ <h1 class="page-title">
24672467
const swapChainTexture = this.#context.getCurrentTexture();
24682468

24692469
this.#renderPasses.forEach(renderPass => {
2470+
2471+
const isSameDevice = this.#device === renderPass.device;
2472+
2473+
// texturesExternal means there's a video
2474+
// if there's a video it needs to be updated no matter what.
2475+
// Also, it needs to be updated if the screen size changes
2476+
const updateBundle = !isSameDevice || !renderPass.bundle || this.#texturesExternal.length || this.#screenResized || this.#textureUpdated;
2477+
24702478
if (renderPass.hasVertexAndFragmentShader) {
24712479
renderPass.descriptor.colorAttachments[0].view = swapChainTexture.createView();
24722480
if (renderPass.depthWriteEnabled &amp;&amp; (!renderPass.descriptor.depthStencilAttachment.view || this.#screenResized)) {
24732481
renderPass.descriptor.depthStencilAttachment.view = renderPass.textureDepth.createView();
24742482
}
24752483

2476-
const isSameDevice = this.#device === renderPass.device;
2477-
2478-
// texturesExternal means there's a video
2479-
// if there's a video it needs to be updated no matter what.
2480-
// Also, it needs to be updated if the screen size changes
2481-
if (!isSameDevice || !renderPass.bundle || this.#texturesExternal.length || this.#screenResized || this.#textureUpdated) {
2484+
if (updateBundle) {
24822485
this.#passBindGroup(renderPass, GPUShaderStage.FRAGMENT);
24832486
this.#passBindGroup(renderPass, GPUShaderStage.VERTEX);
24842487
/** @type {GPURenderBundleEncoderDescriptor} */
@@ -2555,7 +2558,7 @@ <h1 class="page-title">
25552558
this.#texturesToCopy = [];
25562559
}
25572560
if (renderPass.hasComputeShader) {
2558-
if (this.#texturesExternal.length || !renderPass.computeBindGroup) {
2561+
if (updateBundle) {
25592562
this.#passBindGroup(renderPass, GPUShaderStage.COMPUTE);
25602563
}
25612564

@@ -2774,7 +2777,7 @@ <h1 class="page-title">
27742777
Documentation generated by <a rel="external" href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a><wbr>
27752778
using <a rel="external" href="https://github.com/amekusa/docolatte">Docolatte</a> theme
27762779

2777-
<wbr>on <time datetime="2025-12-18T16:00:39.107Z">Thu, 18 Dec 2025 16:00:39 GMT</time>
2780+
<wbr>on <time datetime="2026-01-05T16:20:45.850Z">Mon, 05 Jan 2026 16:20:45 GMT</time>
27782781

27792782
</p>
27802783

build/points.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5872,18 +5872,21 @@ class Points {
58725872
const swapChainTexture = this.#context.getCurrentTexture();
58735873

58745874
this.#renderPasses.forEach(renderPass => {
5875+
5876+
const isSameDevice = this.#device === renderPass.device;
5877+
5878+
// texturesExternal means there's a video
5879+
// if there's a video it needs to be updated no matter what.
5880+
// Also, it needs to be updated if the screen size changes
5881+
const updateBundle = !isSameDevice || !renderPass.bundle || this.#texturesExternal.length || this.#screenResized || this.#textureUpdated;
5882+
58755883
if (renderPass.hasVertexAndFragmentShader) {
58765884
renderPass.descriptor.colorAttachments[0].view = swapChainTexture.createView();
58775885
if (renderPass.depthWriteEnabled && (!renderPass.descriptor.depthStencilAttachment.view || this.#screenResized)) {
58785886
renderPass.descriptor.depthStencilAttachment.view = renderPass.textureDepth.createView();
58795887
}
58805888

5881-
const isSameDevice = this.#device === renderPass.device;
5882-
5883-
// texturesExternal means there's a video
5884-
// if there's a video it needs to be updated no matter what.
5885-
// Also, it needs to be updated if the screen size changes
5886-
if (!isSameDevice || !renderPass.bundle || this.#texturesExternal.length || this.#screenResized || this.#textureUpdated) {
5889+
if (updateBundle) {
58875890
this.#passBindGroup(renderPass, GPUShaderStage.FRAGMENT);
58885891
this.#passBindGroup(renderPass, GPUShaderStage.VERTEX);
58895892
/** @type {GPURenderBundleEncoderDescriptor} */
@@ -5960,7 +5963,7 @@ class Points {
59605963
this.#texturesToCopy = [];
59615964
}
59625965
if (renderPass.hasComputeShader) {
5963-
if (this.#texturesExternal.length || !renderPass.computeBindGroup) {
5966+
if (updateBundle) {
59645967
this.#passBindGroup(renderPass, GPUShaderStage.COMPUTE);
59655968
}
59665969

build/points.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/particles3/index.js

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,6 @@ const instancedParticlesRenderPass = new RenderPass(vert, frag1, compute0, WORKG
4141
instancedParticlesRenderPass.depthWriteEnabled = false;
4242
instancedParticlesRenderPass.addPlane('plane', { x: 0, y: 0 }, { width: 2, height: 2 }).instanceCount = NUMPARTICLES;
4343

44-
// const aspect = canvas.width / canvas.height; // alternative to aspect in shader
45-
const left = -1;
46-
const right = 1;
47-
const bottom = -1;
48-
const top = 1;
49-
const near = -1; // include z = 0
50-
const far = 1;
51-
52-
const lr = 1 / (right - left);
53-
const bt = 1 / (top - bottom);
54-
const nf = 1 / (near - far);
55-
56-
const orthoMatrix = [
57-
2 * lr, 0, 0, 0,
58-
0, 2 * bt, 0, 0,
59-
0, 0, 2 * nf, 0,
60-
-(right + left) * lr,
61-
-(top + bottom) * bt,
62-
(far + near) * nf,
63-
1
64-
];
6544

6645
const base = {
6746
renderPasses: [

jsr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://jsr.io/schema/config-file.v1.json",
33
"name": "@absulit/points",
4-
"version": "0.6.0",
4+
"version": "0.6.1",
55
"description": "A Generative Art library made in WebGPU",
66
"license": "MIT",
77
"exports": {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@absulit/points",
3-
"version": "0.6.0",
3+
"version": "0.6.1",
44
"type": "module",
55
"publishConfig": {
66
"access": "public"

src/points.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2424,18 +2424,21 @@ class Points {
24242424
const swapChainTexture = this.#context.getCurrentTexture();
24252425

24262426
this.#renderPasses.forEach(renderPass => {
2427+
2428+
const isSameDevice = this.#device === renderPass.device;
2429+
2430+
// texturesExternal means there's a video
2431+
// if there's a video it needs to be updated no matter what.
2432+
// Also, it needs to be updated if the screen size changes
2433+
const updateBundle = !isSameDevice || !renderPass.bundle || this.#texturesExternal.length || this.#screenResized || this.#textureUpdated;
2434+
24272435
if (renderPass.hasVertexAndFragmentShader) {
24282436
renderPass.descriptor.colorAttachments[0].view = swapChainTexture.createView();
24292437
if (renderPass.depthWriteEnabled && (!renderPass.descriptor.depthStencilAttachment.view || this.#screenResized)) {
24302438
renderPass.descriptor.depthStencilAttachment.view = renderPass.textureDepth.createView();
24312439
}
24322440

2433-
const isSameDevice = this.#device === renderPass.device;
2434-
2435-
// texturesExternal means there's a video
2436-
// if there's a video it needs to be updated no matter what.
2437-
// Also, it needs to be updated if the screen size changes
2438-
if (!isSameDevice || !renderPass.bundle || this.#texturesExternal.length || this.#screenResized || this.#textureUpdated) {
2441+
if (updateBundle) {
24392442
this.#passBindGroup(renderPass, GPUShaderStage.FRAGMENT);
24402443
this.#passBindGroup(renderPass, GPUShaderStage.VERTEX);
24412444
/** @type {GPURenderBundleEncoderDescriptor} */
@@ -2512,7 +2515,7 @@ class Points {
25122515
this.#texturesToCopy = [];
25132516
}
25142517
if (renderPass.hasComputeShader) {
2515-
if (this.#texturesExternal.length || !renderPass.computeBindGroup) {
2518+
if (updateBundle) {
25162519
this.#passBindGroup(renderPass, GPUShaderStage.COMPUTE);
25172520
}
25182521

0 commit comments

Comments
 (0)