extract set_blend_constant from render_pass_end_impl

This commit is contained in:
teoxoy 2024-06-25 16:04:02 +02:00 committed by Teodor Tanasoaia
parent 6cb18ed072
commit 49800c30de

View File

@ -1557,18 +1557,7 @@ impl Global {
.map_pass_err(scope)?; .map_pass_err(scope)?;
} }
ArcRenderCommand::SetBlendConstant(ref color) => { ArcRenderCommand::SetBlendConstant(ref color) => {
api_log!("RenderPass::set_blend_constant"); set_blend_constant(&mut state, color);
state.blend_constant = OptionalState::Set;
let array = [
color.r as f32,
color.g as f32,
color.b as f32,
color.a as f32,
];
unsafe {
state.raw_encoder.set_blend_constants(&array);
}
} }
ArcRenderCommand::SetStencilReference(value) => { ArcRenderCommand::SetStencilReference(value) => {
api_log!("RenderPass::set_stencil_reference {value}"); api_log!("RenderPass::set_stencil_reference {value}");
@ -2565,6 +2554,21 @@ fn set_vertex_buffer<A: HalApi>(
Ok(()) Ok(())
} }
fn set_blend_constant<A: HalApi>(state: &mut State<A>, color: &Color) {
api_log!("RenderPass::set_blend_constant");
state.blend_constant = OptionalState::Set;
let array = [
color.r as f32,
color.g as f32,
color.b as f32,
color.a as f32,
];
unsafe {
state.raw_encoder.set_blend_constants(&array);
}
}
impl Global { impl Global {
pub fn render_pass_set_bind_group( pub fn render_pass_set_bind_group(
&self, &self,