Compare commits

...

3 Commits

Author SHA1 Message Date
Melissa Goad
597d619197 Merge a9571a383d into 60e6e8953e 2018-04-19 09:01:52 +00:00
Melissa Goad
a9571a383d fixup 2018-04-19 04:01:43 -05:00
Melissa Goad
95691e1a8d Add RGB10_A2 texture formats 2018-04-19 03:29:29 -05:00
3 changed files with 10 additions and 0 deletions

View File

@@ -52,6 +52,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
{GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, false, 1}, // ABGR8
{GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, false, 1}, // B5G6R5
{GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, true, 16}, // DXT1
{GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_10_10_10_2, false, 1}, // RGB10_A2
}};
static const FormatTuple& GetFormatTuple(PixelFormat pixel_format, ComponentType component_type) {
@@ -124,6 +125,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, VAddr, VAddr, VAddr),
MortonCopy<true, PixelFormat::ABGR8>,
MortonCopy<true, PixelFormat::B5G6R5>,
MortonCopy<true, PixelFormat::DXT1>,
MortonCopy<true, PixelFormat::RGB10_A2>,
};
static constexpr std::array<void (*)(u32, u32, u32, u8*, VAddr, VAddr, VAddr),
@@ -133,6 +135,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, VAddr, VAddr, VAddr),
MortonCopy<false, PixelFormat::B5G6R5>,
// TODO(Subv): Swizzling the DXT1 format is not yet supported
nullptr,
MortonCopy<false, PixelFormat::RGB10_A2>,
};
// Allocate an uninitialized texture of appropriate size and format for the surface

View File

@@ -55,6 +55,7 @@ struct SurfaceParams {
ABGR8 = 0,
B5G6R5 = 1,
DXT1 = 2,
RGB10_A2 = 3,
Max,
Invalid = 255,
@@ -87,6 +88,7 @@ struct SurfaceParams {
32, // ABGR8
16, // B5G6R5
64, // DXT1
32, // RGB10_A2
};
ASSERT(static_cast<size_t>(format) < bpp_table.size());
@@ -100,6 +102,8 @@ struct SurfaceParams {
switch (format) {
case Tegra::RenderTargetFormat::RGBA8_UNORM:
return PixelFormat::ABGR8;
case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
return PixelFormat::RGB10_A2;
default:
NGLOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
UNREACHABLE();
@@ -140,6 +144,8 @@ struct SurfaceParams {
return Tegra::Texture::TextureFormat::B5G6R5;
case PixelFormat::DXT1:
return Tegra::Texture::TextureFormat::DXT1;
case PixelFormat::RGB10_A2:
return Tegra::Texture::TextureFormat::RGB10_A2;
default:
UNREACHABLE();
}

View File

@@ -19,6 +19,7 @@ enum class TextureFormat : u32 {
DXT1 = 0x24,
DXT23 = 0x25,
DXT45 = 0x26,
RGB10_A2 = 0xD1,
};
enum class TextureType : u32 {