stuff
This commit is contained in:
@@ -38,3 +38,11 @@ pub fn upload_texture_from_file(path: &str, renderer: &mut VulkanRenderer) -> Re
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_block_size(format: Format) -> Option<u32> {
|
||||||
|
match format {
|
||||||
|
Format::BC1_RGBUnormBlock => Some(8),
|
||||||
|
Format::BC5UnormBlock => Some(16),
|
||||||
|
_ => None
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ use std::sync::Arc;
|
|||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
|
|
||||||
use cgmath::{Matrix4, SquareMatrix};
|
use cgmath::{Matrix4, SquareMatrix};
|
||||||
|
use dds::get_block_size;
|
||||||
use vulkano::{buffer::{BufferUsage, CpuAccessibleBuffer}, command_buffer::{CommandBuffer, SubpassContents}, image::{ImageLayout, ImageUsage, MipmapsCount, immutable::SubImage}};
|
use vulkano::{buffer::{BufferUsage, CpuAccessibleBuffer}, command_buffer::{CommandBuffer, SubpassContents}, image::{ImageLayout, ImageUsage, MipmapsCount, immutable::SubImage}};
|
||||||
use vulkano::command_buffer::{AutoCommandBuffer, AutoCommandBufferBuilder, DynamicState};
|
use vulkano::command_buffer::{AutoCommandBuffer, AutoCommandBufferBuilder, DynamicState};
|
||||||
use vulkano::descriptor::DescriptorSet;
|
use vulkano::descriptor::DescriptorSet;
|
||||||
@@ -467,11 +468,7 @@ impl VulkanRenderer {
|
|||||||
|
|
||||||
let mut offset = 0;
|
let mut offset = 0;
|
||||||
|
|
||||||
let block_bytes = match format {
|
let block_bytes = get_block_size(format).expect(&format!("Unknown texture format {:?}!", format));
|
||||||
Format::BC1_RGBUnormBlock => 8,
|
|
||||||
Format::BC5UnormBlock => 16,
|
|
||||||
f => panic!(format!("Unknown texture format {:?}!", f))
|
|
||||||
};
|
|
||||||
|
|
||||||
for i in 0..image_view.mipmap_levels() {
|
for i in 0..image_view.mipmap_levels() {
|
||||||
let mip_size = dimensions.to_image_dimensions().mipmap_dimensions(i).unwrap().width_height_depth();
|
let mip_size = dimensions.to_image_dimensions().mipmap_dimensions(i).unwrap().width_height_depth();
|
||||||
|
|||||||
Reference in New Issue
Block a user