mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 14:55:05 +00:00
[rs] Update blend APIs
This commit is contained in:
parent
9c5e0eb5b8
commit
b14215f468
@ -28,20 +28,20 @@ cross = ["wgc/cross"]
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgc]
|
||||
package = "wgpu-core"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "c0478c707d35c6b459a7f0cb42ab75d768677e1b"
|
||||
rev = "6a6a9a4aedbbf7c8cc6b11a4b0c42341ac50a798"
|
||||
features = ["raw-window-handle"]
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies.wgc]
|
||||
package = "wgpu-core"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "c0478c707d35c6b459a7f0cb42ab75d768677e1b"
|
||||
rev = "6a6a9a4aedbbf7c8cc6b11a4b0c42341ac50a798"
|
||||
features = ["raw-window-handle"]
|
||||
optional = true
|
||||
|
||||
[dependencies.wgt]
|
||||
package = "wgpu-types"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "c0478c707d35c6b459a7f0cb42ab75d768677e1b"
|
||||
rev = "6a6a9a4aedbbf7c8cc6b11a4b0c42341ac50a798"
|
||||
|
||||
[dependencies]
|
||||
arrayvec = "0.5"
|
||||
|
@ -336,8 +336,8 @@ mod pass_impl {
|
||||
}
|
||||
|
||||
impl crate::RenderPassInner<Context> for wgc::command::RenderPass {
|
||||
fn set_blend_color(&mut self, color: wgt::Color) {
|
||||
wgpu_render_pass_set_blend_color(self, &color)
|
||||
fn set_blend_constant(&mut self, color: wgt::Color) {
|
||||
wgpu_render_pass_set_blend_constant(self, &color)
|
||||
}
|
||||
fn set_scissor_rect(&mut self, x: u32, y: u32, width: u32, height: u32) {
|
||||
wgpu_render_pass_set_scissor_rect(self, x, y, width, height)
|
||||
|
@ -179,6 +179,7 @@ impl PrettyError for wgc::command::ExecutionError {
|
||||
let name = wgc::gfx_select!(id => global.buffer_label(id));
|
||||
ret.push_str(&format_label_line("buffer", &name));
|
||||
}
|
||||
Self::Unimplemented(_reason) => {}
|
||||
};
|
||||
ret
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ impl crate::RenderInner<Context> for RenderBundleEncoder {
|
||||
}
|
||||
|
||||
impl crate::RenderPassInner<Context> for RenderPass {
|
||||
fn set_blend_color(&mut self, color: wgt::Color) {
|
||||
fn set_blend_constant(&mut self, color: wgt::Color) {
|
||||
self.0
|
||||
.set_blend_color_with_gpu_color_dict(&map_color(color));
|
||||
}
|
||||
@ -675,17 +675,17 @@ fn map_blend_factor(factor: wgt::BlendFactor) -> web_sys::GpuBlendFactor {
|
||||
match factor {
|
||||
BlendFactor::Zero => bf::Zero,
|
||||
BlendFactor::One => bf::One,
|
||||
BlendFactor::SrcColor => bf::SrcColor,
|
||||
BlendFactor::OneMinusSrcColor => bf::OneMinusSrcColor,
|
||||
BlendFactor::Src => bf::SrcColor,
|
||||
BlendFactor::OneMinusSrc => bf::OneMinusSrcColor,
|
||||
BlendFactor::SrcAlpha => bf::SrcAlpha,
|
||||
BlendFactor::OneMinusSrcAlpha => bf::OneMinusSrcAlpha,
|
||||
BlendFactor::DstColor => bf::DstColor,
|
||||
BlendFactor::OneMinusDstColor => bf::OneMinusDstColor,
|
||||
BlendFactor::Dst => bf::DstColor,
|
||||
BlendFactor::OneMinusDst => bf::OneMinusDstColor,
|
||||
BlendFactor::DstAlpha => bf::DstAlpha,
|
||||
BlendFactor::OneMinusDstAlpha => bf::OneMinusDstAlpha,
|
||||
BlendFactor::SrcAlphaSaturated => bf::SrcAlphaSaturated,
|
||||
BlendFactor::BlendColor => bf::BlendColor,
|
||||
BlendFactor::OneMinusBlendColor => bf::OneMinusBlendColor,
|
||||
BlendFactor::Constant => bf::BlendColor,
|
||||
BlendFactor::OneMinusConstant => bf::OneMinusBlendColor,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ trait RenderInner<Ctx: Context> {
|
||||
}
|
||||
|
||||
trait RenderPassInner<Ctx: Context>: RenderInner<Ctx> {
|
||||
fn set_blend_color(&mut self, color: Color);
|
||||
fn set_blend_constant(&mut self, color: Color);
|
||||
fn set_scissor_rect(&mut self, x: u32, y: u32, width: u32, height: u32);
|
||||
fn set_viewport(
|
||||
&mut self,
|
||||
@ -2183,8 +2183,8 @@ impl<'a> RenderPass<'a> {
|
||||
/// Sets the blend color as used by some of the blending modes.
|
||||
///
|
||||
/// Subsequent blending tests will test against this value.
|
||||
pub fn set_blend_color(&mut self, color: Color) {
|
||||
self.id.set_blend_color(color)
|
||||
pub fn set_blend_constant(&mut self, color: Color) {
|
||||
self.id.set_blend_constant(color)
|
||||
}
|
||||
|
||||
/// Sets the active index buffer.
|
||||
|
Loading…
Reference in New Issue
Block a user