From 799f0b4f7881bc36a4a061c1cacec0beacad4e6d Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 17 Jul 2018 17:04:50 +0200 Subject: [PATCH] glgsg: work around driver bug extracting buffer texture data Some drivers would report the wrong internal format. But it's silly that we query the internal format anyway, since buffer textures have a fixed sized internal format. --- panda/src/glstuff/glGraphicsStateGuardian_src.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 74080f274f..90bbaecf40 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -13442,7 +13442,14 @@ do_extract_texture_data(CLP(TextureContext) *gtc) { GLint internal_format = GL_RGBA; #ifndef OPENGLES - glGetTexLevelParameteriv(page_target, 0, GL_TEXTURE_INTERNAL_FORMAT, &internal_format); + if (target != GL_TEXTURE_BUFFER) { + glGetTexLevelParameteriv(page_target, 0, GL_TEXTURE_INTERNAL_FORMAT, &internal_format); + } else { + // Some drivers give the wrong result for the above call. No problem; we + // already know the internal format of a buffer texture since glTexBuffer + // required passing the exact sized format. + internal_format = gtc->_internal_format; + } #endif // OPENGLES // Make sure we were able to query those parameters properly.