Skip to content

Unused bindings throw error #4577

@Rus-Abd

Description

@Rus-Abd
   struct Uniforms { resolution: vec2f, time: f32 };
   @binding(0) @group(0) var<uniform> U : Uniforms;
   @binding(1) @group(0) var mySampler: sampler; 
   @binding(2) @group(0) var myTexture: texture_2d<f32>;
    struct out{
	position: vec4f,
	color: vec3f
    }
	
	 @fragment
	fn main(@builtin(position) fragCoord : vec4f,
					@location(0) color: vec3f) -> @location(0) vec4<f32>
	{
		var uv = fragCoord.xy/U.resolution ;//* 2. -1.;
		//uv*= vec2f(1, -1);
		var col:vec4f =  textureSample(myTexture,mySampler,uv);
		return vec4<f32>(color,1.); 
	}

Everything works fine until I comment this line

var col:vec4f =  textureSample(myTexture,mySampler,uv);

I receive this error

Number of entries (3) did not match the number of entries (1) specified in [BindGroupLayout].
Expected layout: [{ binding: 0, visibility: ShaderStage::(Vertex|Fragment), buffer: { type: BufferBindingType::Uniform, hasDynamicOffset: 0, minBindingSize: 16 } }]
 - While validating [BindGroupDescriptor] against [BindGroupLayout]
 - While calling [Device].CreateBindGroup([BindGroupDescriptor]).1

I'm getting an error for not using these bindings, am I forced to use them?

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