mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-21 10:20:21 +00:00
Fix crash in GLSL when overlays with many textures are used.
Have to call shader->use() for each set_coords or we overflow the attribs array cached buffer.
This commit is contained in:
parent
fc8ac5618d
commit
77a62573a2
7
gfx/gl.c
7
gfx/gl.c
@ -2522,9 +2522,6 @@ static void gl_render_overlay(void *data)
|
||||
1.0f, 1.0f, 1.0f, 1.0f,
|
||||
};
|
||||
|
||||
if (gl->shader)
|
||||
gl->shader->use(GL_SHADER_STOCK_BLEND);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
if (gl->overlay_full_screen)
|
||||
@ -2532,6 +2529,10 @@ static void gl_render_overlay(void *data)
|
||||
|
||||
for (i = 0; i < gl->overlays; i++)
|
||||
{
|
||||
// Ensure that we reset the attrib array.
|
||||
if (gl->shader)
|
||||
gl->shader->use(GL_SHADER_STOCK_BLEND);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, gl->overlay[i].tex);
|
||||
for (j = 0; j < 4; j++)
|
||||
white_color_mod[3 + j * 4] = gl->overlay[i].alpha_mod;
|
||||
|
@ -552,11 +552,16 @@ static void gl_glsl_set_attribs(GLuint vbo, GLfloat *buffer, size_t *buffer_elem
|
||||
for (i = 0; i < num_attrs; i++)
|
||||
{
|
||||
GLint loc = attrs[i].loc;
|
||||
glEnableVertexAttribArray(loc);
|
||||
gl_attribs[gl_attrib_index++] = loc;
|
||||
|
||||
glVertexAttribPointer(loc, attrs[i].size, GL_FLOAT, GL_FALSE, 0,
|
||||
(const GLvoid*)(uintptr_t)attrs[i].offset);
|
||||
if (gl_attrib_index < ARRAY_SIZE(gl_attribs))
|
||||
{
|
||||
glEnableVertexAttribArray(loc);
|
||||
glVertexAttribPointer(loc, attrs[i].size, GL_FLOAT, GL_FALSE, 0,
|
||||
(const GLvoid*)(uintptr_t)attrs[i].offset);
|
||||
gl_attribs[gl_attrib_index++] = loc;
|
||||
}
|
||||
else
|
||||
RARCH_WARN("Attrib array buffer was overflown!\n");
|
||||
}
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user