Skip to content

Is ping-pong actually necessary when downsampling? #6

@mreinstein

Description

@mreinstein

looking at this code in bloom.rs:

        // Downsample bind groups
	for i in 1..BLOOM_MIP_COUNT {
		// Ping
		bloom_mat.bind_group.push(create_bloom_bind_group(
			renderer,
			bloom_mat,
			&bloom_mat.bind_groups_textures[1].mip_view[i],
			&bloom_mat.bind_groups_textures[0].view,
			&renderer.hdr_texture.view,
			renderer.hdr_texture.sampler.as_ref().unwrap(),
			&bloom_mat.bind_groups_buffers[0],
		));

		// Pong
		bloom_mat.bind_group.push(create_bloom_bind_group(
			renderer,
			bloom_mat,
			&bloom_mat.bind_groups_textures[0].mip_view[i],
			&bloom_mat.bind_groups_textures[1].view,
			&renderer.hdr_texture.view,
			renderer.hdr_texture.sampler.as_ref().unwrap(),
			&bloom_mat.bind_groups_buffers[0],
		));
	}

Why not just construct all downsampled mip levels in a single texture:

        // Downsample bind groups
	for i in 1..BLOOM_MIP_COUNT {
		bloom_mat.bind_group.push(create_bloom_bind_group(
			renderer,
			bloom_mat,
			&bloom_mat.bind_groups_textures[0].mip_view[i],
			&bloom_mat.bind_groups_textures[0].mip_view[i-1],
			&renderer.hdr_texture.view,
			renderer.hdr_texture.sampler.as_ref().unwrap(),
			&bloom_mat.bind_groups_buffers[0],
		));
	}

Wouldn't this achieve the same result, but with a lot less compute passes?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions