OpenGL: Only invalidate texture if dimensions change (fixes #1612)

This commit is contained in:
Vicki Pfau 2020-01-08 18:49:09 -08:00
parent ccdbcf6f0b
commit 7b08a3ebfd
3 changed files with 12 additions and 1 deletions

View File

@ -99,7 +99,7 @@ Other fixes:
- 3DS: Fix screen darkening (fixes mgba.io/i/1562) - 3DS: Fix screen darkening (fixes mgba.io/i/1562)
- Core: Fix uninitialized memory issues with graphics caches - Core: Fix uninitialized memory issues with graphics caches
- Core: Return null for out of bounds cached tile VRAM querying - Core: Return null for out of bounds cached tile VRAM querying
- Vita: Fix analog controls (fixes mgba.io/i/1554) - OpenGL: Only invalidate texture if dimensions change (fixes mgba.io/i/1612)
- Qt: Fix fast forward mute being reset (fixes mgba.io/i/1574) - Qt: Fix fast forward mute being reset (fixes mgba.io/i/1574)
- Qt: Fix scrollbar arrows in memory view (fixes mgba.io/i/1558) - Qt: Fix scrollbar arrows in memory view (fixes mgba.io/i/1558)
- Qt: Fix several cases where shader selections don't get saved - Qt: Fix several cases where shader selections don't get saved
@ -108,6 +108,7 @@ Other fixes:
- Qt: Fix undesired screen filtering when paused (fixes mgba.io/i/1602) - Qt: Fix undesired screen filtering when paused (fixes mgba.io/i/1602)
- Qt: Fix sprite view using wrong base address (fixes mgba.io/i/1603) - Qt: Fix sprite view using wrong base address (fixes mgba.io/i/1603)
- Qt: Fix inability to clear default keybindings - Qt: Fix inability to clear default keybindings
- Vita: Fix analog controls (fixes mgba.io/i/1554)
Misc: Misc:
- GB Memory: Support manual SRAM editing (fixes mgba.io/i/1580) - GB Memory: Support manual SRAM editing (fixes mgba.io/i/1580)
- GBA Audio: Redo channel 4 batching for GBA only - GBA Audio: Redo channel 4 batching for GBA only

View File

@ -24,6 +24,8 @@ static const GLint _glTexCoords[] = {
static void mGLContextInit(struct VideoBackend* v, WHandle handle) { static void mGLContextInit(struct VideoBackend* v, WHandle handle) {
UNUSED(handle); UNUSED(handle);
struct mGLContext* context = (struct mGLContext*) v; struct mGLContext* context = (struct mGLContext*) v;
v->width = 1;
v->height = 1;
glGenTextures(2, context->tex); glGenTextures(2, context->tex);
glBindTexture(GL_TEXTURE_2D, context->tex[0]); glBindTexture(GL_TEXTURE_2D, context->tex[0]);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
@ -42,6 +44,9 @@ static void mGLContextInit(struct VideoBackend* v, WHandle handle) {
static void mGLContextSetDimensions(struct VideoBackend* v, unsigned width, unsigned height) { static void mGLContextSetDimensions(struct VideoBackend* v, unsigned width, unsigned height) {
struct mGLContext* context = (struct mGLContext*) v; struct mGLContext* context = (struct mGLContext*) v;
if (width == v->width && height == v->height) {
return;
}
v->width = width; v->width = width;
v->height = height; v->height = height;

View File

@ -98,6 +98,8 @@ static const GLfloat _vertices[] = {
static void mGLES2ContextInit(struct VideoBackend* v, WHandle handle) { static void mGLES2ContextInit(struct VideoBackend* v, WHandle handle) {
UNUSED(handle); UNUSED(handle);
struct mGLES2Context* context = (struct mGLES2Context*) v; struct mGLES2Context* context = (struct mGLES2Context*) v;
v->width = 1;
v->height = 1;
glGenTextures(1, &context->tex); glGenTextures(1, &context->tex);
glBindTexture(GL_TEXTURE_2D, context->tex); glBindTexture(GL_TEXTURE_2D, context->tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
@ -172,6 +174,9 @@ static void mGLES2ContextInit(struct VideoBackend* v, WHandle handle) {
static void mGLES2ContextSetDimensions(struct VideoBackend* v, unsigned width, unsigned height) { static void mGLES2ContextSetDimensions(struct VideoBackend* v, unsigned width, unsigned height) {
struct mGLES2Context* context = (struct mGLES2Context*) v; struct mGLES2Context* context = (struct mGLES2Context*) v;
if (width == v->width && height == v->height) {
return;
}
v->width = width; v->width = width;
v->height = height; v->height = height;