Windows specific: Use mipmaps generated through OpenGL for AMD graphics cards with drivers newer than 22.6.1.
Since AMD driver version 22.7.1, there is probably some bug in the driver that causes the issue with the missing texture of the bed. It seems that this issue only triggers when mipmaps are generated manually (combined with a texture compression) and when mipmaps are generated through OpenGL glGenerateMipmap is working. This workaround detects the AMD driver version and generates mipmaps through OpenGL for driver versions newer than 22.6.1.
This commit is contained in:
parent
8c0db761c1
commit
9430387354
3 changed files with 35 additions and 3 deletions
|
@ -567,7 +567,7 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, boo
|
|||
else
|
||||
glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data()));
|
||||
|
||||
if (use_mipmaps) {
|
||||
if (use_mipmaps && OpenGLManager::use_manually_generated_mipmaps()) {
|
||||
// we manually generate mipmaps because glGenerateMipmap() function is not reliable on all graphics cards
|
||||
int lod_w = m_width;
|
||||
int lod_h = m_height;
|
||||
|
@ -596,8 +596,9 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, boo
|
|||
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, level));
|
||||
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR));
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else if (use_mipmaps && !OpenGLManager::use_manually_generated_mipmaps()) {
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
} else {
|
||||
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
|
||||
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue