mirror of https://github.com/AxioDL/boo.git
Add DXT5/BPTC (BC3/BC7) texture formats
This commit is contained in:
parent
56a6b06210
commit
217031ebb9
|
@ -48,7 +48,7 @@ protected:
|
|||
enum class TextureType { Static, StaticArray, Dynamic, Render, CubeRender };
|
||||
|
||||
/** Supported texture formats */
|
||||
enum class TextureFormat { RGBA8, I8, I16, DXT1, DXT3, PVRTC4 };
|
||||
enum class TextureFormat { RGBA8, I8, I16, DXT1, DXT3, DXT5, BPTC };
|
||||
|
||||
/** Supported texture clamp modes */
|
||||
enum class TextureClampMode { Invalid = -1, Repeat, ClampToWhite, ClampToBlack, ClampToEdge, ClampToEdgeNearest };
|
||||
|
|
|
@ -179,6 +179,20 @@ class D3D11TextureS : public GraphicsDataNode<ITextureS> {
|
|||
pxPitchDenom = 1;
|
||||
pxTilePitch = 4;
|
||||
break;
|
||||
case TextureFormat::DXT5:
|
||||
pfmt = DXGI_FORMAT_BC3_UNORM;
|
||||
compressed = true;
|
||||
pxPitchNum = 1;
|
||||
pxPitchDenom = 1;
|
||||
pxTilePitch = 4;
|
||||
break;
|
||||
case TextureFormat::BPTC:
|
||||
pfmt = DXGI_FORMAT_BC7_UNORM;
|
||||
compressed = true;
|
||||
pxPitchNum = 1;
|
||||
pxPitchDenom = 1;
|
||||
pxTilePitch = 4;
|
||||
break;
|
||||
default:
|
||||
Log.report(logvisor::Fatal, fmt("unsupported tex format"));
|
||||
}
|
||||
|
|
|
@ -335,6 +335,16 @@ class GLTextureS : public GraphicsDataNode<ITextureS> {
|
|||
compressed = true;
|
||||
pxPitch = 1;
|
||||
break;
|
||||
case TextureFormat::DXT5:
|
||||
intFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
compressed = true;
|
||||
pxPitch = 1;
|
||||
break;
|
||||
case TextureFormat::BPTC:
|
||||
intFormat = GL_COMPRESSED_RGBA_BPTC_UNORM_ARB;
|
||||
compressed = true;
|
||||
pxPitch = 1;
|
||||
break;
|
||||
default:
|
||||
Log.report(logvisor::Fatal, fmt("unsupported tex format"));
|
||||
}
|
||||
|
|
|
@ -232,6 +232,18 @@ class MetalTextureS : public GraphicsDataNode<ITextureS> {
|
|||
ppitchDenom = 1;
|
||||
bytesPerRow = width * 16 / 4; // Metal wants this in blocks, not bytes
|
||||
break;
|
||||
case TextureFormat::DXT5:
|
||||
pfmt = MTLPixelFormatBC3_RGBA;
|
||||
ppitchNum = 1;
|
||||
ppitchDenom = 1;
|
||||
bytesPerRow = width * 16 / 4; // Metal wants this in blocks, not bytes
|
||||
break;
|
||||
case TextureFormat::BPTC:
|
||||
pfmt = MTLPixelFormatBC7_RGBAUnorm;
|
||||
ppitchNum = 1;
|
||||
ppitchDenom = 1;
|
||||
bytesPerRow = width * 16 / 4; // Metal wants this in blocks, not bytes
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1383,6 +1383,16 @@ class VulkanTextureS : public GraphicsDataNode<ITextureS> {
|
|||
m_pixelPitchNum = 1;
|
||||
m_pixelPitchDenom = 1;
|
||||
break;
|
||||
case TextureFormat::DXT5:
|
||||
pfmt = VK_FORMAT_BC3_UNORM_BLOCK;
|
||||
m_pixelPitchNum = 1;
|
||||
m_pixelPitchDenom = 1;
|
||||
break;
|
||||
case TextureFormat::BPTC:
|
||||
pfmt = VK_FORMAT_BC7_UNORM_BLOCK;
|
||||
m_pixelPitchNum = 1;
|
||||
m_pixelPitchDenom = 1;
|
||||
break;
|
||||
default:
|
||||
Log.report(logvisor::Fatal, fmt("unsupported tex format"));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue