From 42f3f5030f3cd041259f4a4bfdd94803e5ba1b02 Mon Sep 17 00:00:00 2001 From: grouting <105883378+grouting@users.noreply.github.com> Date: Sat, 27 Jun 2026 19:19:47 +0100 Subject: [PATCH] feat: add safe set_blend_constants method --- src/sdl3/gpu/pass.rs | 8 +++++++- src/sdl3/pixels.rs | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/sdl3/gpu/pass.rs b/src/sdl3/gpu/pass.rs index c7b5b69d..78c61c09 100644 --- a/src/sdl3/gpu/pass.rs +++ b/src/sdl3/gpu/pass.rs @@ -5,7 +5,7 @@ use crate::{ BufferBinding, BufferRegion, GraphicsPipeline, IndexElementSize, LoadOp, StoreOp, Texture, TextureRegion, TextureSamplerBinding, TextureTransferInfo, TransferBufferLocation, }, - pixels::Color, + pixels::{Color, FColor}, rect::Rect, Error, }; @@ -504,6 +504,12 @@ impl RenderPass { pub fn set_scissor(&self, scissor: Rect) { unsafe { sys::gpu::SDL_SetGPUScissor(self.inner, scissor.raw()) } } + + #[doc(alias = "SDL_SetGPUBlendConstants")] + pub fn set_blend_constants(&self, color: Color) { + let color = FColor::from(color); + unsafe { sys::gpu::SDL_SetGPUBlendConstants(self.inner, color.raw()) } + } } pub struct CopyPass { diff --git a/src/sdl3/pixels.rs b/src/sdl3/pixels.rs index 09c74618..a13cdd24 100644 --- a/src/sdl3/pixels.rs +++ b/src/sdl3/pixels.rs @@ -273,7 +273,7 @@ impl FColor { // Implemented manually and kept private, because reasons #[inline] - const fn raw(self) -> sys::pixels::SDL_FColor { + pub(crate) const fn raw(self) -> sys::pixels::SDL_FColor { sys::pixels::SDL_FColor { r: self.r, g: self.g,