mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-23 18:51:56 +01:00
Implement additional texture formats, including BCn
BCeNabler is required for BCn textures, the pre-swizzled formats will be removed when arbitary swizzle support is added later.
This commit is contained in:
parent
600b94505c
commit
ab4962c4e4
@ -1675,6 +1675,7 @@ namespace skyline::gpu::interconnect {
|
|||||||
TIC_FORMAT_CASE_ST(ticFormat, skFormat, Float, swizzleX, swizzleY, swizzleZ, swizzleW)
|
TIC_FORMAT_CASE_ST(ticFormat, skFormat, Float, swizzleX, swizzleY, swizzleZ, swizzleW)
|
||||||
|
|
||||||
switch (format.Raw()) {
|
switch (format.Raw()) {
|
||||||
|
TIC_FORMAT_CASE_NORM_INT(R8, R8R001, R, Zero, Zero, OneFloat);
|
||||||
TIC_FORMAT_CASE_ST(B5G6R5, R5G6B5, Unorm, B, G, R, OneFloat);
|
TIC_FORMAT_CASE_ST(B5G6R5, R5G6B5, Unorm, B, G, R, OneFloat);
|
||||||
TIC_FORMAT_CASE_NORM_INT(A8R8G8B8, R8G8B8A8, R, G, B, A);
|
TIC_FORMAT_CASE_NORM_INT(A8R8G8B8, R8G8B8A8, R, G, B, A);
|
||||||
TIC_FORMAT_CASE_NORM_INT(A8R8G8B8, A8B8G8R8, A, R, G, B);
|
TIC_FORMAT_CASE_NORM_INT(A8R8G8B8, A8B8G8R8, A, R, G, B);
|
||||||
@ -1682,6 +1683,9 @@ namespace skyline::gpu::interconnect {
|
|||||||
TIC_FORMAT_CASE_NORM_INT_FLOAT(R16G16B16A16, R16G16B16A16, R, G, B, A);
|
TIC_FORMAT_CASE_NORM_INT_FLOAT(R16G16B16A16, R16G16B16A16, R, G, B, A);
|
||||||
TIC_FORMAT_CASE_NORM_INT(A2B10G10R10, A2B10G10R10, R, G, B, A);
|
TIC_FORMAT_CASE_NORM_INT(A2B10G10R10, A2B10G10R10, R, G, B, A);
|
||||||
TIC_FORMAT_CASE_ST(Astc4x4, Astc4x4, Unorm, R, G, B, A);
|
TIC_FORMAT_CASE_ST(Astc4x4, Astc4x4, Unorm, R, G, B, A);
|
||||||
|
TIC_FORMAT_CASE_ST(Dxt1, Bc1, Unorm, R, G, B, A);
|
||||||
|
TIC_FORMAT_CASE_ST(Dxn1, Bc4111R, Unorm, OneFloat, OneFloat, OneFloat, R);
|
||||||
|
TIC_FORMAT_CASE_ST(Dxn1, Bc4RRR1, Unorm, R, R, R, OneFloat);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw exception("Cannot translate TIC format: 0x{:X}", static_cast<u32>(format.Raw()));
|
throw exception("Cannot translate TIC format: 0x{:X}", static_cast<u32>(format.Raw()));
|
||||||
|
@ -32,11 +32,15 @@ namespace skyline::gpu::format {
|
|||||||
#define FORMAT_INT_FLOAT(name, bitsPerBlock, format, ...) \
|
#define FORMAT_INT_FLOAT(name, bitsPerBlock, format, ...) \
|
||||||
FORMAT_SUFF_INT_FLOAT(name, bitsPerBlock, format,, ##__VA_ARGS__)
|
FORMAT_SUFF_INT_FLOAT(name, bitsPerBlock, format,, ##__VA_ARGS__)
|
||||||
|
|
||||||
#define FORMAT_SUFF_NORM_INT(name, bitsPerBlock, format, fmtSuffix, ...) \
|
#define FORMAT_SUFF_NORM(name, bitsPerBlock, format, fmtSuffix, ...) \
|
||||||
FORMAT_SUFF_INT(name, bitsPerBlock, format, fmtSuffix, ##__VA_ARGS__); \
|
|
||||||
FORMAT(name ## Unorm, bitsPerBlock, format ## Unorm ## fmtSuffix, ##__VA_ARGS__); \
|
FORMAT(name ## Unorm, bitsPerBlock, format ## Unorm ## fmtSuffix, ##__VA_ARGS__); \
|
||||||
FORMAT(name ## Snorm, bitsPerBlock, format ## Snorm ## fmtSuffix, ##__VA_ARGS__)
|
FORMAT(name ## Snorm, bitsPerBlock, format ## Snorm ## fmtSuffix, ##__VA_ARGS__)
|
||||||
|
|
||||||
|
#define FORMAT_SUFF_NORM_INT(name, bitsPerBlock, format, fmtSuffix, ...) \
|
||||||
|
FORMAT_SUFF_INT(name, bitsPerBlock, format, fmtSuffix, ##__VA_ARGS__); \
|
||||||
|
FORMAT_SUFF_NORM(name, bitsPerBlock, format, fmtSuffix, ##__VA_ARGS__)
|
||||||
|
|
||||||
|
|
||||||
#define FORMAT_NORM_INT(name, bitsPerBlock, format, ...) \
|
#define FORMAT_NORM_INT(name, bitsPerBlock, format, ...) \
|
||||||
FORMAT_SUFF_NORM_INT(name, bitsPerBlock, format,, ##__VA_ARGS__)
|
FORMAT_SUFF_NORM_INT(name, bitsPerBlock, format,, ##__VA_ARGS__)
|
||||||
|
|
||||||
@ -58,6 +62,8 @@ namespace skyline::gpu::format {
|
|||||||
|
|
||||||
// Color formats
|
// Color formats
|
||||||
FORMAT_NORM_INT_SRGB(R8, 8, eR8);
|
FORMAT_NORM_INT_SRGB(R8, 8, eR8);
|
||||||
|
FORMAT_NORM_INT_SRGB(R8R001, 8, eR8);
|
||||||
|
|
||||||
FORMAT_NORM_INT_FLOAT(R16, 16, eR16);
|
FORMAT_NORM_INT_FLOAT(R16, 16, eR16);
|
||||||
FORMAT_NORM_INT_SRGB(R8G8, 16, eR8G8);
|
FORMAT_NORM_INT_SRGB(R8G8, 16, eR8G8);
|
||||||
FORMAT(R5G6B5Unorm, 16, eR5G6B5UnormPack16);
|
FORMAT(R5G6B5Unorm, 16, eR5G6B5UnormPack16);
|
||||||
@ -90,7 +96,37 @@ namespace skyline::gpu::format {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Compressed Colour Formats
|
// Compressed Colour Formats
|
||||||
FORMAT_SUFF_UNORM_SRGB(Astc4x4, 128, eAstc4x4, Block);
|
FORMAT_SUFF_UNORM_SRGB(Bc1, 64, eBc1Rgba, Block,
|
||||||
|
.blockWidth = 4,
|
||||||
|
.blockHeight = 4
|
||||||
|
);
|
||||||
|
|
||||||
|
FORMAT_SUFF_NORM(Bc4111R, 64, eBc4, Block,
|
||||||
|
.blockWidth = 4,
|
||||||
|
.blockHeight = 4,
|
||||||
|
.swizzle = {
|
||||||
|
.red = swc::One,
|
||||||
|
.green = swc::One,
|
||||||
|
.blue = swc::One,
|
||||||
|
.alpha = swc::Red
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
FORMAT_SUFF_NORM(Bc4RRR1, 64, eBc4, Block,
|
||||||
|
.blockWidth = 4,
|
||||||
|
.blockHeight = 4,
|
||||||
|
.swizzle = {
|
||||||
|
.red = swc::Red,
|
||||||
|
.green = swc::Red,
|
||||||
|
.blue = swc::Red,
|
||||||
|
.alpha = swc::One
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
FORMAT_SUFF_UNORM_SRGB(Astc4x4, 128, eAstc4x4, Block,
|
||||||
|
.blockWidth = 4,
|
||||||
|
.blockHeight = 4
|
||||||
|
);
|
||||||
|
|
||||||
// Depth/Stencil Formats
|
// Depth/Stencil Formats
|
||||||
FORMAT(D32Float, 32, eD32Sfloat, vka::eDepth);
|
FORMAT(D32Float, 32, eD32Sfloat, vka::eDepth);
|
||||||
|
Loading…
Reference in New Issue
Block a user