Final clean up
Some checks failed
Check & deploy / build (pull_request) Failing after 1m16s

This commit is contained in:
Andras Schmelczer 2026-05-24 10:52:20 +01:00
commit c40c5d97db
74 changed files with 863 additions and 669 deletions

View file

@ -6,7 +6,6 @@ import {
import { setUpFullScreenQuad } from '../../utils/graphics/full-screen-quad';
import { smartCompile } from '../../utils/graphics/smart-compile';
import { rgbChannelToUnit, type RgbColor } from '../../utils/rgb-color';
import { CommonState } from '../common-state/common-state';
import shader from './render.wgsl?raw';
export interface RenderSettings {
@ -30,7 +29,7 @@ export class RenderPipeline {
UNIFORM_COUNT * Float32Array.BYTES_PER_ELEMENT
);
private readonly getBindGroup = createBindGroupCache<GPUTextureView, GPUTextureView>(
private readonly getBindGroup = createBindGroupCache<[GPUTextureView, GPUTextureView]>(
(colorTexture, sourceTexture) =>
this.device.createBindGroup({
layout: this.bindGroupLayout,
@ -45,7 +44,6 @@ export class RenderPipeline {
public constructor(
private readonly context: GPUCanvasContext,
private readonly device: GPUDevice,
private readonly commonState: CommonState,
private readonly canvasFormat: GPUTextureFormat
) {
this.bindGroupLayout = device.createBindGroupLayout({
@ -68,10 +66,10 @@ export class RenderPipeline {
],
});
const shaderModule = smartCompile(device, CommonState.shaderCode, shader);
const shaderModule = smartCompile(device, shader);
const vertex = setUpFullScreenQuad(device);
const pipelineLayout = device.createPipelineLayout({
bindGroupLayouts: [this.commonState.bindGroupLayout, this.bindGroupLayout],
bindGroupLayouts: [this.bindGroupLayout],
});
this.pipeline = this.createPipeline(
pipelineLayout,
@ -207,8 +205,7 @@ export class RenderPipeline {
timestampWrites,
});
passEncoder.setPipeline(this.getPipeline(useSourceTexture));
this.commonState.execute(passEncoder);
passEncoder.setBindGroup(1, this.getBindGroup(colorTexture, sourceTexture));
passEncoder.setBindGroup(0, this.getBindGroup(colorTexture, sourceTexture));
passEncoder.draw(3, 1);
passEncoder.end();
}

View file

@ -20,9 +20,9 @@ const LOW_SATURATION_RESCUE_MAX: f32 = 0.22;
const COLOR_WEIGHT_EPSILON: f32 = 0.0001;
const LUMA_WEIGHTS: vec3<f32> = vec3<f32>(0.2126, 0.7152, 0.0722);
@group(1) @binding(0) var<uniform> settings: Settings;
@group(1) @binding(2) var trailMap: texture_2d<f32>;
@group(1) @binding(3) var sourceMap: texture_2d<f32>;
@group(0) @binding(0) var<uniform> settings: Settings;
@group(0) @binding(2) var trailMap: texture_2d<f32>;
@group(0) @binding(3) var sourceMap: texture_2d<f32>;
@fragment
fn fragment(@builtin(position) position: vec4<f32>) -> @location(0) vec4<f32> {