diff --git a/GPU/Common/VertexDecoderX86.cpp b/GPU/Common/VertexDecoderX86.cpp index 4f72740068..0db6364af2 100644 --- a/GPU/Common/VertexDecoderX86.cpp +++ b/GPU/Common/VertexDecoderX86.cpp @@ -107,7 +107,7 @@ static const JitLookup jitLookup[] = { {&VertexDecoder::Step_TcFloatPrescale, &VertexDecoderJitCache::Jit_TcFloatPrescale}, {&VertexDecoder::Step_TcU16Through, &VertexDecoderJitCache::Jit_TcU16Through}, -// {&VertexDecoder::Step_TcU16ThroughToFloat, &VertexDecoderJitCache::Jit_TcU16ThroughToFloat}, + {&VertexDecoder::Step_TcU16ThroughToFloat, &VertexDecoderJitCache::Jit_TcU16ThroughToFloat}, {&VertexDecoder::Step_TcFloatThrough, &VertexDecoderJitCache::Jit_TcFloatThrough}, {&VertexDecoder::Step_TcU16ThroughDouble, &VertexDecoderJitCache::Jit_TcU16ThroughDouble}, @@ -874,12 +874,27 @@ void VertexDecoderJitCache::Jit_TcU16Through() { void VertexDecoderJitCache::Jit_TcU16ThroughToFloat() { PXOR(fpScratchReg2, R(fpScratchReg2)); - MOVD_xmm(fpScratchReg, MDisp(srcReg, dec_->tcoff)); + MOV(32, R(tempReg1), MDisp(srcReg, dec_->tcoff)); + MOVD_xmm(fpScratchReg, R(tempReg1)); PUNPCKLWD(fpScratchReg, R(fpScratchReg2)); CVTDQ2PS(fpScratchReg, R(fpScratchReg)); MOVQ_xmm(MDisp(dstReg, dec_->decFmt.uvoff), fpScratchReg); - // TODO: This is missing updateSide! + MOV(32, R(tempReg2), R(tempReg1)); + SHR(32, R(tempReg2), Imm8(16)); + + auto updateSide = [&](X64Reg r, CCFlags skipCC, u16 *value) { + CMP(16, R(r), M(value)); + FixupBranch skip = J_CC(skipCC); + MOV(16, M(value), R(r)); + SetJumpTarget(skip); + }; + + // TODO: Can this actually be fast? Hmm, floats aren't better. + updateSide(tempReg1, CC_GE, &gstate_c.vertBounds.minU); + updateSide(tempReg1, CC_LE, &gstate_c.vertBounds.maxU); + updateSide(tempReg2, CC_GE, &gstate_c.vertBounds.minV); + updateSide(tempReg2, CC_LE, &gstate_c.vertBounds.maxV); } void VertexDecoderJitCache::Jit_TcU16ThroughDouble() { diff --git a/GPU/D3D11/FramebufferManagerD3D11.cpp b/GPU/D3D11/FramebufferManagerD3D11.cpp index d10069d679..a47c31d105 100644 --- a/GPU/D3D11/FramebufferManagerD3D11.cpp +++ b/GPU/D3D11/FramebufferManagerD3D11.cpp @@ -604,6 +604,7 @@ void FramebufferManagerD3D11::BindFramebufferAsColorTexture(int stage, VirtualFr } else if (framebuffer != currentRenderVfb_) { draw_->BindFramebufferAsTexture(framebuffer->fbo, stage, Draw::FB_COLOR_BIT, 0); } else { + ERROR_LOG_REPORT_ONCE(d3d11SelfTexture, G3D, "Attempting to texture to target"); // Badness on D3D11 to bind the currently rendered-to framebuffer as a texture. ID3D11ShaderResourceView *view = nullptr; context_->PSSetShaderResources(stage, 1, &view); diff --git a/GPU/GLES/StencilBufferGLES.cpp b/GPU/GLES/StencilBufferGLES.cpp index 4e7e576c41..1afa6c068e 100644 --- a/GPU/GLES/StencilBufferGLES.cpp +++ b/GPU/GLES/StencilBufferGLES.cpp @@ -203,8 +203,6 @@ bool FramebufferManagerGLES::NotifyStencilUpload(u32 addr, int size, bool skipZe // It's already zero, let's skip it. continue; } - // DrawActiveTexture unbinds it, so rebind here before setting uniforms. - glsl_bind(stencilUploadProgram_); if (dstBuffer->format == GE_FORMAT_4444) { glstate.stencilMask.set((i << 4) | i); glUniform1f(u_stencilValue, i * (16.0f / 255.0f)); diff --git a/Windows/GPU/WindowsGLContext.cpp b/Windows/GPU/WindowsGLContext.cpp index 80bd7e495c..6309551475 100644 --- a/Windows/GPU/WindowsGLContext.cpp +++ b/Windows/GPU/WindowsGLContext.cpp @@ -20,6 +20,7 @@ #include "Common/Log.h" #include "Common/CommonWindows.h" #include "gfx/gl_common.h" +#include "gfx/gl_debug_log.h" #include "gfx_es2/gpu_features.h" #include "GL/gl.h" #include "GL/wglew.h" @@ -263,8 +264,6 @@ bool WindowsGLContext::Init(HINSTANCE hInst, HWND window, std::string *error_mes if (gl_extensions.IsCoreContext) glGetError(); - CheckGLExtensions(); - int contextFlags = g_Config.bGfxDebugOutput ? WGL_CONTEXT_DEBUG_BIT_ARB : 0; // Alright, now for the modernity. First try a 4.4, then 4.3, context, if that fails try 3.3. @@ -273,21 +272,21 @@ bool WindowsGLContext::Init(HINSTANCE hInst, HWND window, std::string *error_mes WGL_CONTEXT_MAJOR_VERSION_ARB, 4, WGL_CONTEXT_MINOR_VERSION_ARB, 4, WGL_CONTEXT_FLAGS_ARB, contextFlags, - WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, + WGL_CONTEXT_PROFILE_MASK_ARB, gl_extensions.IsCoreContext ? WGL_CONTEXT_CORE_PROFILE_BIT_ARB : WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, 0 }; const int attribs43[] = { WGL_CONTEXT_MAJOR_VERSION_ARB, 4, WGL_CONTEXT_MINOR_VERSION_ARB, 3, WGL_CONTEXT_FLAGS_ARB, contextFlags, - WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, + WGL_CONTEXT_PROFILE_MASK_ARB, gl_extensions.IsCoreContext ? WGL_CONTEXT_CORE_PROFILE_BIT_ARB : WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, 0 }; const int attribs33[] = { WGL_CONTEXT_MAJOR_VERSION_ARB, 3, WGL_CONTEXT_MINOR_VERSION_ARB, 3, WGL_CONTEXT_FLAGS_ARB, contextFlags, - WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, + WGL_CONTEXT_PROFILE_MASK_ARB, gl_extensions.IsCoreContext ? WGL_CONTEXT_CORE_PROFILE_BIT_ARB : WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, 0 }; @@ -316,6 +315,9 @@ bool WindowsGLContext::Init(HINSTANCE hInst, HWND window, std::string *error_mes *error_message = "Failed to re-initialize GLEW."; return false; } + // Unfortunately, glew will generate an invalid enum error, ignore. + if (gl_extensions.IsCoreContext) + glGetError(); if (!m_hrc) { *error_message = "No m_hrc"; @@ -364,6 +366,7 @@ bool WindowsGLContext::Init(HINSTANCE hInst, HWND window, std::string *error_mes CheckGLExtensions(); draw_ = Draw::T3DCreateGLContext(); + CHECK_GL_ERROR_IF_DEBUG(); return true; // Success } diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index e4db6b6694..2b88acc7c1 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -1292,8 +1292,4 @@ namespace MainWindow { } return FALSE; } - - void ChangeMenu() { - SetIngameMenuItemStates(GetMenu(GetHWND()), UISTATE_INGAME); - } } diff --git a/Windows/MainWindowMenu.h b/Windows/MainWindowMenu.h index 7351b9be5b..03e04baf18 100644 --- a/Windows/MainWindowMenu.h +++ b/Windows/MainWindowMenu.h @@ -10,5 +10,4 @@ namespace MainWindow { void BrowseAndBoot(std::string defaultPath, bool browseDirectory = false); void BrowseAndBootDone(); void setTexScalingMultiplier(int level); - void ChangeMenu(); } diff --git a/ext/native/gfx/gl_debug_log.cpp b/ext/native/gfx/gl_debug_log.cpp index 4f313f62f8..e72e286e7f 100644 --- a/ext/native/gfx/gl_debug_log.cpp +++ b/ext/native/gfx/gl_debug_log.cpp @@ -11,6 +11,7 @@ std::string GLEnumToString(uint16_t value) { case GL_UNSIGNED_SHORT_4_4_4_4: return "GL_UNSIGNED_SHORT_4_4_4_4"; case GL_UNSIGNED_SHORT_5_5_5_1: return "GL_UNSIGNED_SHORT_5_5_5_1"; case GL_UNSIGNED_SHORT_5_6_5: return "GL_UNSIGNED_SHORT_5_6_5"; + case GL_UNSIGNED_BYTE: return "GL_UNSIGNED_BYTE"; case GL_RGBA: return "GL_RGBA"; case GL_RGB: return "GL_RGB"; #if !defined(USING_GLES2)