fix(renderer): merge IBL into group(3) to stay within max_bind_groups limit of 4
wgpu's default max_bind_groups is 4 (groups 0-3), but the PBR shader was using group(4) for BRDF LUT bindings. This merges IBL bindings into the shadow bind group (group 3) at binding slots 3-4, removes the standalone IBL bind group layout/creation, and updates all examples accordingly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -40,7 +40,6 @@ struct AppState {
|
||||
shadow_bind_group: wgpu::BindGroup,
|
||||
_shadow_map: ShadowMap,
|
||||
_ibl: IblResources,
|
||||
ibl_bind_group: wgpu::BindGroup,
|
||||
input: InputState,
|
||||
timer: GameTimer,
|
||||
cam_aligned_size: u32,
|
||||
@@ -190,8 +189,6 @@ impl ApplicationHandler for MultiLightApp {
|
||||
|
||||
// IBL resources
|
||||
let ibl = IblResources::new(&gpu.device, &gpu.queue);
|
||||
let ibl_layout = IblResources::bind_group_layout(&gpu.device);
|
||||
let ibl_bind_group = ibl.create_bind_group(&gpu.device, &ibl_layout);
|
||||
|
||||
// Material bind group
|
||||
let material_bind_group = gpu.device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
@@ -227,6 +224,8 @@ impl ApplicationHandler for MultiLightApp {
|
||||
&gpu.device,
|
||||
&shadow_layout,
|
||||
&shadow_uniform_buffer,
|
||||
&ibl.brdf_lut_view,
|
||||
&ibl.brdf_lut_sampler,
|
||||
);
|
||||
|
||||
// PBR pipeline
|
||||
@@ -237,7 +236,6 @@ impl ApplicationHandler for MultiLightApp {
|
||||
&pbr_tex_layout,
|
||||
&mat_layout,
|
||||
&shadow_layout,
|
||||
&ibl_layout,
|
||||
);
|
||||
|
||||
self.state = Some(AppState {
|
||||
@@ -259,7 +257,6 @@ impl ApplicationHandler for MultiLightApp {
|
||||
shadow_bind_group,
|
||||
_shadow_map: shadow_map,
|
||||
_ibl: ibl,
|
||||
ibl_bind_group,
|
||||
input: InputState::new(),
|
||||
timer: GameTimer::new(60),
|
||||
cam_aligned_size,
|
||||
@@ -545,7 +542,6 @@ impl ApplicationHandler for MultiLightApp {
|
||||
render_pass.set_pipeline(&state.pipeline);
|
||||
render_pass.set_bind_group(1, &state.pbr_texture_bind_group, &[]);
|
||||
render_pass.set_bind_group(3, &state.shadow_bind_group, &[]);
|
||||
render_pass.set_bind_group(4, &state.ibl_bind_group, &[]);
|
||||
|
||||
// Draw 5 spheres (objects 0..4)
|
||||
render_pass.set_vertex_buffer(0, state.sphere_mesh.vertex_buffer.slice(..));
|
||||
|
||||
Reference in New Issue
Block a user