Skip to content

feat: A way of allowing textureLoad() in vertex shader without manual binding #2288

@lorents

Description

@lorents

While i can do the following to be able to do a textureLoad in the vertex shader:

const heightTexture = root["~unstable"].createTexture({
	size: [GRID_W, GRID_H],
	format: "r32float"
}).$usage("sampled"); 

heightTexture.write(heights);

const heightLayout = tgpu.bindGroupLayout({
	heights: {
		texture: d.texture2d(d.f32),
		sampleType: 'unfilterable-float'
	} 
});

const heightGroup = root.createBindGroup(heightLayout, { heights: heightTexture });

...trying to do the same with automatic binding using heightTexture.createView() fails like this:

None of the supported sample types (UnfilterableFloat) of [Texture "heightTexture"] match the expected sample types (Float). 
- While validating entries[0] against { binding: 0, visibility: ShaderStage::(Vertex|Fragment|Compute), texture: {sampleType: TextureSampleType::Float, viewDimension: TextureViewDimension::e2D, multisampled: 0} }. 
- While validating [BindGroupDescriptor ""pipeline - Automatic Bind Group & Layout""] against [BindGroupLayout "pipeline - Automatic Bind Group & Layout"] 
- While calling [Device].CreateBindGroup([BindGroupDescriptor ""pipeline - Automatic Bind Group & Layout""]).

TypeGPU version: 0.10.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions