1
0
Fork 0
forked from suyu/suyu

Merge pull request #3417 from ReinUsesLisp/r32i

texture: Implement R32I
This commit is contained in:
bunnei 2020-02-25 14:08:45 -05:00 committed by GitHub
commit 78ab2e0474
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 46 additions and 34 deletions

View file

@ -85,6 +85,7 @@ static constexpr ConversionArray morton_to_linear_fns = {
MortonCopy<true, PixelFormat::RG32UI>, MortonCopy<true, PixelFormat::RG32UI>,
MortonCopy<true, PixelFormat::RGBX16F>, MortonCopy<true, PixelFormat::RGBX16F>,
MortonCopy<true, PixelFormat::R32UI>, MortonCopy<true, PixelFormat::R32UI>,
MortonCopy<true, PixelFormat::R32I>,
MortonCopy<true, PixelFormat::ASTC_2D_8X8>, MortonCopy<true, PixelFormat::ASTC_2D_8X8>,
MortonCopy<true, PixelFormat::ASTC_2D_8X5>, MortonCopy<true, PixelFormat::ASTC_2D_8X5>,
MortonCopy<true, PixelFormat::ASTC_2D_5X4>, MortonCopy<true, PixelFormat::ASTC_2D_5X4>,
@ -166,6 +167,7 @@ static constexpr ConversionArray linear_to_morton_fns = {
MortonCopy<false, PixelFormat::RG32UI>, MortonCopy<false, PixelFormat::RG32UI>,
MortonCopy<false, PixelFormat::RGBX16F>, MortonCopy<false, PixelFormat::RGBX16F>,
MortonCopy<false, PixelFormat::R32UI>, MortonCopy<false, PixelFormat::R32UI>,
MortonCopy<false, PixelFormat::R32I>,
nullptr, nullptr,
nullptr, nullptr,
nullptr, nullptr,

View file

@ -87,6 +87,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format
{GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, false}, // RG32UI {GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, false}, // RG32UI
{GL_RGB16F, GL_RGBA, GL_HALF_FLOAT, false}, // RGBX16F {GL_RGB16F, GL_RGBA, GL_HALF_FLOAT, false}, // RGBX16F
{GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, false}, // R32UI {GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, false}, // R32UI
{GL_R32I, GL_RED_INTEGER, GL_INT, false}, // R32I
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, false}, // ASTC_2D_8X8 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, false}, // ASTC_2D_8X8
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, false}, // ASTC_2D_8X5 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, false}, // ASTC_2D_8X5
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, false}, // ASTC_2D_5X4 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, false}, // ASTC_2D_5X4

View file

