aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/textures
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/textures')
-rw-r--r--src/video_core/textures/decoders.cpp16
-rw-r--r--src/video_core/textures/texture.h89
2 files changed, 102 insertions, 3 deletions
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index ceb760e0f..7bf9c4c4b 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -46,6 +46,7 @@ void CopySwizzledData(u32 width, u32 height, u32 bytes_per_pixel, u32 out_bytes_
u32 BytesPerPixel(TextureFormat format) {
switch (format) {
case TextureFormat::DXT1:
+ case TextureFormat::DXN1:
// In this case a 'pixel' actually refers to a 4x4 tile.
return 8;
case TextureFormat::DXT23:
@@ -54,10 +55,15 @@ u32 BytesPerPixel(TextureFormat format) {
return 16;
case TextureFormat::A8R8G8B8:
case TextureFormat::A2B10G10R10:
+ case TextureFormat::BF10GF11RF11:
return 4;
case TextureFormat::A1B5G5R5:
case TextureFormat::B5G6R5:
return 2;
+ case TextureFormat::R8:
+ return 1;
+ case TextureFormat::R16_G16_B16_A16:
+ return 8;
default:
UNIMPLEMENTED_MSG("Format not implemented");
break;
@@ -75,7 +81,9 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width,
case TextureFormat::DXT1:
case TextureFormat::DXT23:
case TextureFormat::DXT45:
- // In the DXT formats, each 4x4 tile is swizzled instead of just individual pixel values.
+ case TextureFormat::DXN1:
+ // In the DXT and DXN formats, each 4x4 tile is swizzled instead of just individual pixel
+ // values.
CopySwizzledData(width / 4, height / 4, bytes_per_pixel, bytes_per_pixel, data,
unswizzled_data.data(), true, block_height);
break;
@@ -83,6 +91,9 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width,
case TextureFormat::A2B10G10R10:
case TextureFormat::A1B5G5R5:
case TextureFormat::B5G6R5:
+ case TextureFormat::R8:
+ case TextureFormat::R16_G16_B16_A16:
+ case TextureFormat::BF10GF11RF11:
CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data,
unswizzled_data.data(), true, block_height);
break;
@@ -103,10 +114,13 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat
case TextureFormat::DXT1:
case TextureFormat::DXT23:
case TextureFormat::DXT45:
+ case TextureFormat::DXN1:
case TextureFormat::A8R8G8B8:
case TextureFormat::A2B10G10R10:
case TextureFormat::A1B5G5R5:
case TextureFormat::B5G6R5:
+ case TextureFormat::R8:
+ case TextureFormat::BF10GF11RF11:
// TODO(Subv): For the time being just forward the same data without any decoding.
rgba_data = texture_data;
break;
diff --git a/src/video_core/textures/texture.h b/src/video_core/textures/texture.h
index b33e9bab3..a17eaf19d 100644
--- a/src/video_core/textures/texture.h
+++ b/src/video_core/textures/texture.h
@@ -14,13 +14,82 @@ namespace Tegra {
namespace Texture {
enum class TextureFormat : u32 {
- A8R8G8B8 = 0x8,
- A2B10G10R10 = 0x9,
+ R32_G32_B32_A32 = 0x01,
+ R32_G32_B32 = 0x02,
+ R16_G16_B16_A16 = 0x03,
+ R32_G32 = 0x04,
+ R32_B24G8 = 0x05,
+ ETC2_RGB = 0x06,
+ X8B8G8R8 = 0x07,
+ A8R8G8B8 = 0x08,
+ A2B10G10R10 = 0x09,
+ ETC2_RGB_PTA = 0x0a,
+ ETC2_RGBA = 0x0b,
+ R16_G16 = 0x0c,
+ G8R24 = 0x0d,
+ G24R8 = 0x0e,
+ R32 = 0x0f,
+ BC6H_SF16 = 0x10,
+ BC6H_UF16 = 0x11,
+ A4B4G4R4 = 0x12,
+ A5B5G5R1 = 0x13,
A1B5G5R5 = 0x14,
B5G6R5 = 0x15,
+ B6G5R5 = 0x16,
+ BC7U = 0x17,
+ G8R8 = 0x18,
+ EAC = 0x19,
+ EACX2 = 0x1a,
+ R16 = 0x1b,
+ Y8_VIDEO = 0x1c,
+ R8 = 0x1d,
+ G4R4 = 0x1e,
+ R1 = 0x1f,
+ E5B9G9R9_SHAREDEXP = 0x20,
+ BF10GF11RF11 = 0x21,
+ G8B8G8R8 = 0x22,
+ B8G8R8G8 = 0x23,
DXT1 = 0x24,
DXT23 = 0x25,
DXT45 = 0x26,
+ DXN1 = 0x27,
+ DXN2 = 0x28,
+ Z24S8 = 0x29,
+ X8Z24 = 0x2a,
+ S8Z24 = 0x2b,
+ X4V4Z24__COV4R4V = 0x2c,
+ X4V4Z24__COV8R8V = 0x2d,
+ V8Z24__COV4R12V = 0x2e,
+ ZF32 = 0x2f,
+ ZF32_X24S8 = 0x30,
+ X8Z24_X20V4S8__COV4R4V = 0x31,
+ X8Z24_X20V4S8__COV8R8V = 0x32,
+ ZF32_X20V4X8__COV4R4V = 0x33,
+ ZF32_X20V4X8__COV8R8V = 0x34,
+ ZF32_X20V4S8__COV4R4V = 0x35,
+ ZF32_X20V4S8__COV8R8V = 0x36,
+ X8Z24_X16V8S8__COV4R12V = 0x37,
+ ZF32_X16V8X8__COV4R12V = 0x38,
+ ZF32_X16V8S8__COV4R12V = 0x39,
+ Z16 = 0x3a,
+ V8Z24__COV8R24V = 0x3b,
+ X8Z24_X16V8S8__COV8R24V = 0x3c,
+ ZF32_X16V8X8__COV8R24V = 0x3d,
+ ZF32_X16V8S8__COV8R24V = 0x3e,
+ ASTC_2D_4X4 = 0x40,
+ ASTC_2D_5X5 = 0x41,
+ ASTC_2D_6X6 = 0x42,
+ ASTC_2D_8X8 = 0x44,
+ ASTC_2D_10X10 = 0x45,
+ ASTC_2D_12X12 = 0x46,
+ ASTC_2D_5X4 = 0x50,
+ ASTC_2D_6X5 = 0x51,
+ ASTC_2D_8X6 = 0x52,
+ ASTC_2D_10X8 = 0x53,
+ ASTC_2D_12X10 = 0x54,
+ ASTC_2D_8X5 = 0x55,
+ ASTC_2D_10X5 = 0x56,
+ ASTC_2D_10X6 = 0x57,
};
enum class TextureType : u32 {
@@ -53,6 +122,17 @@ enum class ComponentType : u32 {
FLOAT = 7
};
+enum class SwizzleSource : u32 {
+ Zero = 0,
+
+ R = 2,
+ G = 3,
+ B = 4,
+ A = 5,
+ OneInt = 6,
+ OneFloat = 7,
+};
+
union TextureHandle {
u32 raw;
BitField<0, 20, u32> tic_id;
@@ -70,6 +150,11 @@ struct TICEntry {
BitField<10, 3, ComponentType> g_type;
BitField<13, 3, ComponentType> b_type;
BitField<16, 3, ComponentType> a_type;
+
+ BitField<19, 3, SwizzleSource> x_source;
+ BitField<22, 3, SwizzleSource> y_source;
+ BitField<25, 3, SwizzleSource> z_source;
+ BitField<28, 3, SwizzleSource> w_source;
};
u32 address_low;
union {