Skip to content

Commit

Permalink
reset vertex array when switching from hardware to non-hardware mode (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamiras authored Jul 16, 2020
1 parent 86ae41b commit a2e777c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/components/Video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,11 +595,14 @@ bool Video::ensureVertexArray(unsigned windowWidth, unsigned windowHeight, float
{ winScaleX, winScaleY, 0.0f, 0.0f}
};

if (_hw.enabled)
if (_vertexArray != 0)
{
if (_vertexArray != 0)
Gl::deleteVertexArrays(1, &_vertexArray);
Gl::deleteVertexArrays(1, &_vertexArray);
_vertexArray = 0;
}

if (_hw.enabled)
{
Gl::genVertexArray(1, &_vertexArray);
if (_vertexArray == 0)
return false;
Expand Down Expand Up @@ -673,8 +676,9 @@ GLuint Video::createTexture(unsigned width, unsigned height, retro_pixel_format

bool Video::ensureFramebuffer(unsigned width, unsigned height, retro_pixel_format pixelFormat, bool linearFilter)
{
const bool hwEnabled = (_hw.frameBuffer != 0);
if (_texture == 0
|| (_hw.enabled && _hw.frameBuffer == 0)
|| (_hw.enabled != hwEnabled)
|| width > _textureWidth || height > _textureHeight
|| pixelFormat != _pixelFormat
|| linearFilter != _linearFilter)
Expand Down

0 comments on commit a2e777c

Please sign in to comment.