gl: (lr) black screen when vmu display is on
need to call glBindVertexArray(0) to avoid VAO being modified by the frontend
This commit is contained in:
parent
52d95e537c
commit
fd50529d86
|
@ -434,12 +434,10 @@ void termGLCommon()
|
|||
|
||||
static void gles_term()
|
||||
{
|
||||
#ifndef GLES2
|
||||
glDeleteVertexArrays(1, &gl.vbo.mainVAO);
|
||||
deleteVertexArray(gl.vbo.mainVAO);
|
||||
gl.vbo.mainVAO = 0;
|
||||
glDeleteVertexArrays(1, &gl.vbo.modvolVAO);
|
||||
deleteVertexArray(gl.vbo.modvolVAO);
|
||||
gl.vbo.modvolVAO = 0;
|
||||
#endif
|
||||
glDeleteBuffers(1, &gl.vbo.geometry);
|
||||
gl.vbo.geometry = 0;
|
||||
glDeleteBuffers(1, &gl.vbo.modvols);
|
||||
|
@ -793,10 +791,7 @@ static void SetupOSDVBO()
|
|||
|
||||
glDisableVertexAttribArray(VERTEX_COL_OFFS_ARRAY);
|
||||
glCheck();
|
||||
#ifndef GLES2
|
||||
if (gl.gl_major >= 3)
|
||||
glBindVertexArray(0);
|
||||
#endif
|
||||
bindVertexArray(0);
|
||||
}
|
||||
|
||||
void gl_load_osd_resources()
|
||||
|
@ -843,10 +838,8 @@ void gl_free_osd_resources()
|
|||
}
|
||||
glDeleteBuffers(1, &gl.OSD_SHADER.geometry);
|
||||
gl.OSD_SHADER.geometry = 0;
|
||||
#ifndef GLES2
|
||||
glDeleteVertexArrays(1, &gl.OSD_SHADER.vao);
|
||||
deleteVertexArray(gl.OSD_SHADER.vao);
|
||||
gl.OSD_SHADER.vao = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void create_modvol_shader()
|
||||
|
@ -1090,13 +1083,10 @@ void OSD_DRAW(bool clear_screen)
|
|||
|
||||
glCheck();
|
||||
imguiDriver->setFrameRendered();
|
||||
#ifndef GLES2
|
||||
if (gl.gl_major >= 3)
|
||||
glBindVertexArray(0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
bindVertexArray(0);
|
||||
}
|
||||
|
||||
bool OpenGLRenderer::Process(TA_context* ctx)
|
||||
|
@ -1352,10 +1342,7 @@ bool RenderFrame(int width, int height)
|
|||
else
|
||||
render_output_framebuffer();
|
||||
#endif
|
||||
#ifndef GLES2
|
||||
if (gl.gl_major >= 3)
|
||||
glBindVertexArray(0);
|
||||
#endif
|
||||
bindVertexArray(0);
|
||||
|
||||
return !is_rtt;
|
||||
}
|
||||
|
|
|
@ -329,3 +329,19 @@ public:
|
|||
extern "C" struct retro_hw_render_callback hw_render;
|
||||
void termVmuLightgun();
|
||||
#endif
|
||||
|
||||
inline static void bindVertexArray(GLuint vao)
|
||||
{
|
||||
#ifndef GLES2
|
||||
if (gl.gl_major >= 3)
|
||||
glBindVertexArray(vao);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline static void deleteVertexArray(GLuint vao)
|
||||
{
|
||||
#ifndef GLES2
|
||||
if (gl.gl_major >= 3)
|
||||
glDeleteVertexArrays(1, &vao);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -279,10 +279,7 @@ void PostProcessor::term()
|
|||
depthBuffer = 0;
|
||||
glDeleteBuffers(1, &vertexBuffer);
|
||||
vertexBuffer = 0;
|
||||
#ifndef GLES2
|
||||
if (vertexArray != 0)
|
||||
glDeleteVertexArrays(1, &vertexArray);
|
||||
#endif
|
||||
deleteVertexArray(vertexArray);
|
||||
vertexArray = 0;
|
||||
PostProcessShader::term();
|
||||
glCheck();
|
||||
|
@ -311,11 +308,9 @@ void PostProcessor::render(GLuint output_fbo)
|
|||
glcache.Disable(GL_BLEND);
|
||||
|
||||
PostProcessShader::select(FB_W_CTRL.fb_dither, SPG_CONTROL.interlace, FB_R_CTRL.vclk_div == 1 && SPG_CONTROL.interlace == 0);
|
||||
#ifndef GLES2
|
||||
if (vertexArray != 0)
|
||||
glBindVertexArray(vertexArray);
|
||||
bindVertexArray(vertexArray);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 3, (void*)0);
|
||||
|
@ -332,7 +327,5 @@ void PostProcessor::render(GLuint output_fbo)
|
|||
glcache.ClearColor(0.f, 0.f, 0.f, 0.f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
#ifndef GLES2
|
||||
glBindVertexArray(0);
|
||||
#endif
|
||||
bindVertexArray(0);
|
||||
}
|
||||
|
|
|
@ -51,14 +51,6 @@ static GLuint quadVertexArray;
|
|||
static GLuint quadBuffer;
|
||||
static GLuint quadIndexBuffer;
|
||||
|
||||
static void bindVAO(GLuint vao)
|
||||
{
|
||||
#ifndef GLES2
|
||||
if (gl.gl_major >= 3)
|
||||
glBindVertexArray(vao);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void setupVertexAttribs()
|
||||
{
|
||||
glEnableVertexAttribArray(VERTEX_POS_ARRAY);
|
||||
|
@ -112,11 +104,11 @@ void initQuad()
|
|||
#ifndef GLES2
|
||||
if (gl.gl_major >= 3)
|
||||
{
|
||||
bindVAO(quadVertexArray);
|
||||
bindVertexArray(quadVertexArray);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, quadBuffer);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, quadIndexBuffer);
|
||||
setupVertexAttribs();
|
||||
bindVAO(0);
|
||||
bindVertexArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
@ -139,9 +131,7 @@ void termQuad()
|
|||
}
|
||||
if (quadVertexArray != 0)
|
||||
{
|
||||
#ifndef GLES2
|
||||
glDeleteVertexArrays(1, &quadVertexArray);
|
||||
#endif
|
||||
deleteVertexArray(quadVertexArray);
|
||||
quadVertexArray = 0;
|
||||
}
|
||||
if (shader != 0)
|
||||
|
@ -178,10 +168,10 @@ void drawQuad(GLuint texId, bool rotate, bool swapY)
|
|||
if (gl.gl_major < 3)
|
||||
setupVertexAttribs();
|
||||
else
|
||||
bindVAO(quadVertexArray);
|
||||
bindVertexArray(quadVertexArray);
|
||||
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STREAM_DRAW);
|
||||
glDrawElements(GL_TRIANGLE_STRIP, 5, GL_UNSIGNED_SHORT, (GLvoid *)0);
|
||||
bindVAO(0);
|
||||
bindVertexArray(0);
|
||||
glCheck();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue