mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-26 16:04:04 +00:00
Fix the 'Upload Texture' node (#2680)
* Fix upload texture node * Feature gate gpu node implemenations
This commit is contained in:
parent
4d2e1d57fd
commit
76ecdc8f1b
4 changed files with 26 additions and 13 deletions
|
@ -8,7 +8,7 @@ pub use executor::GpuExecutor;
|
|||
use futures::Future;
|
||||
use glam::{DAffine2, UVec2};
|
||||
use gpu_executor::{ComputePassDimensions, GPUConstant, StorageBufferOptions, TextureBufferOptions, TextureBufferType, ToStorageBuffer, ToUniformBuffer};
|
||||
use graphene_core::application_io::{ApplicationIo, EditorApi, ImageTexture, SurfaceHandle};
|
||||
use graphene_core::application_io::{ApplicationIo, EditorApi, ImageTexture, SurfaceHandle, TextureFrameTable};
|
||||
use graphene_core::raster::image::ImageFrameTable;
|
||||
use graphene_core::raster::{Image, SRGBA8};
|
||||
use graphene_core::transform::{Footprint, Transform};
|
||||
|
@ -910,14 +910,14 @@ async fn render_texture<'a: 'n>(
|
|||
}
|
||||
|
||||
#[node_macro::node(category(""))]
|
||||
async fn upload_texture<'a: 'n>(_: impl ExtractFootprint + Ctx, input: ImageFrameTable<Color>, executor: &'a WgpuExecutor) -> ImageTexture {
|
||||
async fn upload_texture<'a: 'n>(_: impl ExtractFootprint + Ctx, input: ImageFrameTable<Color>, executor: &'a WgpuExecutor) -> TextureFrameTable {
|
||||
// let new_data: Vec<RGBA16F> = input.image.data.into_iter().map(|c| c.into()).collect();
|
||||
|
||||
let input = input.one_instance_ref().instance;
|
||||
let new_data: Vec<SRGBA8> = input.data.iter().map(|x| (*x).into()).collect();
|
||||
let image = input.one_instance_ref().instance;
|
||||
let new_data: Vec<SRGBA8> = image.data.iter().map(|x| (*x).into()).collect();
|
||||
let new_image = Image {
|
||||
width: input.width,
|
||||
height: input.height,
|
||||
width: image.width,
|
||||
height: image.height,
|
||||
data: new_data,
|
||||
base64_string: None,
|
||||
};
|
||||
|
@ -929,10 +929,18 @@ async fn upload_texture<'a: 'n>(_: impl ExtractFootprint + Ctx, input: ImageFram
|
|||
_ => unreachable!("Unsupported ShaderInput type"),
|
||||
};
|
||||
|
||||
ImageTexture {
|
||||
let texture = ImageTexture {
|
||||
texture: texture.into(),
|
||||
// TODO: Find an alternate way to encode the transform and alpha_blend now that these fields have been moved up out of ImageTexture
|
||||
// transform: input.transform,
|
||||
// alpha_blend: Default::default(),
|
||||
}
|
||||
};
|
||||
let mut result_table = TextureFrameTable::empty();
|
||||
result_table.push(graphene_core::instances::Instance {
|
||||
instance: texture,
|
||||
transform: input.transform(),
|
||||
alpha_blending: *input.one_instance_ref().alpha_blending,
|
||||
source_node_id: *input.one_instance_ref().source_node_id,
|
||||
});
|
||||
result_table
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue