gfx2d: alpha blending Sprite2D
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
67dbe9b3ee
commit
2b9ec3ba4c
1 changed files with 12 additions and 1 deletions
|
|
@ -117,7 +117,18 @@ pub fn engineSprite2dInit(
|
||||||
);
|
);
|
||||||
|
|
||||||
const shader_module = device.createShaderModuleWGSL("shader.wgsl", @embedFile("shader.wgsl"));
|
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{
|
const color_target = gpu.ColorTargetState{
|
||||||
.format = core.descriptor.format,
|
.format = core.descriptor.format,
|
||||||
.blend = &blend,
|
.blend = &blend,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue