Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use sized internal format for depth and depth+stencil formats. #1223

Open
wants to merge 1 commit into
base: new_master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions src/osg/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,22 @@
#define GL_RGB565 0x8D62
#endif

#ifndef GL_DEPTH32F_STENCIL8
#define GL_DEPTH32F_STENCIL8 0x8CAD
#endif

#ifndef GL_FLOAT_32_UNSIGNED_INT_24_8_REV
#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
#endif

#ifndef GL_DEPTH24_STENCIL8
#define GL_DEPTH24_STENCIL8 0x88F0
#endif

#ifndef GL_DEPTH_STENCIL_EXT
#define GL_DEPTH_STENCIL_EXT 0x84F9
#endif

#if 0
#define CHECK_CONSISTENCY checkConsistency();
#else
Expand Down Expand Up @@ -171,8 +187,8 @@ InternalPixelRelations sizedDepthAndStencilInternalFormats[] = {
, { GL_DEPTH_COMPONENT24 , GL_DEPTH_COMPONENT , GL_UNSIGNED_INT }
, { GL_DEPTH_COMPONENT32 , GL_DEPTH_COMPONENT , GL_UNSIGNED_INT }
, { GL_DEPTH_COMPONENT32F , GL_DEPTH_COMPONENT , GL_FLOAT }
// , { GL_DEPTH24_STENCIL8 , GL_DEPTH_STENCIL , GL_UNSIGNED_INT_24_8 }
// , { GL_DEPTH32F_STENCIL8 , GL_DEPTH_STENCIL , GL_FLOAT_32_UNSIGNED_INT_24_8_REV }
, { GL_DEPTH24_STENCIL8 , GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT }
, { GL_DEPTH32F_STENCIL8 , GL_DEPTH_STENCIL_EXT, GL_FLOAT_32_UNSIGNED_INT_24_8_REV }
};

InternalPixelRelations compressedInternalFormats[] = {
Expand Down Expand Up @@ -242,6 +258,14 @@ bool isSizedInternalFormat(GLint internalFormat)
return true;
}

const size_t depthStencilFormatsCount = sizeof(sizedDepthAndStencilInternalFormats) / sizeof(sizedDepthAndStencilInternalFormats[0]);

for (size_t i=0; i < depthStencilFormatsCount; ++i)
{
if((GLenum)internalFormat == sizedDepthAndStencilInternalFormats[i].sizedInternalFormat)
return true;
}

return false;
}

Expand Down