mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Add support for ECF_D24 texture format
and prefer it over D32 for our depth buffer, this can have performance benefits
This commit is contained in:
parent
3c42cc8684
commit
4aae31ad5e
6 changed files with 15 additions and 2 deletions
|
@ -328,6 +328,8 @@ public:
|
|||
return 32;
|
||||
case ECF_D16:
|
||||
return 16;
|
||||
case ECF_D24:
|
||||
return 32;
|
||||
case ECF_D32:
|
||||
return 32;
|
||||
case ECF_D24S8:
|
||||
|
@ -378,6 +380,7 @@ public:
|
|||
{
|
||||
switch (format) {
|
||||
case ECF_D16:
|
||||
case ECF_D24:
|
||||
case ECF_D32:
|
||||
case ECF_D24S8:
|
||||
return true;
|
||||
|
|
|
@ -77,6 +77,9 @@ enum ECOLOR_FORMAT
|
|||
//! 16 bit format using 16 bits for depth.
|
||||
ECF_D16,
|
||||
|
||||
//! 32 bit(?) format using 24 bits for depth.
|
||||
ECF_D24,
|
||||
|
||||
//! 32 bit format using 32 bits for depth.
|
||||
ECF_D32,
|
||||
|
||||
|
@ -104,6 +107,7 @@ const c8 *const ColorFormatNames[ECF_UNKNOWN + 2] = {
|
|||
"R16",
|
||||
"R16G16",
|
||||
"D16",
|
||||
"D24",
|
||||
"D32",
|
||||
"D24S8",
|
||||
"UNKNOWN",
|
||||
|
|
|
@ -59,6 +59,7 @@ void COpenGL3Driver::initFeatures()
|
|||
TextureFormats[ECF_R16] = {GL_R16, GL_RED, GL_UNSIGNED_SHORT};
|
||||
TextureFormats[ECF_R16G16] = {GL_RG16, GL_RG, GL_UNSIGNED_SHORT};
|
||||
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 (?!)
|
||||
TextureFormats[ECF_D24S8] = {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8};
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ void COpenGLES2Driver::initFeatures()
|
|||
TextureFormats[ECF_R8] = {GL_R8, GL_RED, GL_UNSIGNED_BYTE};
|
||||
TextureFormats[ECF_R8G8] = {GL_RG8, GL_RG, GL_UNSIGNED_BYTE};
|
||||
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};
|
||||
|
||||
if (FeatureAvailable[IRR_GL_EXT_texture_format_BGRA8888])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue