Skip to content

Commit

Permalink
Fixed regression introduced in 4fcef89 causing EXT_texture_edge_clamp…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
binary1248 authored and eXpl0it3r committed Apr 14, 2021
1 parent c0b1910 commit 43b2e9d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/SFML/Graphics/GLExtensions.hpp
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/SFML/Graphics/Texture.cpp
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/SFML/Window/Win32/WglContext.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit 43b2e9d

Please sign in to comment.