Fixed regression introduced in 4fcef89 causing EXT_texture_edge_clamp support to not be considered, added explicit initialization of nbFormats to 0 in WglContext.cpp in order to prevent broken graphics drivers from filling nbFormats with a garbage value.

Fixes #1786.
This commit is contained in:
binary1248 2021-04-14 04:15:33 +02:00 committed by Lukas Dürrenberger
parent c0b19109a9
commit 43b2e9dc12
3 changed files with 4 additions and 4 deletions

View File

@ -308,6 +308,8 @@
#define GLEXT_geometry_shader4 SF_GLAD_GL_ARB_geometry_shader4
#define GLEXT_GL_GEOMETRY_SHADER GL_GEOMETRY_SHADER_ARB
#endif
// OpenGL Versions
#define GLEXT_GL_VERSION_1_0 SF_GLAD_GL_VERSION_1_0
#define GLEXT_GL_VERSION_1_1 SF_GLAD_GL_VERSION_1_1
@ -329,8 +331,6 @@
#define GLEXT_GL_VERSION_4_5 SF_GLAD_GL_VERSION_4_5
#define GLEXT_GL_VERSION_4_6 SF_GLAD_GL_VERSION_4_6
#endif
namespace sf
{
namespace priv

View File

@ -162,7 +162,7 @@ bool Texture::create(unsigned int width, unsigned int height)
// Make sure that the current texture binding will be preserved
priv::TextureSaver save;
static bool textureEdgeClamp = GLEXT_texture_edge_clamp;
static bool textureEdgeClamp = GLEXT_texture_edge_clamp || GLEXT_GL_VERSION_1_2 || Context::isExtensionAvailable("GL_EXT_texture_edge_clamp");
if (!m_isRepeated && !textureEdgeClamp)
{

View File

@ -295,7 +295,7 @@ int WglContext::selectBestPixelFormat(HDC deviceContext, unsigned int bitsPerPix
// Let's check how many formats are supporting our requirements
int formats[512];
UINT nbFormats;
UINT nbFormats = 0; // We must initialize to 0 otherwise broken drivers might fill with garbage in the following call
bool isValid = wglChoosePixelFormatARB(deviceContext, intAttributes, NULL, 512, formats, &nbFormats) != FALSE;
if (!isValid)