Skip to content

Commit

Permalink
sokol_gfx.h wgpu: provide correct number of dynamic offset in _sg_wgp…
Browse files Browse the repository at this point in the history
…u_apply_uniforms
  • Loading branch information
floooh committed Oct 1, 2024
1 parent 3ac3097 commit 0b45fbb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sokol_gfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -5734,6 +5734,7 @@ typedef struct {
_sg_wgpu_shader_func_t fragment_func;
WGPUBindGroupLayout bgl_ub;
WGPUBindGroup bg_ub;
size_t bg_ub_num_entries;
WGPUBindGroupLayout bgl_img_smp_sbuf;
uint8_t ub_grp0_bnd_n[SG_MAX_UNIFORMBLOCK_BINDSLOTS];
uint8_t img_grp1_bnd_n[SG_MAX_IMAGE_BINDSLOTS];
Expand Down Expand Up @@ -14786,6 +14787,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_shader(_sg_shader_t* shd, const
bg_desc.layout = shd->wgpu.bgl_ub;
bg_desc.entryCount = bgl_index;
bg_desc.entries = bg_entries;
shd->wgpu.bg_ub_num_entries = bgl_index;
shd->wgpu.bg_ub = wgpuDeviceCreateBindGroup(_sg.wgpu.dev, &bg_desc);
SOKOL_ASSERT(shd->wgpu.bg_ub);

Expand Down Expand Up @@ -14867,7 +14869,7 @@ _SOKOL_PRIVATE sg_resource_state _sg_wgpu_create_pipeline(_sg_pipeline_t* pip, _
pip->wgpu.blend_color.a = (double) desc->blend_color.a;

// - @group(0) for uniform blocks
// - @group(1) for all image and sampler resources
// - @group(1) for all image, sampler and storagebuffer resources
WGPUBindGroupLayout wgpu_bgl[_SG_WGPU_NUM_BINDGROUPS];
_sg_clear(&wgpu_bgl, sizeof(wgpu_bgl));
wgpu_bgl[_SG_WGPU_UB_BINDGROUP_INDEX ] = shd->wgpu.bgl_ub;
Expand Down Expand Up @@ -15286,7 +15288,7 @@ _SOKOL_PRIVATE void _sg_wgpu_apply_uniforms(int ub_bind_slot, const sg_range* da
wgpuRenderPassEncoderSetBindGroup(_sg.wgpu.pass_enc,
_SG_WGPU_UB_BINDGROUP_INDEX,
shd->wgpu.bg_ub,
SG_MAX_UNIFORMBLOCK_BINDSLOTS,
shd->wgpu.bg_ub_num_entries,
_sg.wgpu.uniform.bind_offsets);
}

Expand Down

0 comments on commit 0b45fbb

Please sign in to comment.