diff --git a/blade-graphics/src/gles/mod.rs b/blade-graphics/src/gles/mod.rs index 3ea9c3a..83a0f2e 100644 --- a/blade-graphics/src/gles/mod.rs +++ b/blade-graphics/src/gles/mod.rs @@ -603,8 +603,9 @@ fn describe_texture_format(format: crate::TextureFormat) -> FormatInfo { Tf::Bgra8Unorm => (glow::RGBA8, glow::BGRA, glow::UNSIGNED_BYTE), Tf::Bgra8UnormSrgb => (glow::SRGB8_ALPHA8, glow::BGRA, glow::UNSIGNED_BYTE), Tf::Rgba8Snorm => (glow::RGBA8, glow::RGBA, glow::BYTE), - Tf::R16Float => (glow::R16F, glow::RED, glow::FLOAT), - Tf::Rgba16Float => (glow::RGBA16F, glow::RGBA, glow::FLOAT), + Tf::R16Float => (glow::R16F, glow::RED, glow::HALF_FLOAT), + Tf::Rg16Float => (glow::RG16F, glow::RG, glow::HALF_FLOAT), + Tf::Rgba16Float => (glow::RGBA16F, glow::RGBA, glow::HALF_FLOAT), Tf::R32Float => (glow::R32F, glow::RED, glow::FLOAT), Tf::Rg32Float => (glow::RG32F, glow::RG, glow::FLOAT), Tf::Rgba32Float => (glow::RGBA32F, glow::RGBA, glow::FLOAT), @@ -622,6 +623,21 @@ fn describe_texture_format(format: crate::TextureFormat) -> FormatInfo { Tf::Bc4Snorm => (glow::COMPRESSED_SIGNED_RED_RGTC1, glow::RED, 0), Tf::Bc5Unorm => (glow::COMPRESSED_RG_RGTC2, glow::RG, 0), Tf::Bc5Snorm => (glow::COMPRESSED_SIGNED_RG_RGTC2, glow::RG, 0), + Tf::Bc6hUfloat => (glow::COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, glow::RGB, 0), + Tf::Bc6hFloat => (glow::COMPRESSED_RGB_BPTC_SIGNED_FLOAT, glow::RGB, 0), + Tf::Bc7Unorm => (glow::COMPRESSED_RGBA_BPTC_UNORM, glow::RGBA, 0), + Tf::Bc7UnormSrgb => (glow::COMPRESSED_SRGB_ALPHA_BPTC_UNORM, glow::RGBA, 0), + Tf::Rgb10a2Unorm => ( + glow::RGB10_A2, + glow::RGBA, + glow::UNSIGNED_INT_2_10_10_10_REV, + ), + Tf::Rg11b10Ufloat => ( + glow::R11F_G11F_B10F, + glow::RGB, + glow::UNSIGNED_INT_10F_11F_11F_REV, + ), + Tf::Rgb9e5Ufloat => (glow::RGB9_E5, glow::RGB, glow::UNSIGNED_INT_5_9_9_9_REV), }; FormatInfo { internal, diff --git a/blade-graphics/src/lib.rs b/blade-graphics/src/lib.rs index 6719137..417038d 100644 --- a/blade-graphics/src/lib.rs +++ b/blade-graphics/src/lib.rs @@ -287,6 +287,7 @@ pub enum TextureFormat { Bgra8UnormSrgb, Rgba8Snorm, R16Float, + Rg16Float, Rgba16Float, R32Float, Rg32Float, @@ -307,6 +308,14 @@ pub enum TextureFormat { Bc4Snorm, Bc5Unorm, Bc5Snorm, + Bc6hUfloat, + Bc6hFloat, + Bc7Unorm, + Bc7UnormSrgb, + // packed 32-bit + Rgb10a2Unorm, + Rg11b10Ufloat, + Rgb9e5Ufloat, } #[derive(Clone, Copy, Debug)] diff --git a/blade-graphics/src/metal/mod.rs b/blade-graphics/src/metal/mod.rs index 94dc58e..730110c 100644 --- a/blade-graphics/src/metal/mod.rs +++ b/blade-graphics/src/metal/mod.rs @@ -315,6 +315,7 @@ fn map_texture_format(format: crate::TextureFormat) -> metal::MTLPixelFormat { Tf::Bgra8UnormSrgb => BGRA8Unorm_sRGB, Tf::Rgba8Snorm => RGBA8Snorm, Tf::R16Float => R16Float, + Tf::Rg16Float => RG16Float, Tf::Rgba16Float => RGBA16Float, Tf::R32Float => R32Float, Tf::Rg32Float => RG32Float, @@ -333,6 +334,13 @@ fn map_texture_format(format: crate::TextureFormat) -> metal::MTLPixelFormat { Tf::Bc4Snorm => BC4_RSnorm, Tf::Bc5Unorm => BC5_RGUnorm, Tf::Bc5Snorm => BC5_RGSnorm, + Tf::Bc6hUfloat => BC6H_RGBUfloat, + Tf::Bc6hFloat => BC6H_RGBFloat, + Tf::Bc7Unorm => BC7_RGBAUnorm, + Tf::Bc7UnormSrgb => BC7_RGBAUnorm_sRGB, + Tf::Rgb10a2Unorm => RGB10A2Unorm, + Tf::Rg11b10Ufloat => RG11B10Float, + Tf::Rgb9e5Ufloat => RGB9E5Float, } } diff --git a/blade-graphics/src/util.rs b/blade-graphics/src/util.rs index 23e876e..33c3a00 100644 --- a/blade-graphics/src/util.rs +++ b/blade-graphics/src/util.rs @@ -65,6 +65,7 @@ impl super::TextureFormat { Self::Bgra8UnormSrgb => uncompressed(4), Self::Rgba8Snorm => uncompressed(4), Self::R16Float => uncompressed(2), + Self::Rg16Float => uncompressed(4), Self::Rgba16Float => uncompressed(8), Self::R32Float => uncompressed(4), Self::Rg32Float => uncompressed(8), @@ -83,6 +84,13 @@ impl super::TextureFormat { Self::Bc4Snorm => cx_bc(8), Self::Bc5Unorm => cx_bc(16), Self::Bc5Snorm => cx_bc(16), + Self::Bc6hUfloat => cx_bc(16), + Self::Bc6hFloat => cx_bc(16), + Self::Bc7Unorm => cx_bc(16), + Self::Bc7UnormSrgb => cx_bc(16), + Self::Rgb10a2Unorm => uncompressed(4), + Self::Rg11b10Ufloat => uncompressed(4), + Self::Rgb9e5Ufloat => uncompressed(4), } } diff --git a/blade-graphics/src/vulkan/mod.rs b/blade-graphics/src/vulkan/mod.rs index c985ef7..47e278b 100644 --- a/blade-graphics/src/vulkan/mod.rs +++ b/blade-graphics/src/vulkan/mod.rs @@ -538,6 +538,7 @@ fn map_texture_format(format: crate::TextureFormat) -> vk::Format { Tf::Bgra8UnormSrgb => vk::Format::B8G8R8A8_SRGB, Tf::Rgba8Snorm => vk::Format::R8G8B8A8_SNORM, Tf::R16Float => vk::Format::R16_SFLOAT, + Tf::Rg16Float => vk::Format::R16G16_SFLOAT, Tf::Rgba16Float => vk::Format::R16G16B16A16_SFLOAT, Tf::R32Float => vk::Format::R32_SFLOAT, Tf::Rg32Float => vk::Format::R32G32_SFLOAT, @@ -556,6 +557,13 @@ fn map_texture_format(format: crate::TextureFormat) -> vk::Format { Tf::Bc4Snorm => vk::Format::BC4_SNORM_BLOCK, Tf::Bc5Unorm => vk::Format::BC5_UNORM_BLOCK, Tf::Bc5Snorm => vk::Format::BC5_SNORM_BLOCK, + Tf::Bc6hUfloat => vk::Format::BC6H_UFLOAT_BLOCK, + Tf::Bc6hFloat => vk::Format::BC6H_SFLOAT_BLOCK, + Tf::Bc7Unorm => vk::Format::BC7_UNORM_BLOCK, + Tf::Bc7UnormSrgb => vk::Format::BC7_SRGB_BLOCK, + Tf::Rgb10a2Unorm => vk::Format::A2B10G10R10_UNORM_PACK32, + Tf::Rg11b10Ufloat => vk::Format::B10G11R11_UFLOAT_PACK32, + Tf::Rgb9e5Ufloat => vk::Format::E5B9G9R9_UFLOAT_PACK32, } }