@ -159,6 +159,7 @@ struct FormatTuple {
{vk::Format::eR32G32Uint, Attachable | Storage}, // RG32UI {vk::Format::eR32G32Uint, Attachable | Storage}, // RG32UI
{vk::Format::eUndefined, {}}, // RGBX16F {vk::Format::eUndefined, {}}, // RGBX16F
{vk::Format::eR32Uint, Attachable | Storage}, // R32UI {vk::Format::eR32Uint, Attachable | Storage}, // R32UI
{vk::Format::eR32Sint, Attachable | Storage}, // R32I
{vk::Format::eAstc8x8UnormBlock, {}}, // ASTC_2D_8X8 {vk::Format::eAstc8x8UnormBlock, {}}, // ASTC_2D_8X8
{vk::Format::eUndefined, {}}, // ASTC_2D_8X5 {vk::Format::eUndefined, {}}, // ASTC_2D_8X5
{vk::Format::eUndefined, {}}, // ASTC_2D_5X4 {vk::Format::eUndefined, {}}, // ASTC_2D_5X4

View file

@ -523,6 +523,7 @@ std::unordered_map<vk::Format, vk::FormatProperties> VKDevice::GetFormatProperti
vk::Format::eB10G11R11UfloatPack32, vk::Format::eB10G11R11UfloatPack32,
vk::Format::eR32Sfloat, vk::Format::eR32Sfloat,
vk::Format::eR32Uint, vk::Format::eR32Uint,
vk::Format::eR32Sint,
vk::Format::eR16Sfloat, vk::Format::eR16Sfloat,
vk::Format::eR16G16B16A16Sfloat, vk::Format::eR16G16B16A16Sfloat,
vk::Format::eB8G8R8A8Unorm, vk::Format::eB8G8R8A8Unorm,

View file

@ -59,47 +59,48 @@ enum class PixelFormat {
RG32UI = 41, RG32UI = 41,
RGBX16F = 42, RGBX16F = 42,
R32UI = 43, R32UI = 43,
ASTC_2D_8X8 = 44, R32I = 44,
ASTC_2D_8X5 = 45, ASTC_2D_8X8 = 45,
ASTC_2D_5X4 = 46, ASTC_2D_8X5 = 46,
BGRA8_SRGB = 47, ASTC_2D_5X4 = 47,
DXT1_SRGB = 48, BGRA8_SRGB = 48,
DXT23_SRGB = 49, DXT1_SRGB = 49,
DXT45_SRGB = 50, DXT23_SRGB = 50,
BC7U_SRGB = 51, DXT45_SRGB = 51,
R4G4B4A4U = 52, BC7U_SRGB = 52,
ASTC_2D_4X4_SRGB = 53, R4G4B4A4U = 53,
ASTC_2D_8X8_SRGB = 54, ASTC_2D_4X4_SRGB = 54,
ASTC_2D_8X5_SRGB = 55, ASTC_2D_8X8_SRGB = 55,
ASTC_2D_5X4_SRGB = 56, ASTC_2D_8X5_SRGB = 56,
ASTC_2D_5X5 = 57, ASTC_2D_5X4_SRGB = 57,
ASTC_2D_5X5_SRGB = 58, ASTC_2D_5X5 = 58,
ASTC_2D_10X8 = 59, ASTC_2D_5X5_SRGB = 59,
ASTC_2D_10X8_SRGB = 60, ASTC_2D_10X8 = 60,
ASTC_2D_6X6 = 61, ASTC_2D_10X8_SRGB = 61,
ASTC_2D_6X6_SRGB = 62, ASTC_2D_6X6 = 62,
ASTC_2D_10X10 = 63, ASTC_2D_6X6_SRGB = 63,
ASTC_2D_10X10_SRGB = 64, ASTC_2D_10X10 = 64,
ASTC_2D_12X12 = 65, ASTC_2D_10X10_SRGB = 65,
ASTC_2D_12X12_SRGB = 66, ASTC_2D_12X12 = 66,
ASTC_2D_8X6 = 67, ASTC_2D_12X12_SRGB = 67,
ASTC_2D_8X6_SRGB = 68, ASTC_2D_8X6 = 68,
ASTC_2D_6X5 = 69, ASTC_2D_8X6_SRGB = 69,
ASTC_2D_6X5_SRGB = 70, ASTC_2D_6X5 = 70,
E5B9G9R9F = 71, ASTC_2D_6X5_SRGB = 71,
E5B9G9R9F = 72,
MaxColorFormat, MaxColorFormat,
// Depth formats // Depth formats
Z32F = 72, Z32F = 73,
Z16 = 73, Z16 = 74,
MaxDepthFormat, MaxDepthFormat,
// DepthStencil formats // DepthStencil formats
Z24S8 = 74, Z24S8 = 75,
S8Z24 = 75, S8Z24 = 76,
Z32FS8 = 76, Z32FS8 = 77,
MaxDepthStencilFormat, MaxDepthStencilFormat,
@ -171,6 +172,7 @@ constexpr std::array<u32, MaxPixelFormat> compression_factor_shift_table = {{
0, // RG32UI 0, // RG32UI
0, // RGBX16F 0, // RGBX16F
0, // R32UI 0, // R32UI
0, // R32I
2, // ASTC_2D_8X8 2, // ASTC_2D_8X8
2, // ASTC_2D_8X5 2, // ASTC_2D_8X5
2, // ASTC_2D_5X4 2, // ASTC_2D_5X4
@ -267,6 +269,7 @@ constexpr std::array<u32, MaxPixelFormat> block_width_table = {{
1, // RG32UI 1, // RG32UI
1, // RGBX16F 1, // RGBX16F
1, // R32UI 1, // R32UI
1, // R32I
8, // ASTC_2D_8X8 8, // ASTC_2D_8X8
8, // ASTC_2D_8X5 8, // ASTC_2D_8X5
5, // ASTC_2D_5X4 5, // ASTC_2D_5X4
@ -355,6 +358,7 @@ constexpr std::array<u32, MaxPixelFormat> block_height_table = {{
1, // RG32UI 1, // RG32UI
1, // RGBX16F 1, // RGBX16F
1, // R32UI 1, // R32UI
1, // R32I
8, // ASTC_2D_8X8 8, // ASTC_2D_8X8
5, // ASTC_2D_8X5 5, // ASTC_2D_8X5
4, // ASTC_2D_5X4 4, // ASTC_2D_5X4
@ -443,6 +447,7 @@ constexpr std::array<u32, MaxPixelFormat> bpp_table = {{
64, // RG32UI 64, // RG32UI
64, // RGBX16F 64, // RGBX16F
32, // R32UI 32, // R32UI
32, // R32I
128, // ASTC_2D_8X8 128, // ASTC_2D_8X8
128, // ASTC_2D_8X5 128, // ASTC_2D_8X5
128, // ASTC_2D_5X4 128, // ASTC_2D_5X4
@ -546,6 +551,7 @@ constexpr std::array<SurfaceCompression, MaxPixelFormat> compression_type_table
SurfaceCompression::None, // RG32UI SurfaceCompression::None, // RG32UI
SurfaceCompression::None, // RGBX16F SurfaceCompression::None, // RGBX16F
SurfaceCompression::None, // R32UI SurfaceCompression::None, // R32UI
SurfaceCompression::None, // R32I
SurfaceCompression::Converted, // ASTC_2D_8X8 SurfaceCompression::Converted, // ASTC_2D_8X8
SurfaceCompression::Converted, // ASTC_2D_8X5 SurfaceCompression::Converted, // ASTC_2D_8X5
SurfaceCompression::Converted, // ASTC_2D_5X4 SurfaceCompression::Converted, // ASTC_2D_5X4

View file

@ -41,7 +41,7 @@ struct Table {
ComponentType alpha_component; ComponentType alpha_component;
bool is_srgb; bool is_srgb;
}; };
constexpr std::array<Table, 74> DefinitionTable = {{ constexpr std::array<Table, 75> DefinitionTable = {{
{TextureFormat::A8R8G8B8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ABGR8U}, {TextureFormat::A8R8G8B8, C, UNORM, UNORM, UNORM, UNORM, PixelFormat::ABGR8U},
{TextureFormat::A8R8G8B8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::ABGR8S}, {TextureFormat::A8R8G8B8, C, SNORM, SNORM, SNORM, SNORM, PixelFormat::ABGR8S},
{TextureFormat::A8R8G8B8, C, UINT, UINT, UINT, UINT, PixelFormat::ABGR8UI}, {TextureFormat::A8R8G8B8, C, UINT, UINT, UINT, UINT, PixelFormat::ABGR8UI},
@ -89,6 +89,7 @@ constexpr std::array<Table, 74> DefinitionTable = {{
{TextureFormat::R32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R32F}, {TextureFormat::R32, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::R32F},
{TextureFormat::R32, C, UINT, UINT, UINT, UINT, PixelFormat::R32UI}, {TextureFormat::R32, C, UINT, UINT, UINT, UINT, PixelFormat::R32UI},
{TextureFormat::R32, C, SINT, SINT, SINT, SINT, PixelFormat::R32I},
{TextureFormat::E5B9G9R9_SHAREDEXP, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::E5B9G9R9F}, {TextureFormat::E5B9G9R9_SHAREDEXP, C, FLOAT, FLOAT, FLOAT, FLOAT, PixelFormat::E5B9G9R9F},