mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-21 07:19:30 -07:00
Commenting out the tables and adding select to some shaders in place of the original ternary operator.
This commit is contained in:
3
TODO.txt
3
TODO.txt
@@ -9,8 +9,9 @@ WebGPU
|
|||||||
|
|
||||||
gpu-uniforms
|
gpu-uniforms
|
||||||
Is this an adequate name for it? Can't it be useful for non-uniform-related things?
|
Is this an adequate name for it? Can't it be useful for non-uniform-related things?
|
||||||
|
gpu-buffer maybe?
|
||||||
Resolve the remaining to-dos
|
Resolve the remaining to-dos
|
||||||
Try and drive use it for the palette color buffer
|
Try and use it for the palette color buffer
|
||||||
Test it
|
Test it
|
||||||
Demo it to others
|
Demo it to others
|
||||||
Make improvements
|
Make improvements
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export default async (canvas, config) => {
|
|||||||
const canvasContext = canvas.getContext("webgpu");
|
const canvasContext = canvas.getContext("webgpu");
|
||||||
const presentationFormat = canvasContext.getPreferredFormat(adapter);
|
const presentationFormat = canvasContext.getPreferredFormat(adapter);
|
||||||
|
|
||||||
console.table(device.limits);
|
// console.table(device.limits);
|
||||||
|
|
||||||
const canvasConfig = {
|
const canvasConfig = {
|
||||||
device,
|
device,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const makeConfigBuffer = (device, configUniforms, config, density, gridSize) =>
|
|||||||
slantScale: 1 / (Math.abs(Math.sin(2 * config.slant)) * (Math.sqrt(2) - 1) + 1),
|
slantScale: 1 / (Math.abs(Math.sin(2 * config.slant)) * (Math.sqrt(2) - 1) + 1),
|
||||||
slantVec: [Math.cos(config.slant), Math.sin(config.slant)],
|
slantVec: [Math.cos(config.slant), Math.sin(config.slant)],
|
||||||
};
|
};
|
||||||
console.table(configData);
|
// console.table(configData);
|
||||||
|
|
||||||
return makeUniformBuffer(device, configUniforms, configData);
|
return makeUniformBuffer(device, configUniforms, configData);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -225,11 +225,7 @@ fn computeResult (isFirstFrame : bool, previousResult : vec4<f32>, glyphPos : ve
|
|||||||
var previousCycle = previousResult.g;
|
var previousCycle = previousResult.g;
|
||||||
var resetGlyph = isFirstFrame; // || previousBrightness <= 0.0; // TODO: loop
|
var resetGlyph = isFirstFrame; // || previousBrightness <= 0.0; // TODO: loop
|
||||||
if (resetGlyph) {
|
if (resetGlyph) {
|
||||||
if (bool(config.showComputationTexture)) {
|
previousCycle = select(randomFloat(screenPos), 0.0, bool(config.showComputationTexture));
|
||||||
previousCycle = 0.0;
|
|
||||||
} else {
|
|
||||||
previousCycle = randomFloat(screenPos);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
var localCycleSpeed = getCycleSpeed(rainTime, brightness);
|
var localCycleSpeed = getCycleSpeed(rainTime, brightness);
|
||||||
var cycle = previousCycle;
|
var cycle = previousCycle;
|
||||||
@@ -291,10 +287,7 @@ fn computeResult (isFirstFrame : bool, previousResult : vec4<f32>, glyphPos : ve
|
|||||||
|
|
||||||
var volumetric = bool(config.volumetric);
|
var volumetric = bool(config.volumetric);
|
||||||
|
|
||||||
var quadGridSize = vec2<f32>(1.0);
|
var quadGridSize = select(vec2<f32>(1.0), config.gridSize, volumetric);
|
||||||
if (volumetric) {
|
|
||||||
quadGridSize = config.gridSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert the vertex index into its quad's position and its corner in its quad
|
// Convert the vertex index into its quad's position and its corner in its quad
|
||||||
var i = i32(input.index);
|
var i = i32(input.index);
|
||||||
|
|||||||
Reference in New Issue
Block a user