vulkano reeeeeeeeeeee

This commit is contained in:
2021-10-24 18:57:46 +02:00
parent 23e19bf9d0
commit 2834623ba7
12 changed files with 193 additions and 192 deletions

View File

@@ -25,12 +25,12 @@ pub fn upload_texture_from_file(path: &str, renderer: &mut VulkanRenderer) -> Re
println!("Texture width: {}, height: {}, bytes: {}", tex_width, tex_height, tex_byte_count);
let texture = if is_dxt1 {
renderer.upload_texture(&tex_bytes[128..], tex_width, tex_height, Format::BC1_RGBUnormBlock, Filter::Linear, SamplerAddressMode::Repeat, renderer.device.clone())
renderer.upload_texture(&tex_bytes[128..], tex_width, tex_height, Format::BC1_RGB_UNORM_BLOCK, Filter::Linear, SamplerAddressMode::Repeat, renderer.device.clone())
} else if is_dx10 {
let dxgi_type = u32::from_ne_bytes(tex_bytes[128..132].try_into()?);
assert!(dxgi_type == 83); // BC5 Unorm Typeless
renderer.upload_texture(&tex_bytes[128+20..], tex_width, tex_height, Format::BC5UnormBlock, Filter::Linear, SamplerAddressMode::Repeat, renderer.device.clone())
renderer.upload_texture(&tex_bytes[128+20..], tex_width, tex_height, Format::BC5_UNORM_BLOCK, Filter::Linear, SamplerAddressMode::Repeat, renderer.device.clone())
} else {
panic!("Unknown texture type!");
};
@@ -40,8 +40,8 @@ pub fn upload_texture_from_file(path: &str, renderer: &mut VulkanRenderer) -> Re
pub fn get_block_size(format: Format) -> Option<u32> {
match format {
Format::BC1_RGBUnormBlock => Some(8),
Format::BC5UnormBlock => Some(16),
Format::BC1_RGB_UNORM_BLOCK => Some(8),
Format::BC5_UNORM_BLOCK => Some(16),
_ => None
}
}