1
0
Fork 0
forked from wry/wry

gfx: attach color descriptions

This commit is contained in:
Julian Orth 2025-03-01 14:06:42 +01:00
parent 82085a3858
commit a174881138
24 changed files with 291 additions and 62 deletions

View file

@ -69,7 +69,7 @@ use {
crate::{
cmm::cmm_transfer_function::TransferFunction,
gfx_api::{
AcquireSync, CopyTexture, FillRect, GfxApiOpt, GfxContext, GfxError, GfxTexture,
AcquireSync, CopyTexture, FramebufferRect, GfxApiOpt, GfxContext, GfxError, GfxTexture,
ReleaseSync, SyncFile,
},
gfx_apis::gl::{
@ -205,10 +205,15 @@ enum RenderError {
#[derive(Default)]
struct GfxGlState {
triangles: RefCell<Vec<[f32; 2]>>,
fill_rect: VecStorage<FillRect>,
fill_rect: VecStorage<GlFillRect>,
copy_tex: VecStorage<&'static CopyTexture>,
}
struct GlFillRect {
pub rect: FramebufferRect,
pub color: Color,
}
fn run_ops(fb: &Framebuffer, ops: &[GfxApiOpt]) -> Option<SyncFile> {
let mut state = fb.ctx.gl_state.borrow_mut();
let state = &mut *state;
@ -236,10 +241,9 @@ fn run_ops(fb: &Framebuffer, ops: &[GfxApiOpt]) -> Option<SyncFile> {
}
}
GfxApiOpt::FillRect(f) => {
fill_rect.push(FillRect {
fill_rect.push(GlFillRect {
rect: f.rect,
color: f.effective_color(),
alpha: None,
});
i += 1;
}

View file

@ -1,6 +1,9 @@
use {
crate::{
cmm::cmm_transfer_function::TransferFunction,
cmm::{
cmm_description::{ColorDescription, LinearColorDescription},
cmm_transfer_function::TransferFunction,
},
format::Format,
gfx_api::{
AcquireSync, AsyncShmGfxTextureCallback, GfxApiOpt, GfxBlendBuffer, GfxError,
@ -105,10 +108,13 @@ impl GfxFramebuffer for Framebuffer {
self: Rc<Self>,
acquire_sync: AcquireSync,
_release_sync: ReleaseSync,
_cd: &Rc<ColorDescription>,
ops: &[GfxApiOpt],
clear: Option<&Color>,
_clear_cd: &Rc<LinearColorDescription>,
_region: &Region,
_blend_buffer: Option<&Rc<dyn GfxBlendBuffer>>,
_blend_cd: &Rc<ColorDescription>,
) -> Result<Option<SyncFile>, GfxError> {
(*self)
.render(acquire_sync, ops, clear)

View file

@ -1,5 +1,6 @@
use {
crate::{
cmm::cmm_description::{ColorDescription, LinearColorDescription},
format::Format,
gfx_api::{
AcquireSync, AsyncShmGfxTexture, AsyncShmGfxTextureCallback,
@ -552,10 +553,13 @@ impl GfxFramebuffer for VulkanImage {
self: Rc<Self>,
acquire_sync: AcquireSync,
release_sync: ReleaseSync,
_cd: &Rc<ColorDescription>,
ops: &[GfxApiOpt],
clear: Option<&Color>,
_clear_cd: &Rc<LinearColorDescription>,
region: &Region,
blend_buffer: Option<&Rc<dyn GfxBlendBuffer>>,
_blend_cd: &Rc<ColorDescription>,
) -> Result<Option<SyncFile>, GfxError> {
let mut blend_buffer =
blend_buffer.map(|b| b.clone().into_vk(&self.renderer.device.device));