mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-17 05:49:30 -07:00
Fixed some major bugs: the WebGPU cache should store loaded images and text, never GPU resource handles; renamed renderer "formulate" to "configure"; WebGPU renderer's configure function needs early returns after each major await, in case there's a new config; the render loops are now locally stored closures; renderers now have start and stop functions; fixed bugs in the REGL and WebGPU mirror passes; WebGPU bloom pass now enforces texture dimensions are greater than zero; the react component now stores the renderer type in a useRef and returns early from renderer init awaits to prevent multiple renderers from instantiating.
This commit is contained in:
@@ -26,7 +26,7 @@ const makePyramid = (device, size, pyramidHeight) =>
|
||||
.map((_, index) =>
|
||||
makeComputeTarget(
|
||||
device,
|
||||
size.map((x) => Math.floor(x * 2 ** -index)),
|
||||
size.map((x) => Math.max(1, Math.floor(x * 2 ** -index))),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -111,7 +111,7 @@ export default ({ config, device, cache }) => {
|
||||
|
||||
const build = (screenSize, inputs) => {
|
||||
// Since the bloom is blurry, we downscale everything
|
||||
scaledScreenSize = screenSize.map((x) => Math.floor(x * bloomSize));
|
||||
scaledScreenSize = screenSize.map((x) => Math.max(1, Math.floor(x * bloomSize)));
|
||||
|
||||
destroyPyramid(hBlurPyramid);
|
||||
hBlurPyramid = makePyramid(device, scaledScreenSize, pyramidHeight);
|
||||
@@ -169,8 +169,8 @@ export default ({ config, device, cache }) => {
|
||||
computePass.setPipeline(blurPipeline);
|
||||
for (let i = 0; i < pyramidHeight; i++) {
|
||||
const dispatchSize = [
|
||||
Math.ceil(Math.floor(scaledScreenSize[0] * 2 ** -i) / 32),
|
||||
Math.floor(Math.floor(scaledScreenSize[1] * 2 ** -i)),
|
||||
Math.max(1, Math.ceil(Math.floor(scaledScreenSize[0] * 2 ** -i) / 32)),
|
||||
Math.max(1, Math.floor(Math.floor(scaledScreenSize[1] * 2 ** -i))),
|
||||
1,
|
||||
];
|
||||
computePass.setBindGroup(0, hBlurBindGroups[i]);
|
||||
|
||||
Reference in New Issue
Block a user