From 68d0bcde6fdc0ef5243b8cabf0f83bb62deb8f30 Mon Sep 17 00:00:00 2001 From: Jannik Vogel Date: Fri, 7 Aug 2015 19:36:23 +0200 Subject: [PATCH 1/2] Clear framebuffers so we don't have different sizes per attachment --- hw/xbox/nv2a.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/hw/xbox/nv2a.c b/hw/xbox/nv2a.c index 34917a0fd1..3e606c8d7d 100644 --- a/hw/xbox/nv2a.c +++ b/hw/xbox/nv2a.c @@ -3407,6 +3407,30 @@ static void pgraph_update_surface(NV2AState *d, pg->surface_color.buffer_dirty = true; pg->surface_zeta.buffer_dirty = true; + glFramebufferTexture2D(GL_FRAMEBUFFER, + GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, + 0, 0); + + if (pg->gl_color_buffer) { + glDeleteTextures(1, &pg->gl_color_buffer); + pg->gl_color_buffer = 0; + } + + glFramebufferTexture2D(GL_FRAMEBUFFER, + GL_DEPTH_ATTACHMENT, + GL_TEXTURE_2D, + 0, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, + GL_DEPTH_STENCIL_ATTACHMENT, + GL_TEXTURE_2D, + 0, 0); + + if (pg->gl_zeta_buffer) { + glDeleteTextures(1, &pg->gl_zeta_buffer); + pg->gl_zeta_buffer = 0; + } + memcpy(&pg->last_surface_shape, &pg->surface_shape, sizeof(SurfaceShape)); } From 609a4cf423218aeab06ffdcfaf9084482a58e77c Mon Sep 17 00:00:00 2001 From: Jannik Vogel Date: Fri, 7 Aug 2015 19:44:16 +0200 Subject: [PATCH 2/2] Add FIXME about possible bug with CLEAR --- hw/xbox/nv2a.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/xbox/nv2a.c b/hw/xbox/nv2a.c index 3e606c8d7d..e69c415f69 100644 --- a/hw/xbox/nv2a.c +++ b/hw/xbox/nv2a.c @@ -3379,6 +3379,7 @@ static bool pgraph_zeta_write_enabled(PGRAPHState *pg) static void pgraph_set_surface_dirty(PGRAPHState *pg, bool color, bool zeta) { + /* FIXME: Does this apply to CLEARs too? */ color = color && pgraph_color_write_enabled(pg); zeta = zeta && pgraph_zeta_write_enabled(pg); pg->surface_color.draw_dirty |= color; @@ -3397,6 +3398,7 @@ static void pgraph_update_surface(NV2AState *d, pgraph_get_surface_dimensions(pg, &width, &height); pgraph_apply_anti_aliasing_factor(pg, &width, &height); + /* FIXME: Does this apply to CLEARs too? */ color = color && pgraph_color_write_enabled(pg); zeta = zeta && pgraph_zeta_write_enabled(pg);