This commit is contained in:
2021-03-11 22:38:05 +01:00
parent 9848fbc183
commit da62d6ab67
3 changed files with 2 additions and 8 deletions

View File

@@ -2,8 +2,6 @@ use std::sync::Arc;
use std::time::SystemTime;
use cgmath::{Matrix4, SquareMatrix};
use image::{ImageBuffer, Rgb, Rgba};
use image::buffer::ConvertBuffer;
use vulkano::{buffer::{BufferUsage, CpuAccessibleBuffer}, command_buffer::SubpassContents, image::MipmapsCount};
use vulkano::command_buffer::{AutoCommandBuffer, AutoCommandBufferBuilder, DynamicState};
use vulkano::descriptor::DescriptorSet;
@@ -434,9 +432,7 @@ impl VulkanRenderer {
}
pub fn upload_texture(self: &mut Self, bytes: &[u8], width: u32, height: u32, format: Format, device: Arc<Device>) {
// Format buffer on cpu for upload
let dimensions = Dimensions::Dim2d { width, height };
let (image_view, future) = ImmutableImage::from_iter(bytes.iter().cloned(), dimensions, MipmapsCount::One, format, self.queue.clone()).unwrap();
future.flush().unwrap();