Browse Source

GL: avoid assertions due to random memory on shitty Intel Windows drivers.

This code path is not run there due to the newly added
"intel-windows-broken-dsa-for-cubemaps" workaround, but in case someone
disables it for testing purposes the code should not randomly blow up on
an assertion in compressedPixelFormatPack().
pull/331/head
Vladimír Vondruš 7 years ago
parent
commit
d18e1d9a54
  1. 24
      src/Magnum/GL/CubeMapTexture.cpp

24
src/Magnum/GL/CubeMapTexture.cpp

@ -223,8 +223,10 @@ void CubeMapTexture::compressedImage(const CubeMapCoordinate coordinate, const I
else else
dataSize = Magnum::Implementation::compressedImageDataSizeFor(image, size); dataSize = Magnum::Implementation::compressedImageDataSizeFor(image, size);
/* Internal texture format */ /* Internal texture format. Zero-init to avoid an assert about value
GLint format; already wrapped in compressedPixelFormatWrap() later if the drivers are
extra shitty (Intel Windows drivers, I'm talking about you). */
GLint format{};
(this->*Context::current().state().texture->getCubeLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format); (this->*Context::current().state().texture->getCubeLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format);
/* Reallocate only if needed */ /* Reallocate only if needed */
@ -254,8 +256,10 @@ void CubeMapTexture::compressedImage(const CubeMapCoordinate coordinate, const I
else else
dataSize = Magnum::Implementation::compressedImageDataSizeFor(image, size); dataSize = Magnum::Implementation::compressedImageDataSizeFor(image, size);
/* Internal texture format */ /* Internal texture format. Zero-init to avoid an assert about value
GLint format; already wrapped in compressedPixelFormatWrap() later if the drivers are
extra shitty (Intel Windows drivers, I'm talking about you). */
GLint format{};
(this->*Context::current().state().texture->getCubeLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format); (this->*Context::current().state().texture->getCubeLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format);
/* Reallocate only if needed */ /* Reallocate only if needed */
@ -287,8 +291,10 @@ BufferImage3D CubeMapTexture::subImage(const Int level, const Range3Di& range, B
void CubeMapTexture::compressedSubImage(const Int level, const Range3Di& range, CompressedImage3D& image) { void CubeMapTexture::compressedSubImage(const Int level, const Range3Di& range, CompressedImage3D& image) {
createIfNotAlready(); createIfNotAlready();
/* Internal texture format */ /* Internal texture format. Zero-init to avoid an assert about value
GLint format; already wrapped in compressedPixelFormatWrap() later if the drivers are
extra shitty (Intel Windows drivers, I'm talking about you). */
GLint format{};
(this->*Context::current().state().texture->getCubeLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format); (this->*Context::current().state().texture->getCubeLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format);
/* Calculate compressed subimage size. If the user-provided pixel storage /* Calculate compressed subimage size. If the user-provided pixel storage
@ -318,8 +324,10 @@ CompressedImage3D CubeMapTexture::compressedSubImage(const Int level, const Rang
void CubeMapTexture::compressedSubImage(const Int level, const Range3Di& range, CompressedBufferImage3D& image, const BufferUsage usage) { void CubeMapTexture::compressedSubImage(const Int level, const Range3Di& range, CompressedBufferImage3D& image, const BufferUsage usage) {
createIfNotAlready(); createIfNotAlready();
/* Internal texture format */ /* Internal texture format. Zero-init to avoid an assert about value
GLint format; already wrapped in compressedPixelFormatWrap() later if the drivers are
extra shitty (Intel Windows drivers, I'm talking about you). */
GLint format{};
(this->*Context::current().state().texture->getCubeLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format); (this->*Context::current().state().texture->getCubeLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format);
/* Calculate compressed subimage size. If the user-provided pixel storage /* Calculate compressed subimage size. If the user-provided pixel storage

Loading…
Cancel
Save