Skip to content

Commit

Permalink
Fix some GL OSD black rectangle (#444)
Browse files Browse the repository at this point in the history
Ruffle was using glBindSampler() to change the sampler of a texture unit
so we switch back to default sampler for our OSD texture
  • Loading branch information
clementgallet committed Nov 20, 2021
1 parent 166d472 commit 852f740
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* Remove unused LIBTAS_HAS_XINPUT which broke XInput opcode (fix #430)
* Don't handle xcb events when 1x1 windows are created (#441)
* Fix flags when restoring a file mapping (#445)
* Fix some GL OSD black rectangle (#444)

## [1.4.2] - 2021-07-06
### Added
Expand Down
2 changes: 2 additions & 0 deletions src/library/glxwrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ DECLARE_ORIG_POINTER(glGetError)
DECLARE_ORIG_POINTER(glGenTextures)
DECLARE_ORIG_POINTER(glDeleteTextures)
DECLARE_ORIG_POINTER(glBindTexture)
DECLARE_ORIG_POINTER(glBindSampler)
DECLARE_ORIG_POINTER(glTexImage2D)
DECLARE_ORIG_POINTER(glActiveTexture)
DECLARE_ORIG_POINTER(glFramebufferTexture2D)
Expand Down Expand Up @@ -232,6 +233,7 @@ static void* store_orig_and_return_my_symbol(const GLubyte* symbol, void* real_p
STORE_SYMBOL(glGenTextures)
STORE_SYMBOL(glDeleteTextures)
STORE_SYMBOL(glBindTexture)
STORE_SYMBOL(glBindSampler)
STORE_SYMBOL(glTexImage2D)
STORE_SYMBOL(glActiveTexture)
STORE_SYMBOL(glFramebufferTexture2D)
Expand Down
1 change: 1 addition & 0 deletions src/library/openglwrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ DEFINE_ORIG_POINTER(glGetError)
DEFINE_ORIG_POINTER(glGenTextures)
DEFINE_ORIG_POINTER(glDeleteTextures)
DEFINE_ORIG_POINTER(glBindTexture)
DEFINE_ORIG_POINTER(glBindSampler)
DEFINE_ORIG_POINTER(glTexImage2D)
DEFINE_ORIG_POINTER(glActiveTexture)
DEFINE_ORIG_POINTER(glFramebufferTexture2D)
Expand Down
4 changes: 4 additions & 0 deletions src/library/renderhud/RenderHUD_GL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ DECLARE_ORIG_POINTER(glGetIntegerv)
DECLARE_ORIG_POINTER(glGenTextures)
DECLARE_ORIG_POINTER(glDeleteTextures)
DECLARE_ORIG_POINTER(glBindTexture)
DECLARE_ORIG_POINTER(glBindSampler)
DECLARE_ORIG_POINTER(glTexParameteri)
DECLARE_ORIG_POINTER(glTexImage2D)
DECLARE_ORIG_POINTER(glActiveTexture)
Expand Down Expand Up @@ -318,6 +319,7 @@ void RenderHUD_GL::renderSurface(std::unique_ptr<SurfaceARGB> surf, int x, int y
LINK_NAMESPACE(glIsEnabled, "GL");
LINK_NAMESPACE(glBlendFunc, "GL");
LINK_NAMESPACE(glBindTexture, "GL");
LINK_NAMESPACE(glBindSampler, "GL");
LINK_NAMESPACE(glTexImage2D, "GL");
LINK_NAMESPACE(glTexParameteri, "GL");
LINK_NAMESPACE(glUseProgram, "GL");
Expand Down Expand Up @@ -363,6 +365,8 @@ void RenderHUD_GL::renderSurface(std::unique_ptr<SurfaceARGB> surf, int x, int y
if ((error = orig::glGetError()) != GL_NO_ERROR)
debuglogstdio(LCF_WINDOW | LCF_OGL | LCF_ERROR, "glBindTexture failed with error %d", error);

orig::glBindSampler(0, 0);

orig::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
orig::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

Expand Down

0 comments on commit 852f740

Please sign in to comment.