diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-05-10 23:03:24 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-05-10 23:03:24 +0000 |
| commit | 2269ddcf7ec67b72ddd2b192716cf5a468fd1a23 (patch) | |
| tree | 79bbb415170235283f93a4bcf1cc86d6f1c456f3 /Graphics/GraphicsEngineOpenGL | |
| parent | GL backend: updated GetTextureDescFromGLHandle function to handle query errors (diff) | |
| download | DiligentCore-2269ddcf7ec67b72ddd2b192716cf5a468fd1a23.tar.gz DiligentCore-2269ddcf7ec67b72ddd2b192716cf5a468fd1a23.zip | |
GL backend: fixed GetTextureInternalFormat function to allow texture fromat query failure (to spport GL_TEXTURE_EXTERNAL_OES)
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
| -rw-r--r-- | Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp b/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp index 27c94eb0..06e49cd6 100644 --- a/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp @@ -126,15 +126,32 @@ static GLenum GetTextureInternalFormat(GLContextState& GLState, GLenum BindTarge GLint GlFormat = 0; #if GL_TEXTURE_INTERNAL_FORMAT glGetTexLevelParameteriv(QueryBindTarget, 0, GL_TEXTURE_INTERNAL_FORMAT, &GlFormat); - CHECK_GL_ERROR("Failed to get texture format through glGetTexLevelParameteriv()"); - VERIFY(GlFormat != 0, "Unable to get texture format"); - VERIFY(TexFmtFromDesc == TEX_FORMAT_UNKNOWN || static_cast<GLenum>(GlFormat) == TexFormatToGLInternalTexFormat(TexFmtFromDesc), "Texture format does not match the format specified by the texture description"); + if (glGetError() == GL_NO_ERROR && GlFormat != 0) + { + VERIFY(TexFmtFromDesc == TEX_FORMAT_UNKNOWN || static_cast<GLenum>(GlFormat) == TexFormatToGLInternalTexFormat(TexFmtFromDesc), "Texture format does not match the format specified by the texture description"); + } + else + { + if (TexFmtFromDesc != TEX_FORMAT_UNKNOWN) + { + GlFormat = TexFormatToGLInternalTexFormat(TexFmtFromDesc); + } + else + { + LOG_WARNING_MESSAGE("Unable to query internal texture format while the format specified by texture description is TEX_FORMAT_UNKNOWN."); + } + } #else if (TexFmtFromDesc != TEX_FORMAT_UNKNOWN) + { GlFormat = TexFormatToGLInternalTexFormat(TexFmtFromDesc); + } else - UNSUPPORTED("Texture format cannot be queried and must be provided by the texture description"); + { + LOG_WARNING_MESSAGE("Texture format query is not supported while the format specified by texture description is TEX_FORMAT_UNKNOWN."); + } #endif + GLState.BindTexture(-1, BindTarget, GLObjectWrappers::GLTextureObj::Null()); return GlFormat; |
