+ state.shaders.light.pass.action.colors[0] = sg.ColorAttachmentAction{
+ .load_action = .CLEAR,
+ .store_action = .STORE,
+ .clear_value = .{ .r = 0.0, .g = 0.0, .b = 0.0, .a = 0.0 },
+ };
+
+ // combining pass
+ state.shaders.tex.img = sg.makeImage(.{
+ .usage = .{ .color_attachment = true },
+ .width = state.OffscreenWidth,
+ .height = state.OffscreenHeight,
+ .sample_count = state.OffscreenSampleCount,
+ .pixel_format = .RGBA8,
+ });
+ state.shaders.tex.depth = sg.makeImage(.{
+ .usage = .{ .depth_stencil_attachment = true },
+ .width = state.OffscreenWidth,
+ .height = state.OffscreenHeight,
+ .sample_count = state.OffscreenSampleCount,
+ .pixel_format = .DEPTH,
+ });
+ state.shaders.shadow.img = sg.makeImage(.{
+ .usage = .{ .color_attachment = true },
+ .width = state.OffscreenWidth,
+ .height = state.OffscreenHeight,
+ .sample_count = state.OffscreenSampleCount,
+ .pixel_format = .RGBA8,
+ });
+ state.shaders.shadow.depth = sg.makeImage(.{
+ .usage = .{ .depth_stencil_attachment = true },
+ .width = state.OffscreenWidth,
+ .height = state.OffscreenHeight,
+ .sample_count = state.OffscreenSampleCount,
+ .pixel_format = .DEPTH,
+ });
+ state.shaders.light.img = sg.makeImage(.{
+ .usage = .{ .color_attachment = true },
+ .width = state.OffscreenWidth,
+ .height = state.OffscreenHeight,
+ .sample_count = state.OffscreenSampleCount,
+ .pixel_format = .RGBA8,
+ });
+ state.shaders.light.depth = sg.makeImage(.{
+ .usage = .{ .depth_stencil_attachment = true },
+ .width = state.OffscreenWidth,
+ .height = state.OffscreenHeight,
+ .sample_count = state.OffscreenSampleCount,
+ .pixel_format = .DEPTH,
+ });
+
+ state.shaders.combine.bind.views[shd.VIEW_tex_tex] = sg.makeView(.{
+ .texture = .{ .image = state.shaders.tex.img },
+ });
+ state.shaders.combine.bind.views[shd.VIEW_tex_shadow] = sg.makeView(.{
+ .texture = .{ .image = state.shaders.shadow.img },
+ });
+ state.shaders.combine.bind.views[shd.VIEW_tex_light] = sg.makeView(.{
+ .texture = .{ .image = state.shaders.light.img },
+ });
+ state.shaders.combine.bind.samplers[shd.SMP_smp] = sg.makeSampler(.{
+ .min_filter = sg.Filter.LINEAR,
+ .mag_filter = sg.Filter.LINEAR,
+ });