mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
Fix the Bed texture gone missing issue on AMD systems
patch picked from PrusaSlicer, thanks to Prusa3D 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. Change-Id: I679dd61efec8f4baf97e5bf4868cb93db5184dcf
This commit is contained in:
parent
bf927f5adc
commit
cb3c9503d0
3 changed files with 35 additions and 3 deletions
|
@ -771,7 +771,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;
|
||||
|
@ -800,8 +800,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