Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rendering in dolphin #365

Merged
merged 2 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ static PFNGLRENDERBUFFERSTORAGEPROC s_glRenderbufferStorage;

static PFNGLBLENDEQUATIONEXTPROC s_glBlendEquationEXT;

static PFNGLBINDSAMPLERPROC s_glBindSampler;

static void* getProcAddress(const char* symbol)
{
void* address = SDL_GL_GetProcAddress(symbol);
Expand Down Expand Up @@ -179,6 +181,8 @@ void Gl::init(libretro::LoggerComponent* logger)
s_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)getProcAddress("glDeleteRenderbuffers");

s_glBlendEquationEXT = (PFNGLBLENDEQUATIONEXTPROC)getProcAddress("glBlendEquationEXT");

s_glBindSampler = (PFNGLBINDSAMPLERPROC)getProcAddress("glBindSampler");
}

bool Gl::ok()
Expand Down Expand Up @@ -600,3 +604,9 @@ void Gl::drawArrays(GLenum mode, GLint first, GLsizei count)
check(__FUNCTION__);
}

void Gl::bindSampler(GLuint unit, GLuint sampler)
{
if (!s_ok) return;
s_glBindSampler(unit, sampler);
check(__FUNCTION__);
}
2 changes: 2 additions & 0 deletions src/Gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ namespace Gl
void viewport(GLint x, GLint y, GLsizei width, GLsizei height);
void drawArrays(GLenum mode, GLint first, GLsizei count);

void bindSampler(GLuint unit, GLuint sampler);

int getVersion();
}

1 change: 1 addition & 0 deletions src/components/Video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,5 +787,6 @@ void Video::postHwRenderReset() const
Gl::disable(GL_BLEND);
Gl::blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Gl::blendEquation(GL_FUNC_ADD);
Gl::bindSampler(0, 0);
Gl::clearColor(0.0, 0.0, 0.0, 1.0);
}
4 changes: 4 additions & 0 deletions src/libretro/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,10 @@ bool libretro::Core::loadGame(const char* game_path, void* data, size_t size, st

void libretro::Core::destroy()
{
if (_needsHardwareRender && _hardwareRenderCallback.context_destroy) {
_hardwareRenderCallback.context_destroy();
}

if (_gameLoaded)
{
_core.unloadGame();
Expand Down