From 3f674f7ef6031f21f547a8812c4d87d199f34821 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 15 Dec 2013 18:23:47 -0800 Subject: [PATCH] Always update framebuffer tex sampling params. Otherwise they are not always correct and cause glitches. --- GPU/GLES/TextureCache.cpp | 3 ++- Windows/GEDebugger/VertexPreview.cpp | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/GPU/GLES/TextureCache.cpp b/GPU/GLES/TextureCache.cpp index 5e7efa505b..c79f68261e 100644 --- a/GPU/GLES/TextureCache.cpp +++ b/GPU/GLES/TextureCache.cpp @@ -835,7 +835,8 @@ void TextureCache::SetTextureFramebuffer(TexCacheEntry *entry) glBindTexture(GL_TEXTURE_2D, 0); gstate_c.skipDrawReason |= SKIPDRAW_BAD_FB_TEXTURE; } - UpdateSamplingParams(*entry, false); + // We need to force it, since we may have set it on a texture before attaching. + UpdateSamplingParams(*entry, true); gstate_c.curTextureWidth = entry->framebuffer->width; gstate_c.curTextureHeight = entry->framebuffer->height; gstate_c.flipTexture = true; diff --git a/Windows/GEDebugger/VertexPreview.cpp b/Windows/GEDebugger/VertexPreview.cpp index b52217bc98..a17ae66fb5 100644 --- a/Windows/GEDebugger/VertexPreview.cpp +++ b/Windows/GEDebugger/VertexPreview.cpp @@ -211,6 +211,19 @@ void CGEDebugger::UpdatePrimPreview(u32 op) { glScissor(x, y, fw, fh); BindPreviewProgram(texPreviewProgram); + // TODO: Probably there's a better way and place to do this. + if (indices.empty()) { + for (int i = 0; i < count; ++i) { + vertices[i].u -= floor(vertices[i].u); + vertices[i].v -= floor(vertices[i].v); + } + } else { + for (int i = 0; i < count; ++i) { + vertices[indices[i]].u -= floor(vertices[indices[i]].u); + vertices[indices[i]].v -= floor(vertices[indices[i]].v); + } + } + ortho.setOrtho(0.0, 1.0, 1.0, 0.0, -1.0, 1.0); glUniformMatrix4fv(texPreviewProgram->u_viewproj, 1, GL_FALSE, ortho.getReadPtr()); glEnableVertexAttribArray(texPreviewProgram->a_position);