1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

Add 10-bit texture format and setting to chose PP color depth

(and move some settings to the advanced category)
This commit is contained in:
sfan5 2024-11-28 10:38:51 +01:00
parent e545e96d2b
commit 36edc3f161
7 changed files with 48 additions and 20 deletions

View file

@ -342,6 +342,8 @@ public:
return 16;
case ECF_R16G16:
return 32;
case ECF_A2R10G10B10:
return 32;
case ECF_R16F:
return 16;
case ECF_G16R16F:

View file

@ -72,6 +72,9 @@ enum ECOLOR_FORMAT
//! 32 bit format using 16 bits for the red and green channels.
ECF_R16G16,
//! 32 bit format using 10 bits for R, G, B and 2 for alpha.
ECF_A2R10G10B10,
/** Depth and stencil formats. */
//! 16 bit format using 16 bits for depth.
@ -91,7 +94,7 @@ enum ECOLOR_FORMAT
};
//! Names for ECOLOR_FORMAT types
const c8 *const ColorFormatNames[ECF_UNKNOWN + 2] = {
const c8 *const ColorFormatNames[] = {
"A1R5G5B5",
"R5G6B5",
"R8G8B8",
@ -106,6 +109,7 @@ const c8 *const ColorFormatNames[ECF_UNKNOWN + 2] = {
"R8G8",
"R16",
"R16G16",
"A2R10G10B10",
"D16",
"D24",
"D32",
@ -114,6 +118,9 @@ const c8 *const ColorFormatNames[ECF_UNKNOWN + 2] = {
0,
};
static_assert(sizeof(ColorFormatNames) / sizeof(ColorFormatNames[0])
== ECF_UNKNOWN + 2, "name table size mismatch");
//! Creates a 16 bit A1R5G5B5 color
inline u16 RGBA16(u32 r, u32 g, u32 b, u32 a = 0xFF)
{

View file

@ -62,6 +62,7 @@ void COpenGL3Driver::initFeatures()
TextureFormats[ECF_R8G8] = {GL_RG8, GL_RG, GL_UNSIGNED_BYTE};
TextureFormats[ECF_R16] = {GL_R16, GL_RED, GL_UNSIGNED_SHORT};
TextureFormats[ECF_R16G16] = {GL_RG16, GL_RG, GL_UNSIGNED_SHORT};
TextureFormats[ECF_A2R10G10B10] = {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV};
TextureFormats[ECF_D16] = {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT};
TextureFormats[ECF_D24] = {GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT};
TextureFormats[ECF_D32] = {GL_DEPTH_COMPONENT32, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT}; // WARNING: may not be renderable (?!)

View file

@ -59,6 +59,7 @@ void COpenGLES2Driver::initFeatures()
TextureFormats[ECF_A32B32G32R32F] = {GL_RGBA32F, GL_RGBA, GL_FLOAT};
TextureFormats[ECF_R8] = {GL_R8, GL_RED, GL_UNSIGNED_BYTE};
TextureFormats[ECF_R8G8] = {GL_RG8, GL_RG, GL_UNSIGNED_BYTE};
TextureFormats[ECF_A2R10G10B10] = {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV};
TextureFormats[ECF_D16] = {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT};
TextureFormats[ECF_D24] = {GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT};
TextureFormats[ECF_D24S8] = {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8};