Skip to content

Commit

Permalink
gfx2d: alpha blending Sprite2D
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Gutekanst <[email protected]>
  • Loading branch information
slimsag committed Sep 2, 2023
1 parent 67dbe9b commit 2b9ec3b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/gfx2d/Sprite2D.zig
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,18 @@ pub fn engineSprite2dInit(
);

const shader_module = device.createShaderModuleWGSL("shader.wgsl", @embedFile("shader.wgsl"));
const blend = gpu.BlendState{};
const blend = gpu.BlendState{
.color = .{
.operation = .add,
.src_factor = .src_alpha,
.dst_factor = .one_minus_src_alpha,
},
.alpha = .{
.operation = .add,
.src_factor = .one,
.dst_factor = .zero,
},
};
const color_target = gpu.ColorTargetState{
.format = core.descriptor.format,
.blend = &blend,
Expand Down

0 comments on commit 2b9ec3b

Please sign in to comment.