From 18f82fe21fc2fb52c9be9d18934d31ff97a3dfa3 Mon Sep 17 00:00:00 2001 From: Lukas Herzberger Date: Thu, 20 Jun 2024 16:49:46 +0200 Subject: [PATCH] fix handling of max array layers per pass, fixes #5 --- CHANGELOG.md | 6 ++++++ dist/index.js | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/index.ts | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da99d53..5801212 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## [Unreleased] +## [v2.0.1] - 2024-06-20 + +### Fixed + + - Fix handling of cases where a texture's number of array layers exceeds the maximum number of array layers per pass. + ## [v2.0.0] - 2024-04-25 ### Added diff --git a/dist/index.js b/dist/index.js index b9a87cf..c799218 100644 --- a/dist/index.js +++ b/dist/index.js @@ -817,7 +817,7 @@ class DevicePipelines { return undefined; } const passes = []; - for (let baseArrayLayer = 0; baseArrayLayer < this.maxArrayLayers - 1; baseArrayLayer += this.maxArrayLayers) { + for (let baseArrayLayer = 0; baseArrayLayer < target.depthOrArrayLayers; baseArrayLayer += this.maxArrayLayers) { const numArrayLayersThisPass = Math.min(target.depthOrArrayLayers - baseArrayLayer, this.maxArrayLayers); for (let baseMip = 0; baseMip < numMipsTotal - 1; baseMip += this.maxMipsPerPass) { const numMipsThisPass = Math.min(numMipsTotal - 1 - baseMip, this.maxMipsPerPass); diff --git a/package-lock.json b/package-lock.json index ef70146..42714f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "webgpu-spd", - "version": "2.0.0", + "version": "2.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "webgpu-spd", - "version": "2.0.0", + "version": "2.0.1", "license": "MIT", "devDependencies": { "@webgpu/types": "^0.1.40", diff --git a/package.json b/package.json index d597bc9..91aed64 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webgpu-spd", - "version": "2.0.0", + "version": "2.0.1", "description": "A port of AMD's Single Pass Downsampler for WebGPU", "type": "module", "main": "dist/index.js", diff --git a/src/index.ts b/src/index.ts index 98ebc8f..0c388a3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -938,7 +938,7 @@ class DevicePipelines { } const passes = []; - for (let baseArrayLayer = 0; baseArrayLayer < this.maxArrayLayers - 1; baseArrayLayer += this.maxArrayLayers) { + for (let baseArrayLayer = 0; baseArrayLayer < target.depthOrArrayLayers; baseArrayLayer += this.maxArrayLayers) { const numArrayLayersThisPass = Math.min(target.depthOrArrayLayers - baseArrayLayer, this.maxArrayLayers); for (let baseMip = 0; baseMip < numMipsTotal - 1; baseMip += this.maxMipsPerPass) { const numMipsThisPass = Math.min(numMipsTotal - 1 - baseMip, this.maxMipsPerPass);