mirror of
https://github.com/AxioDL/boo.git
synced 2025-05-16 04:11:21 +00:00
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 };
|
enum class TextureType { Static, StaticArray, Dynamic, Render, CubeRender };
|
||||||
|
|
||||||
/** Supported texture formats */
|
/** 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 */
|
/** Supported texture clamp modes */
|
||||||
enum class TextureClampMode { Invalid = -1, Repeat, ClampToWhite, ClampToBlack, ClampToEdge, ClampToEdgeNearest };
|
enum class TextureClampMode { Invalid = -1, Repeat, ClampToWhite, ClampToBlack, ClampToEdge, ClampToEdgeNearest };
|
||||||
|
@ -179,6 +179,20 @@ class D3D11TextureS : public GraphicsDataNode<ITextureS> {
|
|||||||
pxPitchDenom = 1;
|
pxPitchDenom = 1;
|
||||||
pxTilePitch = 4;
|
pxTilePitch = 4;
|
||||||
break;
|
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:
|
default:
|
||||||
Log.report(logvisor::Fatal, fmt("unsupported tex format"));
|
Log.report(logvisor::Fatal, fmt("unsupported tex format"));
|
||||||
}
|
}
|
||||||
|
@ -335,6 +335,16 @@ class GLTextureS : public GraphicsDataNode<ITextureS> {
|
|||||||
compressed = true;
|
compressed = true;
|
||||||
pxPitch = 1;
|
pxPitch = 1;
|
||||||
break;
|
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:
|
default:
|
||||||
Log.report(logvisor::Fatal, fmt("unsupported tex format"));
|
Log.report(logvisor::Fatal, fmt("unsupported tex format"));
|
||||||
}
|
}
|
||||||
|
@ -232,6 +232,18 @@ class MetalTextureS : public GraphicsDataNode<ITextureS> {
|
|||||||
ppitchDenom = 1;
|
ppitchDenom = 1;
|
||||||
bytesPerRow = width * 16 / 4; // Metal wants this in blocks, not bytes
|
bytesPerRow = width * 16 / 4; // Metal wants this in blocks, not bytes
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1383,6 +1383,16 @@ class VulkanTextureS : public GraphicsDataNode<ITextureS> {
|
|||||||
m_pixelPitchNum = 1;
|
m_pixelPitchNum = 1;
|
||||||
m_pixelPitchDenom = 1;
|
m_pixelPitchDenom = 1;
|
||||||
break;
|
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:
|
default:
|
||||||
Log.report(logvisor::Fatal, fmt("unsupported tex format"));
|
Log.report(logvisor::Fatal, fmt("unsupported tex format"));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user