From 6e4a61a991a29f32367accc2aa8a6d1e575b2090 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Fri, 28 Sep 2012 23:19:50 +0200 Subject: Minor cleanups. --- Source/Core/VideoCommon/Src/RenderBase.cpp | 2 +- Source/Core/VideoCommon/Src/VideoConfig.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/RenderBase.cpp b/Source/Core/VideoCommon/Src/RenderBase.cpp index 0bd1c89118..bf0eaa79f9 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.cpp +++ b/Source/Core/VideoCommon/Src/RenderBase.cpp @@ -313,7 +313,7 @@ void Renderer::DrawDebugText() void Renderer::CalculateXYScale(const TargetRectangle& dst_rect) { - if (g_ActiveConfig.bUseXFB && g_ActiveConfig.bUseRealXFB) + if (g_ActiveConfig.RealXFBEnabled()) { xScale = 1.0f; yScale = 1.0f; diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h index 7653972ec8..da760e48b9 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.h +++ b/Source/Core/VideoCommon/Src/VideoConfig.h @@ -162,6 +162,12 @@ struct VideoConfig bool bSupportsFormatReinterpretation; bool bSupportsPixelLighting; } backend_info; + + // Utility + bool RealXFBEnabled() const { return bUseXFB && bUseRealXFB; } + bool VirtualXFBEnabled() const { return bUseXFB && !bUseRealXFB; } + bool EFBCopiesToTextureEnabled() const { return bEFBCopyEnable && bCopyEFBToTexture; } + bool EFBCopiesToRamEnabled() const { return bEFBCopyEnable && !bCopyEFBToTexture; } }; extern VideoConfig g_Config; -- cgit v1.2.3 From 035840e7b57d8056c1b8546aa5d2ae3a8b65d6e4 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Fri, 28 Sep 2012 23:48:18 +0200 Subject: Move last XFB size from Render to FramebufferManager. --- Source/Core/VideoCommon/Src/FramebufferManagerBase.cpp | 3 +++ Source/Core/VideoCommon/Src/FramebufferManagerBase.h | 8 ++++++++ Source/Core/VideoCommon/Src/RenderBase.cpp | 15 ++++++--------- Source/Core/VideoCommon/Src/RenderBase.h | 3 --- 4 files changed, 17 insertions(+), 12 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/FramebufferManagerBase.cpp b/Source/Core/VideoCommon/Src/FramebufferManagerBase.cpp index b234a7c865..fbb042c227 100644 --- a/Source/Core/VideoCommon/Src/FramebufferManagerBase.cpp +++ b/Source/Core/VideoCommon/Src/FramebufferManagerBase.cpp @@ -10,6 +10,9 @@ XFBSourceBase *FramebufferManagerBase::m_realXFBSource; // Only used in Real XFB FramebufferManagerBase::VirtualXFBListType FramebufferManagerBase::m_virtualXFBList; // Only used in Virtual XFB mode const XFBSourceBase* FramebufferManagerBase::m_overlappingXFBArray[MAX_VIRTUAL_XFB]; +unsigned int FramebufferManagerBase::s_last_xfb_width; +unsigned int FramebufferManagerBase::s_last_xfb_height; + FramebufferManagerBase::FramebufferManagerBase() { m_realXFBSource = NULL; diff --git a/Source/Core/VideoCommon/Src/FramebufferManagerBase.h b/Source/Core/VideoCommon/Src/FramebufferManagerBase.h index 26d360647d..a28a941e5b 100644 --- a/Source/Core/VideoCommon/Src/FramebufferManagerBase.h +++ b/Source/Core/VideoCommon/Src/FramebufferManagerBase.h @@ -50,6 +50,11 @@ public: static void CopyToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc,float Gamma); static const XFBSourceBase* const* GetXFBSource(u32 xfbAddr, u32 fbWidth, u32 fbHeight, u32 &xfbCount); + static void SetLastXfbWidth(unsigned int width) { s_last_xfb_width = width; } + static void SetLastXfbHeight(unsigned int height) { s_last_xfb_height = height; } + static unsigned int LastXfbWidth() { return s_last_xfb_width; } + static unsigned int LastXfbHeight() { return s_last_xfb_height; } + protected: struct VirtualXFB { @@ -85,6 +90,9 @@ private: static VirtualXFBListType m_virtualXFBList; // Only used in Virtual XFB mode static const XFBSourceBase* m_overlappingXFBArray[MAX_VIRTUAL_XFB]; + + static unsigned int s_last_xfb_width; + static unsigned int s_last_xfb_height; }; extern FramebufferManagerBase *g_framebuffer_manager; diff --git a/Source/Core/VideoCommon/Src/RenderBase.cpp b/Source/Core/VideoCommon/Src/RenderBase.cpp index bf0eaa79f9..d968ab5fbb 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.cpp +++ b/Source/Core/VideoCommon/Src/RenderBase.cpp @@ -71,9 +71,6 @@ int Renderer::s_backbuffer_height; float Renderer::xScale; float Renderer::yScale; -unsigned int Renderer::s_XFB_width; -unsigned int Renderer::s_XFB_height; - int Renderer::s_LastEFBScale; bool Renderer::s_skipSwap; @@ -121,14 +118,14 @@ void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRect VideoFifo_CheckSwapRequestAt(xfbAddr, fbWidth, fbHeight); XFBWrited = true; - // XXX: Without the VI, how would we know what kind of field this is? So - // just use progressive. if (g_ActiveConfig.bUseXFB) { FramebufferManagerBase::CopyToXFB(xfbAddr, fbWidth, fbHeight, sourceRc,Gamma); } else { + // XXX: Without the VI, how would we know what kind of field this is? So + // just use progressive. g_renderer->Swap(xfbAddr, FIELD_PROGRESSIVE, fbWidth, fbHeight,sourceRc,Gamma); Common::AtomicStoreRelease(s_swapRequested, false); } @@ -323,13 +320,13 @@ void Renderer::CalculateXYScale(const TargetRectangle& dst_rect) if (g_ActiveConfig.b3DVision) { // This works, yet the version in the else doesn't. No idea why. - xScale = (float)(s_backbuffer_width-1) / (float)(s_XFB_width-1); - yScale = (float)(s_backbuffer_height-1) / (float)(s_XFB_height-1); + xScale = (float)(s_backbuffer_width-1) / (float)(FramebufferManagerBase::LastXfbWidth()-1); + yScale = (float)(s_backbuffer_height-1) / (float)(FramebufferManagerBase::LastXfbHeight()-1); } else { - xScale = (float)(dst_rect.right - dst_rect.left - 1) / (float)(s_XFB_width-1); - yScale = (float)(dst_rect.bottom - dst_rect.top - 1) / (float)(s_XFB_height-1); + xScale = (float)(dst_rect.right - dst_rect.left - 1) / (float)(FramebufferManagerBase::LastXfbWidth()-1); + yScale = (float)(dst_rect.bottom - dst_rect.top - 1) / (float)(FramebufferManagerBase::LastXfbHeight()-1); } } } diff --git a/Source/Core/VideoCommon/Src/RenderBase.h b/Source/Core/VideoCommon/Src/RenderBase.h index e8d4c55a20..7f5e4743e6 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.h +++ b/Source/Core/VideoCommon/Src/RenderBase.h @@ -163,9 +163,6 @@ protected: static float xScale; static float yScale; - static unsigned int s_XFB_width; - static unsigned int s_XFB_height; - // can probably eliminate this static var static int s_LastEFBScale; -- cgit v1.2.3 From 5230146c7341eec2e541405043a2aa385d206a12 Mon Sep 17 00:00:00 2001 From: "rodolfoosvaldobogado@gmail.com" Date: Sat, 20 Oct 2012 10:22:15 -0300 Subject: Hey, long time no commits :). So to compensate lets bring back some speed to the emulation. change a little the way the vertex are send to the gpu, This first implementation changes dx9 a lot and dx11 a little to increase the parallelism between the cpu and gpu. ogl: is my next step in ogl is a little more trickier so i have to take a little more time. the original concept is Marcos idea, with my little touch to make it even more faster. what to look for: SPEEEEEDDD :). please test it a lot and let me know if you see any problem. in dx9 the code is prepared to fall back to the previous implementation if your card does not support the amount of buffers needed. So if you did not experience any speed gains you know where is the problem :). for the ones with more experience and compression of the code please test changing the amount and size of the buffers to tune this for your specific machine. The current values are the sweet spot for my machine. All must Thanks Marcos, I hate him for giving good ideas when I'm full of work. --- Source/Core/VideoCommon/Src/VertexManagerBase.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/VertexManagerBase.h b/Source/Core/VideoCommon/Src/VertexManagerBase.h index bc30fa3fba..f3a4aa72e3 100644 --- a/Source/Core/VideoCommon/Src/VertexManagerBase.h +++ b/Source/Core/VideoCommon/Src/VertexManagerBase.h @@ -21,7 +21,7 @@ public: // values from DX11 backend MAXVBUFFERSIZE = 0x50000, - MAXIBUFFERSIZE = 0x10000, + MAXIBUFFERSIZE = 0xFFFF, }; VertexManager(); @@ -46,7 +46,8 @@ public: static u8* GetVertexBuffer() { return LocalVBuffer; } static void DoState(PointerWrap& p); - + virtual void CreateDeviceObjects(){}; + virtual void DestroyDeviceObjects(){}; protected: // TODO: make private after Flush() is merged static void ResetBuffer(); -- cgit v1.2.3 From 5133ac551b60ae0bfa635e2b2abc161efb823479 Mon Sep 17 00:00:00 2001 From: rog Date: Tue, 23 Oct 2012 01:52:50 -0400 Subject: merge relevant changes from bc61dbdf58a8 in otu0001-desync-fix clone --- Source/Core/VideoCommon/VideoCommon.vcxproj | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/VideoCommon.vcxproj b/Source/Core/VideoCommon/VideoCommon.vcxproj index 0869f33ff4..bf9122e6b5 100644 --- a/Source/Core/VideoCommon/VideoCommon.vcxproj +++ b/Source/Core/VideoCommon/VideoCommon.vcxproj @@ -111,7 +111,8 @@ ..\Common\Src;..\Core\Src;..\..\..\Externals\SOIL;..\..\..\Externals\CLRun\include;%(AdditionalIncludeDirectories) - + false + true @@ -129,7 +130,7 @@ ..\Common\Src;..\Core\Src;..\..\..\Externals\SOIL;..\..\..\Externals\CLRun\include;%(AdditionalIncludeDirectories) - true + false true @@ -141,7 +142,8 @@ ..\Common\Src;..\Core\Src;..\..\..\Externals\SOIL;..\..\..\Externals\CLRun\include;%(AdditionalIncludeDirectories) - + false + true true -- cgit v1.2.3 From 78031c2d54b4acbca14747c57572b34e2530e474 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Sat, 29 Sep 2012 00:04:55 +0200 Subject: Move ComputeDrawRectangle() to Renderer::UpdateDrawRectangle(). --- Source/Core/VideoCommon/Src/RenderBase.cpp | 123 ++++++++++++++++++++++++++++ Source/Core/VideoCommon/Src/RenderBase.h | 6 ++ Source/Core/VideoCommon/Src/VideoConfig.cpp | 122 --------------------------- Source/Core/VideoCommon/Src/VideoConfig.h | 2 - 4 files changed, 129 insertions(+), 124 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/RenderBase.cpp b/Source/Core/VideoCommon/Src/RenderBase.cpp index d968ab5fbb..84eac4ec7f 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.cpp +++ b/Source/Core/VideoCommon/Src/RenderBase.cpp @@ -71,6 +71,8 @@ int Renderer::s_backbuffer_height; float Renderer::xScale; float Renderer::yScale; +TargetRectangle Renderer::target_rc; + int Renderer::s_LastEFBScale; bool Renderer::s_skipSwap; @@ -331,6 +333,127 @@ void Renderer::CalculateXYScale(const TargetRectangle& dst_rect) } } +// TODO: remove +extern bool g_aspect_wide; + +void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height) +{ + float FloatGLWidth = (float)backbuffer_width; + float FloatGLHeight = (float)backbuffer_height; + float FloatXOffset = 0; + float FloatYOffset = 0; + + // The rendering window size + const float WinWidth = FloatGLWidth; + const float WinHeight = FloatGLHeight; + + // Handle aspect ratio. + // Default to auto. + bool use16_9 = g_aspect_wide; + + // Update aspect ratio hack values + // Won't take effect until next frame + // Don't know if there is a better place for this code so there isn't a 1 frame delay + if ( g_ActiveConfig.bWidescreenHack ) + { + float source_aspect = use16_9 ? (16.0f / 9.0f) : (4.0f / 3.0f); + float target_aspect; + + switch ( g_ActiveConfig.iAspectRatio ) + { + case ASPECT_FORCE_16_9 : + target_aspect = 16.0f / 9.0f; + break; + case ASPECT_FORCE_4_3 : + target_aspect = 4.0f / 3.0f; + break; + case ASPECT_STRETCH : + target_aspect = WinWidth / WinHeight; + break; + default : + // ASPECT_AUTO == no hacking + target_aspect = source_aspect; + break; + } + + float adjust = source_aspect / target_aspect; + if ( adjust > 1 ) + { + // Vert+ + g_Config.fAspectRatioHackW = 1; + g_Config.fAspectRatioHackH = 1/adjust; + } + else + { + // Hor+ + g_Config.fAspectRatioHackW = adjust; + g_Config.fAspectRatioHackH = 1; + } + } + else + { + // Hack is disabled + g_Config.fAspectRatioHackW = 1; + g_Config.fAspectRatioHackH = 1; + } + + // Check for force-settings and override. + if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_16_9) + use16_9 = true; + else if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_4_3) + use16_9 = false; + + if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH) + { + // The rendering window aspect ratio as a proportion of the 4:3 or 16:9 ratio + float Ratio = (WinWidth / WinHeight) / (!use16_9 ? (4.0f / 3.0f) : (16.0f / 9.0f)); + // Check if height or width is the limiting factor. If ratio > 1 the picture is too wide and have to limit the width. + if (Ratio > 1.0f) + { + // Scale down and center in the X direction. + FloatGLWidth /= Ratio; + FloatXOffset = (WinWidth - FloatGLWidth) / 2.0f; + } + // The window is too high, we have to limit the height + else + { + // Scale down and center in the Y direction. + FloatGLHeight *= Ratio; + FloatYOffset = FloatYOffset + (WinHeight - FloatGLHeight) / 2.0f; + } + } + + // ----------------------------------------------------------------------- + // Crop the picture from 4:3 to 5:4 or from 16:9 to 16:10. + // Output: FloatGLWidth, FloatGLHeight, FloatXOffset, FloatYOffset + // ------------------ + if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH && g_ActiveConfig.bCrop) + { + float Ratio = !use16_9 ? ((4.0f / 3.0f) / (5.0f / 4.0f)) : (((16.0f / 9.0f) / (16.0f / 10.0f))); + // The width and height we will add (calculate this before FloatGLWidth and FloatGLHeight is adjusted) + float IncreasedWidth = (Ratio - 1.0f) * FloatGLWidth; + float IncreasedHeight = (Ratio - 1.0f) * FloatGLHeight; + // The new width and height + FloatGLWidth = FloatGLWidth * Ratio; + FloatGLHeight = FloatGLHeight * Ratio; + // Adjust the X and Y offset + FloatXOffset = FloatXOffset - (IncreasedWidth * 0.5f); + FloatYOffset = FloatYOffset - (IncreasedHeight * 0.5f); + } + + int XOffset = (int)(FloatXOffset + 0.5f); + int YOffset = (int)(FloatYOffset + 0.5f); + int iWhidth = (int)ceil(FloatGLWidth); + int iHeight = (int)ceil(FloatGLHeight); + iWhidth -= iWhidth % 4; // ensure divisibility by 4 to make it compatible with all the video encoders + iHeight -= iHeight % 4; + + target_rc.left = XOffset; + target_rc.top = YOffset; + target_rc.right = XOffset + iWhidth; + target_rc.bottom = YOffset + iHeight; +} + void Renderer::SetWindowSize(int width, int height) { if (width < 1) diff --git a/Source/Core/VideoCommon/Src/RenderBase.h b/Source/Core/VideoCommon/Src/RenderBase.h index 7f5e4743e6..3a3231ed5e 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.h +++ b/Source/Core/VideoCommon/Src/RenderBase.h @@ -85,6 +85,10 @@ public: // Use this to convert a whole native EFB rect to backbuffer coordinates virtual TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) = 0; + static const TargetRectangle& GetTargetRectangle() { return target_rc; } + static void UpdateDrawRectangle(int backbuffer_width, int backbuffer_height); + + // Use this to upscale native EFB coordinates to IDEAL internal resolution static unsigned int EFBToScaledX(int x) { return x * GetTargetWidth() / EFB_WIDTH; } static unsigned int EFBToScaledY(int y) { return y * GetTargetHeight() / EFB_HEIGHT; } @@ -163,6 +167,8 @@ protected: static float xScale; static float yScale; + static TargetRectangle target_rc; + // can probably eliminate this static var static int s_LastEFBScale; diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp index c5628c19a1..cd63871365 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.cpp +++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp @@ -290,125 +290,3 @@ void VideoConfig::GameIniSave(const char* default_ini, const char* game_ini) iniFile.Save(game_ini); } - - -// TODO: remove -extern bool g_aspect_wide; - -// TODO: Figure out a better place for this function. -void ComputeDrawRectangle(int backbuffer_width, int backbuffer_height, bool flip, TargetRectangle *rc) -{ - float FloatGLWidth = (float)backbuffer_width; - float FloatGLHeight = (float)backbuffer_height; - float FloatXOffset = 0; - float FloatYOffset = 0; - - // The rendering window size - const float WinWidth = FloatGLWidth; - const float WinHeight = FloatGLHeight; - - // Handle aspect ratio. - // Default to auto. - bool use16_9 = g_aspect_wide; - - // Update aspect ratio hack values - // Won't take effect until next frame - // Don't know if there is a better place for this code so there isn't a 1 frame delay - if ( g_ActiveConfig.bWidescreenHack ) - { - float source_aspect = use16_9 ? (16.0f / 9.0f) : (4.0f / 3.0f); - float target_aspect; - - switch ( g_ActiveConfig.iAspectRatio ) - { - case ASPECT_FORCE_16_9 : - target_aspect = 16.0f / 9.0f; - break; - case ASPECT_FORCE_4_3 : - target_aspect = 4.0f / 3.0f; - break; - case ASPECT_STRETCH : - target_aspect = WinWidth / WinHeight; - break; - default : - // ASPECT_AUTO == no hacking - target_aspect = source_aspect; - break; - } - - float adjust = source_aspect / target_aspect; - if ( adjust > 1 ) - { - // Vert+ - g_Config.fAspectRatioHackW = 1; - g_Config.fAspectRatioHackH = 1/adjust; - } - else - { - // Hor+ - g_Config.fAspectRatioHackW = adjust; - g_Config.fAspectRatioHackH = 1; - } - } - else - { - // Hack is disabled - g_Config.fAspectRatioHackW = 1; - g_Config.fAspectRatioHackH = 1; - } - - // Check for force-settings and override. - if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_16_9) - use16_9 = true; - else if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_4_3) - use16_9 = false; - - if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH) - { - // The rendering window aspect ratio as a proportion of the 4:3 or 16:9 ratio - float Ratio = (WinWidth / WinHeight) / (!use16_9 ? (4.0f / 3.0f) : (16.0f / 9.0f)); - // Check if height or width is the limiting factor. If ratio > 1 the picture is too wide and have to limit the width. - if (Ratio > 1.0f) - { - // Scale down and center in the X direction. - FloatGLWidth /= Ratio; - FloatXOffset = (WinWidth - FloatGLWidth) / 2.0f; - } - // The window is too high, we have to limit the height - else - { - // Scale down and center in the Y direction. - FloatGLHeight *= Ratio; - FloatYOffset = FloatYOffset + (WinHeight - FloatGLHeight) / 2.0f; - } - } - - // ----------------------------------------------------------------------- - // Crop the picture from 4:3 to 5:4 or from 16:9 to 16:10. - // Output: FloatGLWidth, FloatGLHeight, FloatXOffset, FloatYOffset - // ------------------ - if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH && g_ActiveConfig.bCrop) - { - float Ratio = !use16_9 ? ((4.0f / 3.0f) / (5.0f / 4.0f)) : (((16.0f / 9.0f) / (16.0f / 10.0f))); - // The width and height we will add (calculate this before FloatGLWidth and FloatGLHeight is adjusted) - float IncreasedWidth = (Ratio - 1.0f) * FloatGLWidth; - float IncreasedHeight = (Ratio - 1.0f) * FloatGLHeight; - // The new width and height - FloatGLWidth = FloatGLWidth * Ratio; - FloatGLHeight = FloatGLHeight * Ratio; - // Adjust the X and Y offset - FloatXOffset = FloatXOffset - (IncreasedWidth * 0.5f); - FloatYOffset = FloatYOffset - (IncreasedHeight * 0.5f); - } - - int XOffset = (int)(FloatXOffset + 0.5f); - int YOffset = (int)(FloatYOffset + 0.5f); - int iWhidth = (int)ceil(FloatGLWidth); - int iHeight = (int)ceil(FloatGLHeight); - iWhidth -= iWhidth % 4; // ensure divisibility by 4 to make it compatible with all the video encoders - iHeight -= iHeight % 4; - rc->left = XOffset; - rc->top = flip ? (int)(YOffset + iHeight) : YOffset; - rc->right = XOffset + iWhidth; - rc->bottom = flip ? YOffset : (int)(YOffset + iHeight); -} diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h index da760e48b9..47cdd445d4 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.h +++ b/Source/Core/VideoCommon/Src/VideoConfig.h @@ -176,6 +176,4 @@ extern VideoConfig g_ActiveConfig; // Called every frame. void UpdateActiveConfig(); -void ComputeDrawRectangle(int backbuffer_width, int backbuffer_height, bool flip, TargetRectangle *rc); - #endif // _VIDEO_CONFIG_H_ -- cgit v1.2.3 From a38bb488d205752dd3c3e59bae55924ae286c4ec Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Sat, 29 Sep 2012 00:19:28 +0200 Subject: Remove Renderer::xScale and Renderer::yScale. --- .../VideoCommon/Src/FramebufferManagerBase.cpp | 28 ++++++++++++++ .../Core/VideoCommon/Src/FramebufferManagerBase.h | 3 ++ Source/Core/VideoCommon/Src/RenderBase.cpp | 43 +++++----------------- Source/Core/VideoCommon/Src/RenderBase.h | 11 +----- 4 files changed, 42 insertions(+), 43 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/FramebufferManagerBase.cpp b/Source/Core/VideoCommon/Src/FramebufferManagerBase.cpp index fbb042c227..be6109decf 100644 --- a/Source/Core/VideoCommon/Src/FramebufferManagerBase.cpp +++ b/Source/Core/VideoCommon/Src/FramebufferManagerBase.cpp @@ -229,3 +229,31 @@ void FramebufferManagerBase::ReplaceVirtualXFB() } } } + +unsigned int FramebufferManagerBase::ScaleToVirtualXfbWidth(unsigned int width, unsigned int backbuffer_width) +{ + if (g_ActiveConfig.RealXFBEnabled()) + return width; + + if (g_ActiveConfig.b3DVision) + { + // This works, yet the version in the else doesn't. No idea why. + return width * (backbuffer_width-1) / (FramebufferManagerBase::LastXfbWidth()-1); + } + else + return width * (Renderer::GetTargetRectangle().GetWidth() - 1) / (float)(FramebufferManagerBase::LastXfbWidth()-1); +} + +unsigned int FramebufferManagerBase::ScaleToVirtualXfbHeight(unsigned int height, unsigned int backbuffer_height) +{ + if (g_ActiveConfig.RealXFBEnabled()) + return height; + + if (g_ActiveConfig.b3DVision) + { + // This works, yet the version in the else doesn't. No idea why. + return height * (backbuffer_height-1) / (FramebufferManagerBase::LastXfbHeight()-1); + } + else + return height * (Renderer::GetTargetRectangle().GetHeight() - 1) / (float)(FramebufferManagerBase::LastXfbHeight()-1); +} diff --git a/Source/Core/VideoCommon/Src/FramebufferManagerBase.h b/Source/Core/VideoCommon/Src/FramebufferManagerBase.h index a28a941e5b..d915130ac4 100644 --- a/Source/Core/VideoCommon/Src/FramebufferManagerBase.h +++ b/Source/Core/VideoCommon/Src/FramebufferManagerBase.h @@ -55,6 +55,9 @@ public: static unsigned int LastXfbWidth() { return s_last_xfb_width; } static unsigned int LastXfbHeight() { return s_last_xfb_height; } + static unsigned int ScaleToVirtualXfbWidth(unsigned int width, unsigned int backbuffer_width); + static unsigned int ScaleToVirtualXfbHeight(unsigned int height, unsigned int backbuffer_height); + protected: struct VirtualXFB { diff --git a/Source/Core/VideoCommon/Src/RenderBase.cpp b/Source/Core/VideoCommon/Src/RenderBase.cpp index 84eac4ec7f..8bb6ab6750 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.cpp +++ b/Source/Core/VideoCommon/Src/RenderBase.cpp @@ -67,10 +67,6 @@ int Renderer::s_target_height; int Renderer::s_backbuffer_width; int Renderer::s_backbuffer_height; -// ratio of backbuffer size and render area size -float Renderer::xScale; -float Renderer::yScale; - TargetRectangle Renderer::target_rc; int Renderer::s_LastEFBScale; @@ -165,19 +161,23 @@ void Renderer::CalculateTargetScale(int x, int y, int &scaledX, int &scaledY) } // return true if target size changed -bool Renderer::CalculateTargetSize(int multiplier) +bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, int multiplier) { int newEFBWidth, newEFBHeight; switch (s_LastEFBScale) { case 0: // fractional - newEFBWidth = (int)(EFB_WIDTH * xScale); - newEFBHeight = (int)(EFB_HEIGHT * yScale); - break; case 1: // integral - newEFBWidth = EFB_WIDTH * (int)ceilf(xScale); - newEFBHeight = EFB_HEIGHT * (int)ceilf(yScale); + newEFBWidth = FramebufferManagerBase::ScaleToVirtualXfbWidth(EFB_WIDTH, framebuffer_width); + newEFBHeight = FramebufferManagerBase::ScaleToVirtualXfbHeight(EFB_HEIGHT, framebuffer_height); + + if (s_LastEFBScale) + { + newEFBWidth = ((newEFBWidth-1) / EFB_WIDTH + 1) * EFB_WIDTH; + newEFBHeight = ((newEFBHeight-1) / EFB_HEIGHT + 1) * EFB_HEIGHT; + } break; + default: CalculateTargetScale(EFB_WIDTH, EFB_HEIGHT, newEFBWidth, newEFBHeight); break; @@ -310,29 +310,6 @@ void Renderer::DrawDebugText() } } -void Renderer::CalculateXYScale(const TargetRectangle& dst_rect) -{ - if (g_ActiveConfig.RealXFBEnabled()) - { - xScale = 1.0f; - yScale = 1.0f; - } - else - { - if (g_ActiveConfig.b3DVision) - { - // This works, yet the version in the else doesn't. No idea why. - xScale = (float)(s_backbuffer_width-1) / (float)(FramebufferManagerBase::LastXfbWidth()-1); - yScale = (float)(s_backbuffer_height-1) / (float)(FramebufferManagerBase::LastXfbHeight()-1); - } - else - { - xScale = (float)(dst_rect.right - dst_rect.left - 1) / (float)(FramebufferManagerBase::LastXfbWidth()-1); - yScale = (float)(dst_rect.bottom - dst_rect.top - 1) / (float)(FramebufferManagerBase::LastXfbHeight()-1); - } - } -} - // TODO: remove extern bool g_aspect_wide; diff --git a/Source/Core/VideoCommon/Src/RenderBase.h b/Source/Core/VideoCommon/Src/RenderBase.h index 3a3231ed5e..534aa732fe 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.h +++ b/Source/Core/VideoCommon/Src/RenderBase.h @@ -74,10 +74,6 @@ public: static int GetBackbufferWidth() { return s_backbuffer_width; } static int GetBackbufferHeight() { return s_backbuffer_height; } - // XFB scale - TODO: Remove this and add two XFBToScaled functions instead - static float GetXFBScaleX() { return xScale; } - static float GetXFBScaleY() { return yScale; } - static void SetWindowSize(int width, int height); // EFB coordinate conversion functions @@ -137,8 +133,7 @@ public: protected: static void CalculateTargetScale(int x, int y, int &scaledX, int &scaledY); - static bool CalculateTargetSize(int multiplier = 1); - static void CalculateXYScale(const TargetRectangle& dst_rect); + static bool CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, int multiplier = 1); static void CheckFifoRecording(); static void RecordVideoMemory(); @@ -163,10 +158,6 @@ protected: static int s_backbuffer_width; static int s_backbuffer_height; - // ratio of backbuffer size and render area size - TODO: Remove these! - static float xScale; - static float yScale; - static TargetRectangle target_rc; // can probably eliminate this static var -- cgit v1.2.3 From f88e7d3b73e99908e29b243c22210c4b8d47353b Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Sat, 29 Sep 2012 23:08:17 +0200 Subject: Fix an off-by-one error. --- Source/Core/VideoCommon/Src/FramebufferManagerBase.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/FramebufferManagerBase.cpp b/Source/Core/VideoCommon/Src/FramebufferManagerBase.cpp index be6109decf..090c1c7872 100644 --- a/Source/Core/VideoCommon/Src/FramebufferManagerBase.cpp +++ b/Source/Core/VideoCommon/Src/FramebufferManagerBase.cpp @@ -238,10 +238,10 @@ unsigned int FramebufferManagerBase::ScaleToVirtualXfbWidth(unsigned int width, if (g_ActiveConfig.b3DVision) { // This works, yet the version in the else doesn't. No idea why. - return width * (backbuffer_width-1) / (FramebufferManagerBase::LastXfbWidth()-1); + return width * backbuffer_width / FramebufferManagerBase::LastXfbWidth(); } else - return width * (Renderer::GetTargetRectangle().GetWidth() - 1) / (float)(FramebufferManagerBase::LastXfbWidth()-1); + return width * Renderer::GetTargetRectangle().GetWidth() / FramebufferManagerBase::LastXfbWidth(); } unsigned int FramebufferManagerBase::ScaleToVirtualXfbHeight(unsigned int height, unsigned int backbuffer_height) @@ -252,8 +252,8 @@ unsigned int FramebufferManagerBase::ScaleToVirtualXfbHeight(unsigned int height if (g_ActiveConfig.b3DVision) { // This works, yet the version in the else doesn't. No idea why. - return height * (backbuffer_height-1) / (FramebufferManagerBase::LastXfbHeight()-1); + return height * backbuffer_height / FramebufferManagerBase::LastXfbHeight(); } else - return height * (Renderer::GetTargetRectangle().GetHeight() - 1) / (float)(FramebufferManagerBase::LastXfbHeight()-1); + return height * Renderer::GetTargetRectangle().GetHeight() / FramebufferManagerBase::LastXfbHeight(); } -- cgit v1.2.3 From d6697d50c774292158a0e7c16ccbea27f65dbc1e Mon Sep 17 00:00:00 2001 From: XtraFear Date: Fri, 16 Nov 2012 15:16:50 -0500 Subject: Added option to toggle the display of On-Screen Display messages in the Interface tab. --- Source/Core/VideoCommon/Src/OnScreenDisplay.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/OnScreenDisplay.cpp b/Source/Core/VideoCommon/Src/OnScreenDisplay.cpp index f24bfc31b3..10cf5b84af 100644 --- a/Source/Core/VideoCommon/Src/OnScreenDisplay.cpp +++ b/Source/Core/VideoCommon/Src/OnScreenDisplay.cpp @@ -19,6 +19,7 @@ #include "Common.h" +#include "ConfigManager.h" #include "OnScreenDisplay.h" #include "RenderBase.h" #include "Timer.h" @@ -47,6 +48,8 @@ void AddMessage(const char* pstr, u32 ms) void DrawMessages() { + if(!SConfig::GetInstance().m_LocalCoreStartupParameter.bOnScreenDisplayMessages) return; + if (s_listMsgs.size() > 0) { int left = 25, top = 15; -- cgit v1.2.3 From b02bb7617fe5bdcda524d065b5601834e0a3ed4a Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Tue, 2 Oct 2012 22:11:15 +0200 Subject: Fix some fractional EFB scaling issues. --- .../VideoCommon/Src/FramebufferManagerBase.cpp | 20 ++--- .../Core/VideoCommon/Src/FramebufferManagerBase.h | 4 +- Source/Core/VideoCommon/Src/RenderBase.cpp | 100 ++++++++++++++++----- Source/Core/VideoCommon/Src/RenderBase.h | 9 +- 4 files changed, 98 insertions(+), 35 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/FramebufferManagerBase.cpp b/Source/Core/VideoCommon/Src/FramebufferManagerBase.cpp index 090c1c7872..c883714daf 100644 --- a/Source/Core/VideoCommon/Src/FramebufferManagerBase.cpp +++ b/Source/Core/VideoCommon/Src/FramebufferManagerBase.cpp @@ -10,8 +10,8 @@ XFBSourceBase *FramebufferManagerBase::m_realXFBSource; // Only used in Real XFB FramebufferManagerBase::VirtualXFBListType FramebufferManagerBase::m_virtualXFBList; // Only used in Virtual XFB mode const XFBSourceBase* FramebufferManagerBase::m_overlappingXFBArray[MAX_VIRTUAL_XFB]; -unsigned int FramebufferManagerBase::s_last_xfb_width; -unsigned int FramebufferManagerBase::s_last_xfb_height; +unsigned int FramebufferManagerBase::s_last_xfb_width = 1; +unsigned int FramebufferManagerBase::s_last_xfb_height = 1; FramebufferManagerBase::FramebufferManagerBase() { @@ -230,30 +230,30 @@ void FramebufferManagerBase::ReplaceVirtualXFB() } } -unsigned int FramebufferManagerBase::ScaleToVirtualXfbWidth(unsigned int width, unsigned int backbuffer_width) +int FramebufferManagerBase::ScaleToVirtualXfbWidth(int x, unsigned int backbuffer_width) { if (g_ActiveConfig.RealXFBEnabled()) - return width; + return x; if (g_ActiveConfig.b3DVision) { // This works, yet the version in the else doesn't. No idea why. - return width * backbuffer_width / FramebufferManagerBase::LastXfbWidth(); + return x * (int)backbuffer_width / (int)FramebufferManagerBase::LastXfbWidth(); } else - return width * Renderer::GetTargetRectangle().GetWidth() / FramebufferManagerBase::LastXfbWidth(); + return x * (int)Renderer::GetTargetRectangle().GetWidth() / (int)FramebufferManagerBase::LastXfbWidth(); } -unsigned int FramebufferManagerBase::ScaleToVirtualXfbHeight(unsigned int height, unsigned int backbuffer_height) +int FramebufferManagerBase::ScaleToVirtualXfbHeight(int y, unsigned int backbuffer_height) { if (g_ActiveConfig.RealXFBEnabled()) - return height; + return y; if (g_ActiveConfig.b3DVision) { // This works, yet the version in the else doesn't. No idea why. - return height * backbuffer_height / FramebufferManagerBase::LastXfbHeight(); + return y * (int)backbuffer_height / (int)FramebufferManagerBase::LastXfbHeight(); } else - return height * Renderer::GetTargetRectangle().GetHeight() / FramebufferManagerBase::LastXfbHeight(); + return y * (int)Renderer::GetTargetRectangle().GetHeight() / (int)FramebufferManagerBase::LastXfbHeight(); } diff --git a/Source/Core/VideoCommon/Src/FramebufferManagerBase.h b/Source/Core/VideoCommon/Src/FramebufferManagerBase.h index d915130ac4..e529bb1a39 100644 --- a/Source/Core/VideoCommon/Src/FramebufferManagerBase.h +++ b/Source/Core/VideoCommon/Src/FramebufferManagerBase.h @@ -55,8 +55,8 @@ public: static unsigned int LastXfbWidth() { return s_last_xfb_width; } static unsigned int LastXfbHeight() { return s_last_xfb_height; } - static unsigned int ScaleToVirtualXfbWidth(unsigned int width, unsigned int backbuffer_width); - static unsigned int ScaleToVirtualXfbHeight(unsigned int height, unsigned int backbuffer_height); + static int ScaleToVirtualXfbWidth(int x, unsigned int backbuffer_width); + static int ScaleToVirtualXfbHeight(int y, unsigned int backbuffer_height); protected: struct VirtualXFB diff --git a/Source/Core/VideoCommon/Src/RenderBase.cpp b/Source/Core/VideoCommon/Src/RenderBase.cpp index 8bb6ab6750..f83ce29e49 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.cpp +++ b/Source/Core/VideoCommon/Src/RenderBase.cpp @@ -76,6 +76,11 @@ bool Renderer::XFBWrited; bool Renderer::s_EnableDLCachingAfterRecording; unsigned int Renderer::prev_efb_format = (unsigned int)-1; +unsigned int Renderer::efb_scale_numeratorX = 1; +unsigned int Renderer::efb_scale_numeratorY = 1; +unsigned int Renderer::efb_scale_denominatorX = 1; +unsigned int Renderer::efb_scale_denominatorY = 1; +unsigned int Renderer::ssaa_multiplier = 1; Renderer::Renderer() : frame_data(NULL), bLastFrameDumped(false) @@ -93,6 +98,8 @@ Renderer::~Renderer() // invalidate previous efb format prev_efb_format = (unsigned int)-1; + efb_scale_numeratorX = efb_scale_numeratorY = efb_scale_denominatorX = efb_scale_denominatorY = ssaa_multiplier = 1; + #if defined _WIN32 || defined HAVE_LIBAV if (g_ActiveConfig.bDumpFrames && bLastFrameDumped && bAVIDumping) AVIDump::Stop(); @@ -129,41 +136,86 @@ void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRect } } -void Renderer::CalculateTargetScale(int x, int y, int &scaledX, int &scaledY) +int Renderer::EFBToScaledX(int x) +{ + switch (g_ActiveConfig.iEFBScale) + { + case 0: // fractional + return (int)ssaa_multiplier * FramebufferManagerBase::ScaleToVirtualXfbWidth(x, s_backbuffer_width); + + default: + return x * (int)ssaa_multiplier * (int)efb_scale_numeratorX / (int)efb_scale_denominatorX; + }; +} + +int Renderer::EFBToScaledY(int y) { switch (g_ActiveConfig.iEFBScale) { + case 0: // fractional + return (int)ssaa_multiplier * FramebufferManagerBase::ScaleToVirtualXfbHeight(y, s_backbuffer_height); + + default: + return y * (int)ssaa_multiplier * (int)efb_scale_numeratorY / (int)efb_scale_denominatorY; + }; +} + +void Renderer::CalculateTargetScale(int x, int y, int &scaledX, int &scaledY) +{ + if (g_ActiveConfig.iEFBScale == 0 || g_ActiveConfig.iEFBScale == 1) + { + scaledX = x; + scaledY = y; + } + else + { + scaledX = x * (int)efb_scale_numeratorX / (int)efb_scale_denominatorX; + scaledY = y * (int)efb_scale_numeratorY / (int)efb_scale_denominatorY; + } +} + +// return true if target size changed +bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, int multiplier) +{ + int newEFBWidth, newEFBHeight; + + // TODO: Ugly. Clean up + switch (s_LastEFBScale) + { + case 2: // 1x + efb_scale_numeratorX = efb_scale_numeratorY = 1; + efb_scale_denominatorX = efb_scale_denominatorY = 1; + break; + case 3: // 1.5x - scaledX = (x / 2) * 3; - scaledY = (y / 2) * 3; + efb_scale_numeratorX = efb_scale_numeratorY = 3; + efb_scale_denominatorX = efb_scale_denominatorY = 2; break; + case 4: // 2x - scaledX = x * 2; - scaledY = y * 2; + efb_scale_numeratorX = efb_scale_numeratorY = 2; + efb_scale_denominatorX = efb_scale_denominatorY = 1; break; + case 5: // 2.5x - scaledX = (x / 2) * 5; - scaledY = (y / 2) * 5; + efb_scale_numeratorX = efb_scale_numeratorY = 5; + efb_scale_denominatorX = efb_scale_denominatorY = 2; break; + case 6: // 3x - scaledX = x * 3; - scaledY = y * 3; + efb_scale_numeratorX = efb_scale_numeratorY = 3; + efb_scale_denominatorX = efb_scale_denominatorY = 1; break; + case 7: // 4x - scaledX = x * 4; - scaledY = y * 4; + efb_scale_numeratorX = efb_scale_numeratorY = 4; + efb_scale_denominatorX = efb_scale_denominatorY = 1; break; - default: - scaledX = x; - scaledY = y; + + default: // fractional & integral handled later break; - }; -} + } -// return true if target size changed -bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, int multiplier) -{ - int newEFBWidth, newEFBHeight; switch (s_LastEFBScale) { case 0: // fractional @@ -171,13 +223,18 @@ bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int newEFBWidth = FramebufferManagerBase::ScaleToVirtualXfbWidth(EFB_WIDTH, framebuffer_width); newEFBHeight = FramebufferManagerBase::ScaleToVirtualXfbHeight(EFB_HEIGHT, framebuffer_height); - if (s_LastEFBScale) + if (s_LastEFBScale == 1) { newEFBWidth = ((newEFBWidth-1) / EFB_WIDTH + 1) * EFB_WIDTH; newEFBHeight = ((newEFBHeight-1) / EFB_HEIGHT + 1) * EFB_HEIGHT; } + efb_scale_numeratorX = newEFBWidth; + efb_scale_denominatorX = EFB_WIDTH; + efb_scale_numeratorY = newEFBHeight; + efb_scale_denominatorY = EFB_HEIGHT; break; + default: CalculateTargetScale(EFB_WIDTH, EFB_HEIGHT, newEFBWidth, newEFBHeight); break; @@ -185,6 +242,7 @@ bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int newEFBWidth *= multiplier; newEFBHeight *= multiplier; + ssaa_multiplier = multiplier; if (newEFBWidth != s_target_width || newEFBHeight != s_target_height) { diff --git a/Source/Core/VideoCommon/Src/RenderBase.h b/Source/Core/VideoCommon/Src/RenderBase.h index 534aa732fe..4da80c9752 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.h +++ b/Source/Core/VideoCommon/Src/RenderBase.h @@ -86,8 +86,8 @@ public: // Use this to upscale native EFB coordinates to IDEAL internal resolution - static unsigned int EFBToScaledX(int x) { return x * GetTargetWidth() / EFB_WIDTH; } - static unsigned int EFBToScaledY(int y) { return y * GetTargetHeight() / EFB_HEIGHT; } + static int EFBToScaledX(int x); + static int EFBToScaledY(int y); // Floating point versions of the above - only use them if really necessary static float EFBToScaledXf(float x) { return x * ((float)GetTargetWidth() / (float)EFB_WIDTH); } @@ -170,6 +170,11 @@ protected: private: static unsigned int prev_efb_format; + static unsigned int efb_scale_numeratorX; + static unsigned int efb_scale_numeratorY; + static unsigned int efb_scale_denominatorX; + static unsigned int efb_scale_denominatorY; + static unsigned int ssaa_multiplier; }; extern Renderer *g_renderer; -- cgit v1.2.3 From 4f652c40861b80cddba341fc699f9bbb04a79565 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Mon, 19 Nov 2012 21:09:31 +0100 Subject: Partially revert "Check if BP and XF changes actually change values before flushing". Dolphin code sucks too much to get optimizations. This reverts commit 5a77cae2e3434fa5cbb3710f183328e36620fa5f. Fixes issue 5459. Fixes issue 5606. --- Source/Core/VideoCommon/Src/XFStructs.cpp | 67 +++++++++---------------------- 1 file changed, 18 insertions(+), 49 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/XFStructs.cpp b/Source/Core/VideoCommon/Src/XFStructs.cpp index f8330604ad..9f395bfecf 100644 --- a/Source/Core/VideoCommon/Src/XFStructs.cpp +++ b/Source/Core/VideoCommon/Src/XFStructs.cpp @@ -121,18 +121,12 @@ void XFRegWritten(int transferSize, u32 baseAddress, u32 *pData) case XFMEM_SETVIEWPORT+3: case XFMEM_SETVIEWPORT+4: case XFMEM_SETVIEWPORT+5: - { - u8 size = std::min(transferSize * 4, 6 * 4); - if (memcmp((u32*)&xfregs + (address - 0x1000), pData + dataIndex, size)) - { - VertexManager::Flush(); - VertexShaderManager::SetViewportChanged(); - PixelShaderManager::SetViewportChanged(); - } + VertexManager::Flush(); + VertexShaderManager::SetViewportChanged(); + PixelShaderManager::SetViewportChanged(); - nextAddress = XFMEM_SETVIEWPORT + 6; - break; - } + nextAddress = XFMEM_SETVIEWPORT + 6; + break; case XFMEM_SETPROJECTION: case XFMEM_SETPROJECTION+1: @@ -141,21 +135,15 @@ void XFRegWritten(int transferSize, u32 baseAddress, u32 *pData) case XFMEM_SETPROJECTION+4: case XFMEM_SETPROJECTION+5: case XFMEM_SETPROJECTION+6: - { - u8 size = std::min(transferSize * 4, 7 * 4); - if (memcmp((u32*)&xfregs + (address - 0x1000), pData + dataIndex, size)) - { - VertexManager::Flush(); - VertexShaderManager::SetProjectionChanged(); - } + VertexManager::Flush(); + VertexShaderManager::SetProjectionChanged(); - nextAddress = XFMEM_SETPROJECTION + 7; - break; - } + nextAddress = XFMEM_SETPROJECTION + 7; + break; case XFMEM_SETNUMTEXGENS: // GXSetNumTexGens if (xfregs.numTexGen.numTexGens != (newValue & 15)) - VertexManager::Flush(); + VertexManager::Flush(); break; case XFMEM_SETTEXMTXINFO: @@ -166,16 +154,10 @@ void XFRegWritten(int transferSize, u32 baseAddress, u32 *pData) case XFMEM_SETTEXMTXINFO+5: case XFMEM_SETTEXMTXINFO+6: case XFMEM_SETTEXMTXINFO+7: - { - u8 size = std::min(transferSize * 4, 8 * 4); - if (memcmp((u32*)&xfregs + (address - 0x1000), pData + dataIndex, size)) - { - VertexManager::Flush(); - } + VertexManager::Flush(); - nextAddress = XFMEM_SETTEXMTXINFO + 8; - break; - } + nextAddress = XFMEM_SETTEXMTXINFO + 8; + break; case XFMEM_SETPOSMTXINFO: case XFMEM_SETPOSMTXINFO+1: @@ -185,16 +167,10 @@ void XFRegWritten(int transferSize, u32 baseAddress, u32 *pData) case XFMEM_SETPOSMTXINFO+5: case XFMEM_SETPOSMTXINFO+6: case XFMEM_SETPOSMTXINFO+7: - { - u8 size = std::min(transferSize * 4, 8 * 4); - if (memcmp((u32*)&xfregs + (address - 0x1000), pData + dataIndex, size)) - { - VertexManager::Flush(); - } + VertexManager::Flush(); - nextAddress = XFMEM_SETPOSMTXINFO + 8; - break; - } + nextAddress = XFMEM_SETPOSMTXINFO + 8; + break; // -------------- // Unknown Regs @@ -264,15 +240,8 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData) transferSize = 0; } - for (u32 i = 0; i < xfMemTransferSize; ++i) - { - if (((u32*)&xfmem[xfMemBase])[i] != pData[i]) - { - XFMemWritten(xfMemTransferSize, xfMemBase); - memcpy_gc(&xfmem[xfMemBase], pData, xfMemTransferSize * 4); - break; - } - } + XFMemWritten(xfMemTransferSize, xfMemBase); + memcpy_gc(&xfmem[xfMemBase], pData, xfMemTransferSize * 4); pData += xfMemTransferSize; } -- cgit v1.2.3 From 0fcb246b7e0f599cb2b336378e127d10cb70a77e Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Tue, 20 Nov 2012 17:54:48 +0100 Subject: Enable GFX debugger functionality in Release builds. --- Source/Core/VideoCommon/Src/Debugger.h | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/Debugger.h b/Source/Core/VideoCommon/Src/Debugger.h index bcce50f223..fde31e4268 100644 --- a/Source/Core/VideoCommon/Src/Debugger.h +++ b/Source/Core/VideoCommon/Src/Debugger.h @@ -72,21 +72,9 @@ void GFXDebuggerCheckAndPause(bool update); void GFXDebuggerToPause(bool update); void GFXDebuggerUpdateScreen(); -#undef ENABLE_GFX_DEBUGGER -#if defined(_DEBUG) || defined(DEBUGFAST) -#define ENABLE_GFX_DEBUGGER -#endif - -#ifdef ENABLE_GFX_DEBUGGER #define GFX_DEBUGGER_PAUSE_AT(event,update) {if (((GFXDebuggerToPauseAtNext & event) && --GFXDebuggerEventToPauseCount<=0) || GFXDebuggerPauseFlag) GFXDebuggerToPause(update);} #define GFX_DEBUGGER_PAUSE_LOG_AT(event,update,dumpfunc) {if (((GFXDebuggerToPauseAtNext & event) && --GFXDebuggerEventToPauseCount<=0) || GFXDebuggerPauseFlag) {{dumpfunc};GFXDebuggerToPause(update);}} #define GFX_DEBUGGER_LOG_AT(event,dumpfunc) {if (( GFXDebuggerToPauseAtNext & event ) ) {{dumpfunc};}} -#else -// Disable debugging calls in Release build -#define GFX_DEBUGGER_PAUSE_AT(event,update) -#define GFX_DEBUGGER_PAUSE_LOG_AT(event,update,dumpfunc) -#define GFX_DEBUGGER_LOG_AT(event,dumpfunc) -#endif // ENABLE_GFX_DEBUGGER #endif // _GFX_DEBUGGER_H_ -- cgit v1.2.3 From 97f5b1665fa495a494eb2ad40034ececfac853d9 Mon Sep 17 00:00:00 2001 From: rog Date: Mon, 26 Nov 2012 01:41:00 -0500 Subject: what is this even... --- Source/Core/VideoCommon/Src/Fifo.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/Fifo.cpp b/Source/Core/VideoCommon/Src/Fifo.cpp index 565684297a..50aa21ebbf 100644 --- a/Source/Core/VideoCommon/Src/Fifo.cpp +++ b/Source/Core/VideoCommon/Src/Fifo.cpp @@ -16,7 +16,6 @@ // http://code.google.com/p/dolphin-emu/ #include "VideoConfig.h" -#include "Setup.h" #include "MemoryUtil.h" #include "Thread.h" #include "Atomic.h" -- cgit v1.2.3 From bed260aa147cdf82b6914ec476cc36821a046b0f Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Sat, 1 Dec 2012 14:23:24 +0100 Subject: VertexShaderManager: Fix redundant shader constant updates. Thanks to konpie for spotting this. Might give a fairly perceivable speedup in the D3D11 backend. --- Source/Core/VideoCommon/Src/VertexShaderManager.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp index 6ad877318f..8d24402b49 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp @@ -207,6 +207,7 @@ void VertexShaderManager::SetConstants() int endn = (nPostTransformMatricesChanged[1] + 3 ) / 4; const float* pstart = (const float*)&xfmem[XFMEM_POSTMATRICES + startn * 4]; SetMultiVSConstant4fv(C_POSTTRANSFORMMATRICES + startn, endn - startn, pstart); + nPostTransformMatricesChanged[0] = nPostTransformMatricesChanged[1] = -1; } if (nLightsChanged[0] >= 0) -- cgit v1.2.3 From e85438cba05c88d088a26572e88e3996b38d88ed Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Mon, 10 Dec 2012 00:40:28 -0600 Subject: Clean up gcc/g++ compiler warnings that have accumulated. --- Source/Core/VideoCommon/Src/DLCache.cpp | 8 ++++---- Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 5 +++-- Source/Core/VideoCommon/Src/PixelShaderManager.cpp | 1 + Source/Core/VideoCommon/Src/VertexLoader.cpp | 10 +++++----- Source/Core/VideoCommon/Src/VertexLoaderManager.cpp | 9 +++++---- Source/Core/VideoCommon/Src/VertexShaderManager.cpp | 1 + 6 files changed, 19 insertions(+), 15 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/DLCache.cpp b/Source/Core/VideoCommon/Src/DLCache.cpp index 5499fa26f1..c828ea3a03 100644 --- a/Source/Core/VideoCommon/Src/DLCache.cpp +++ b/Source/Core/VideoCommon/Src/DLCache.cpp @@ -361,9 +361,9 @@ u32 AnalyzeAndRunDisplayList(u32 address, u32 size, CachedDisplayList *dl) (cmd_byte & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT, numVertices); num_draw_call++; - const int tc[12] = { + const u32 tc[12] = { g_VtxDesc.Position, g_VtxDesc.Normal, g_VtxDesc.Color0, g_VtxDesc.Color1, g_VtxDesc.Tex0Coord, g_VtxDesc.Tex1Coord, - g_VtxDesc.Tex2Coord, g_VtxDesc.Tex3Coord, g_VtxDesc.Tex4Coord, g_VtxDesc.Tex5Coord, g_VtxDesc.Tex6Coord, (const int)((g_VtxDesc.Hex >> 31) & 3) + g_VtxDesc.Tex2Coord, g_VtxDesc.Tex3Coord, g_VtxDesc.Tex4Coord, g_VtxDesc.Tex5Coord, g_VtxDesc.Tex6Coord, (const u32)((g_VtxDesc.Hex >> 31) & 3) }; for(int i = 0; i < 12; i++) { @@ -563,9 +563,9 @@ void CompileAndRunDisplayList(u32 address, u32 size, CachedDisplayList *dl) dl->InsertRegion(NewRegion); memcpy(NewRegion->start_address, StartAddress, Vdatasize); emitter.ABI_CallFunctionCCCP((void *)&VertexLoaderManager::RunCompiledVertices, cmd_byte & GX_VAT_MASK, (cmd_byte & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT, numVertices, NewRegion->start_address); - const int tc[12] = { + const u32 tc[12] = { g_VtxDesc.Position, g_VtxDesc.Normal, g_VtxDesc.Color0, g_VtxDesc.Color1, g_VtxDesc.Tex0Coord, g_VtxDesc.Tex1Coord, - g_VtxDesc.Tex2Coord, g_VtxDesc.Tex3Coord, g_VtxDesc.Tex4Coord, g_VtxDesc.Tex5Coord, g_VtxDesc.Tex6Coord, (const int)((g_VtxDesc.Hex >> 31) & 3) + g_VtxDesc.Tex2Coord, g_VtxDesc.Tex3Coord, g_VtxDesc.Tex4Coord, g_VtxDesc.Tex5Coord, g_VtxDesc.Tex6Coord, (const u32)((g_VtxDesc.Hex >> 31) & 3) }; for(int i = 0; i < 12; i++) { diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index bc7a12304f..bb4d833034 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -131,6 +131,8 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 compo for (unsigned int i = 0; i < bpmem.genMode.numtexgens; ++i) { + // TODO: This is all wrong. i in the else clause will always be out of range as a + // subscript for xfregs.texMtxInfo. NeoBrain?? if (18+i < 32) uid->values[0] |= xfregs.texMtxInfo[i].projection << (18+i); // 1 else @@ -158,7 +160,7 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 compo } u32* ptr = &uid->values[2]; - for (unsigned int i = 0; i < bpmem.genMode.numtevstages+1; ++i) + for (int i = 0; i < bpmem.genMode.numtevstages+1; ++i) { StageHash(i, ptr); ptr += 4; // max: ptr = &uid->values[66] @@ -626,7 +628,6 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType } WRITE(p, " ) {\n"); - char* pmainstart = p; int Pretest = AlphaPreTest(); if(Pretest >= 0 && !DepthTextureEnable) { diff --git a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp index 1533f9348e..f195cd805b 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp @@ -302,6 +302,7 @@ void PixelShaderManager::SetConstants() float GC_ALIGNED16(material[4]); float NormalizationCoef = 1 / 255.0f; + // TODO: This code is wrong. i goes out of range for xfregs.ambColor. for (int i = 0; i < 4; ++i) { if (nMaterialsChanged & (1 << i)) diff --git a/Source/Core/VideoCommon/Src/VertexLoader.cpp b/Source/Core/VideoCommon/Src/VertexLoader.cpp index fb34ce1bc1..5bffab8ee7 100644 --- a/Source/Core/VideoCommon/Src/VertexLoader.cpp +++ b/Source/Core/VideoCommon/Src/VertexLoader.cpp @@ -224,14 +224,14 @@ void VertexLoader::CompileVertexTranslator() #endif // Colors - const int col[2] = {m_VtxDesc.Color0, m_VtxDesc.Color1}; + const u32 col[2] = {m_VtxDesc.Color0, m_VtxDesc.Color1}; // TextureCoord // Since m_VtxDesc.Text7Coord is broken across a 32 bit word boundary, retrieve its value manually. // If we didn't do this, the vertex format would be read as one bit offset from where it should be, making // 01 become 00, and 10/11 become 01 - const int tc[8] = { + const u32 tc[8] = { m_VtxDesc.Tex0Coord, m_VtxDesc.Tex1Coord, m_VtxDesc.Tex2Coord, m_VtxDesc.Tex3Coord, - m_VtxDesc.Tex4Coord, m_VtxDesc.Tex5Coord, m_VtxDesc.Tex6Coord, (const int)((m_VtxDesc.Hex >> 31) & 3) + m_VtxDesc.Tex4Coord, m_VtxDesc.Tex5Coord, m_VtxDesc.Tex6Coord, (const u32)((m_VtxDesc.Hex >> 31) & 3) }; // Reset pipeline @@ -770,7 +770,7 @@ void VertexLoader::AppendToString(std::string *dest) const dest->append(StringFromFormat("Nrm: %i %s-%s ", m_VtxAttr.NormalElements, posMode[m_VtxDesc.Normal], posFormats[m_VtxAttr.NormalFormat])); } - int color_mode[2] = {m_VtxDesc.Color0, m_VtxDesc.Color1}; + u32 color_mode[2] = {m_VtxDesc.Color0, m_VtxDesc.Color1}; for (int i = 0; i < 2; i++) { if (color_mode[i]) @@ -778,7 +778,7 @@ void VertexLoader::AppendToString(std::string *dest) const dest->append(StringFromFormat("C%i: %i %s-%s ", i, m_VtxAttr.color[i].Elements, posMode[color_mode[i]], colorFormat[m_VtxAttr.color[i].Comp])); } } - int tex_mode[8] = { + u32 tex_mode[8] = { m_VtxDesc.Tex0Coord, m_VtxDesc.Tex1Coord, m_VtxDesc.Tex2Coord, m_VtxDesc.Tex3Coord, m_VtxDesc.Tex4Coord, m_VtxDesc.Tex5Coord, m_VtxDesc.Tex6Coord, m_VtxDesc.Tex7Coord }; diff --git a/Source/Core/VideoCommon/Src/VertexLoaderManager.cpp b/Source/Core/VideoCommon/Src/VertexLoaderManager.cpp index 316941a639..4afa6e941b 100644 --- a/Source/Core/VideoCommon/Src/VertexLoaderManager.cpp +++ b/Source/Core/VideoCommon/Src/VertexLoaderManager.cpp @@ -20,8 +20,8 @@ #include using stdext::hash_map; #else -#include -using __gnu_cxx::hash_map; +#include +using std::unordered_map; #endif #include #include @@ -44,20 +44,21 @@ namespace stdext { return uid.GetHash(); } } +typedef hash_map VertexLoaderMap; #else -namespace __gnu_cxx { +namespace std { template<> struct hash { size_t operator()(const VertexLoaderUID& uid) const { return uid.GetHash(); } }; } +typedef unordered_map VertexLoaderMap; #endif namespace VertexLoaderManager { -typedef hash_map VertexLoaderMap; static VertexLoaderMap g_VertexLoaderMap; // TODO - change into array of pointers. Keep a map of all seen so far. diff --git a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp index 8d24402b49..12445f283a 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp @@ -251,6 +251,7 @@ void VertexShaderManager::SetConstants() float GC_ALIGNED16(material[4]); float NormalizationCoef = 1 / 255.0f; + // TODO: This code is wrong. i goes out of range for xfregs.ambColor. for (int i = 0; i < 4; ++i) { if (nMaterialsChanged & (1 << i)) -- cgit v1.2.3 From f6df3d15134def6845dfe74fa7d38d1d6688e5a5 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Mon, 10 Dec 2012 08:40:27 -0600 Subject: OSX build fix for the unordered_map/hash_map issue. --- Source/Core/VideoCommon/Src/VertexLoaderManager.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/VertexLoaderManager.cpp b/Source/Core/VideoCommon/Src/VertexLoaderManager.cpp index 4afa6e941b..153e69a8c3 100644 --- a/Source/Core/VideoCommon/Src/VertexLoaderManager.cpp +++ b/Source/Core/VideoCommon/Src/VertexLoaderManager.cpp @@ -19,6 +19,9 @@ #ifdef _MSC_VER #include using stdext::hash_map; +#elif defined __APPLE__ +#include +using __gnu_cxx::hash_map; #else #include using std::unordered_map; @@ -44,15 +47,24 @@ namespace stdext { return uid.GetHash(); } } -typedef hash_map VertexLoaderMap; #else -namespace std { +#ifdef __APPLE__ +namespace __gnu_cxx +#else +namespace std +#endif +{ template<> struct hash { size_t operator()(const VertexLoaderUID& uid) const { return uid.GetHash(); } }; } +#endif + +#if defined _MSC_VER || defined __APPLE__ +typedef hash_map VertexLoaderMap; +#else typedef unordered_map VertexLoaderMap; #endif -- cgit v1.2.3 From c82136abdceb499bef33919a5c29cc323fbd2266 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Mon, 10 Dec 2012 16:13:22 +0100 Subject: PixelShaderGen: Drop some useless and potentially buggy code. Thanks to glennrics for noticing. --- Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index bb4d833034..cc48276253 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -129,17 +129,11 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 compo return; } + // numtexgens should be <= 8 for (unsigned int i = 0; i < bpmem.genMode.numtexgens; ++i) - { - // TODO: This is all wrong. i in the else clause will always be out of range as a - // subscript for xfregs.texMtxInfo. NeoBrain?? - if (18+i < 32) - uid->values[0] |= xfregs.texMtxInfo[i].projection << (18+i); // 1 - else - uid->values[1] |= xfregs.texMtxInfo[i].projection << (i - 14); // 1 - } + uid->values[0] |= xfregs.texMtxInfo[i].projection << (18+i); // 1 - uid->values[1] = bpmem.genMode.numindstages << 2; // 3 + uid->values[1] = bpmem.genMode.numindstages; // 3 u32 indirectStagesUsed = 0; for (unsigned int i = 0; i < bpmem.genMode.numindstages; ++i) if (bpmem.tevind[i].IsActive() && bpmem.tevind[i].bt < bpmem.genMode.numindstages) @@ -147,15 +141,15 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 compo assert(indirectStagesUsed == (indirectStagesUsed & 0xF)); - uid->values[1] |= indirectStagesUsed << 5; // 4; + uid->values[1] |= indirectStagesUsed << 3; // 4; for (unsigned int i = 0; i < bpmem.genMode.numindstages; ++i) { if (indirectStagesUsed & (1 << i)) { - uid->values[1] |= (bpmem.tevindref.getTexCoord(i) < bpmem.genMode.numtexgens) << (9 + 3*i); // 1 + uid->values[1] |= (bpmem.tevindref.getTexCoord(i) < bpmem.genMode.numtexgens) << (7 + 3*i); // 1 if (bpmem.tevindref.getTexCoord(i) < bpmem.genMode.numtexgens) - uid->values[1] |= bpmem.tevindref.getTexCoord(i) << (10 + 3*i); // 2 + uid->values[1] |= bpmem.tevindref.getTexCoord(i) << (8 + 3*i); // 2 } } -- cgit v1.2.3 From 8b62be20253a282edc8308cd3ce541be5ecbbb70 Mon Sep 17 00:00:00 2001 From: degasus Date: Fri, 7 Dec 2012 22:49:18 +0100 Subject: fix ShowEFBCopyRegions those fancy colors were the result of the usage of non-allocated heap Signed-off-by: Ryan Houdek --- Source/Core/VideoCommon/Src/BPFunctions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/BPFunctions.cpp b/Source/Core/VideoCommon/Src/BPFunctions.cpp index cddeae3000..b9a76ba7b6 100644 --- a/Source/Core/VideoCommon/Src/BPFunctions.cpp +++ b/Source/Core/VideoCommon/Src/BPFunctions.cpp @@ -236,7 +236,7 @@ bool GetConfig(const int &type) case CONFIG_DISABLEFOG: return g_ActiveConfig.bDisableFog; case CONFIG_SHOWEFBREGIONS: - return false; + return g_ActiveConfig.bShowEFBCopyRegions; default: PanicAlert("GetConfig Error: Unknown Config Type!"); return false; -- cgit v1.2.3 From 081131160473868c0deb19358b199a5832c8e71e Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Mon, 17 Dec 2012 19:31:52 +0100 Subject: TextureCacheBase: Delete textures completely instead of just invalidating them in ClearRenderTargets. That's what would've been done in the next TCB::Load() call, anyway. Fixes issue 5742. Additionally, change efb copies to specify 1 as the number of mipmaps because that makes more sense than anything else. --- Source/Core/VideoCommon/Src/TextureCacheBase.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp index a5c390df3d..7c47c35bb6 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp @@ -205,8 +205,11 @@ void TextureCache::ClearRenderTargets() tcend = textures.end(); for (; iter!=tcend; ++iter) - if (iter->second->type != TCET_EC_DYNAMIC) - iter->second->type = TCET_NORMAL; + if (iter->second->type == TCET_EC_VRAM) + { + delete iter->second; + textures.erase(iter++); + } } bool TextureCache::CheckForCustomTextureLODs(u64 tex_hash, int texformat, unsigned int levels) @@ -782,7 +785,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat textures[dstAddr] = entry = g_texture_cache->CreateRenderTargetTexture(scaled_tex_w, scaled_tex_h); // TODO: Using the wrong dstFormat, dumb... - entry->SetGeneralParameters(dstAddr, 0, dstFormat, 0); + entry->SetGeneralParameters(dstAddr, 0, dstFormat, 1); entry->SetDimensions(tex_w, tex_h, scaled_tex_w, scaled_tex_h); entry->SetHashes(TEXHASH_INVALID); entry->type = TCET_EC_VRAM; -- cgit v1.2.3 From 2df0c31d13372bc29d488cf7e80d4adb9cf28b46 Mon Sep 17 00:00:00 2001 From: degasus Date: Fri, 21 Dec 2012 21:04:53 +0100 Subject: add invalid flag for BPStructs (fix issue 5790) this flag will be set on loading a state and checked before every rendering. --- Source/Core/VideoCommon/Src/BPStructs.cpp | 75 ++++++++++++++--------- Source/Core/VideoCommon/Src/BPStructs.h | 1 + Source/Core/VideoCommon/Src/MainBase.cpp | 2 +- Source/Core/VideoCommon/Src/VertexManagerBase.cpp | 4 ++ 4 files changed, 51 insertions(+), 31 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp index 179196e412..1e13a36f96 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.cpp +++ b/Source/Core/VideoCommon/Src/BPStructs.cpp @@ -34,9 +34,10 @@ using namespace BPFunctions; -u32 mapTexAddress; -bool mapTexFound; -int numWrites; +static u32 mapTexAddress; +static bool mapTexFound; +static int numWrites; +static bool s_invalid; extern volatile bool g_bSkipCurrentFrame; @@ -56,6 +57,7 @@ void BPInit() mapTexAddress = 0; numWrites = 0; mapTexFound = false; + s_invalid = false; } void RenderToXFB(const BPCmd &bp, const EFBRectangle &rc, float yScale, float xfbLines, u32 xfbAddr, const u32 dstWidth, const u32 dstHeight, float gamma) @@ -81,6 +83,9 @@ void BPWritten(const BPCmd& bp) just stuff geometry in them and don't put state changes there ---------------------------------------------------------------------------------------------------------------- */ + + // check for invalid state, else unneeded configuration are built + BPReload(); // Debugging only, this lets you skip a bp update //static int times = 0; @@ -680,32 +685,42 @@ void BPWritten(const BPCmd& bp) // Called when loading a saved state. void BPReload() { - // restore anything that goes straight to the renderer. - // let's not risk actually replaying any writes. - // note that PixelShaderManager is already covered since it has its own DoState. - SetGenerationMode(); - SetScissor(); - SetLineWidth(); - SetDepthMode(); - SetLogicOpMode(); - SetDitherMode(); - SetBlendMode(); - SetColorMask(); - OnPixelFormatChange(); - { - BPCmd bp = {BPMEM_TX_SETMODE0, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_TX_SETMODE0])}; - SetTextureMode(bp); - } - { - BPCmd bp = {BPMEM_TX_SETMODE0_4, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_TX_SETMODE0_4])}; - SetTextureMode(bp); - } - { - BPCmd bp = {BPMEM_FIELDMASK, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_FIELDMASK])}; - SetInterlacingMode(bp); - } - { - BPCmd bp = {BPMEM_FIELDMODE, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_FIELDMODE])}; - SetInterlacingMode(bp); + if(s_invalid) { + s_invalid = false; + + // restore anything that goes straight to the renderer. + // let's not risk actually replaying any writes. + // note that PixelShaderManager is already covered since it has its own DoState. + SetGenerationMode(); + SetScissor(); + SetLineWidth(); + SetDepthMode(); + SetLogicOpMode(); + SetDitherMode(); + SetBlendMode(); + SetColorMask(); + OnPixelFormatChange(); + { + BPCmd bp = {BPMEM_TX_SETMODE0, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_TX_SETMODE0])}; + SetTextureMode(bp); + } + { + BPCmd bp = {BPMEM_TX_SETMODE0_4, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_TX_SETMODE0_4])}; + SetTextureMode(bp); + } + { + BPCmd bp = {BPMEM_FIELDMASK, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_FIELDMASK])}; + SetInterlacingMode(bp); + } + { + BPCmd bp = {BPMEM_FIELDMODE, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_FIELDMODE])}; + SetInterlacingMode(bp); + } } } + +void BPInvalidate() +{ + s_invalid = true; +} + diff --git a/Source/Core/VideoCommon/Src/BPStructs.h b/Source/Core/VideoCommon/Src/BPStructs.h index 38b3d3a3d4..1c1bc23e06 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.h +++ b/Source/Core/VideoCommon/Src/BPStructs.h @@ -23,5 +23,6 @@ void BPInit(); void LoadBPReg(u32 value0); void BPReload(); +void BPInvalidate(); #endif // _BPSTRUCTS_H_ diff --git a/Source/Core/VideoCommon/Src/MainBase.cpp b/Source/Core/VideoCommon/Src/MainBase.cpp index cb6dc7ae5b..b5e72b1d8d 100644 --- a/Source/Core/VideoCommon/Src/MainBase.cpp +++ b/Source/Core/VideoCommon/Src/MainBase.cpp @@ -198,7 +198,7 @@ void VideoBackendHardware::DoState(PointerWrap& p) // Refresh state. if (p.GetMode() == PointerWrap::MODE_READ) { - BPReload(); + BPInvalidate(); RecomputeCachedArraybases(); // Clear all caches that touch RAM diff --git a/Source/Core/VideoCommon/Src/VertexManagerBase.cpp b/Source/Core/VideoCommon/Src/VertexManagerBase.cpp index 4118e3dcbd..23f355fe3b 100644 --- a/Source/Core/VideoCommon/Src/VertexManagerBase.cpp +++ b/Source/Core/VideoCommon/Src/VertexManagerBase.cpp @@ -9,6 +9,7 @@ #include "NativeVertexFormat.h" #include "TextureCacheBase.h" #include "RenderBase.h" +#include "BPStructs.h" #include "VertexManagerBase.h" #include "VideoConfig.h" @@ -159,6 +160,9 @@ void VertexManager::AddVertices(int primitive, int numVertices) void VertexManager::Flush() { + // loading a state will invalidate BP, so check for it + BPReload(); + g_vertex_manager->vFlush(); } -- cgit v1.2.3 From ffddfd8662bda4fedcfcc8cad73f02bd7a522925 Mon Sep 17 00:00:00 2001 From: degasus Date: Sat, 22 Dec 2012 17:30:13 +0100 Subject: do only invalid hashes instead of all textures on loading this is a hack, but only the gpu thread is allowed to call ogl commands suggestion: create an unused texture cache, so we can move all textures there --- Source/Core/VideoCommon/Src/MainBase.cpp | 2 +- Source/Core/VideoCommon/Src/TextureCacheBase.cpp | 12 ++++++++++++ Source/Core/VideoCommon/Src/TextureCacheBase.h | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/MainBase.cpp b/Source/Core/VideoCommon/Src/MainBase.cpp index b5e72b1d8d..6e0fb530db 100644 --- a/Source/Core/VideoCommon/Src/MainBase.cpp +++ b/Source/Core/VideoCommon/Src/MainBase.cpp @@ -203,7 +203,7 @@ void VideoBackendHardware::DoState(PointerWrap& p) // Clear all caches that touch RAM // (? these don't appear to touch any emulation state that gets saved. moved to on load only.) - TextureCache::Invalidate(); + TextureCache::InvalidateHashes(); VertexLoaderManager::MarkAllDirty(); } } diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp index 7c47c35bb6..2bcaead19c 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp @@ -72,6 +72,18 @@ void TextureCache::Invalidate() textures.clear(); } +// this function is dirty hack to work around a OGL bug. +// it is only used on loading states. It will work for normal textures, +// but for efb2ram, it wouldn't be checked. So there may be glitches on loading +void TextureCache::InvalidateHashes() +{ + TexCache::iterator + iter = textures.begin(), + tcend = textures.end(); + for (; iter != tcend; ++iter) + iter->second->hash = TEXHASH_INVALID; +} + TextureCache::~TextureCache() { Invalidate(); diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.h b/Source/Core/VideoCommon/Src/TextureCacheBase.h index 4ef3b8a985..4d7124f215 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.h +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.h @@ -106,6 +106,7 @@ public: static void Cleanup(); static void Invalidate(); + static void InvalidateHashes(); static void InvalidateRange(u32 start_address, u32 size); static void MakeRangeDynamic(u32 start_address, u32 size); static void ClearRenderTargets(); // currently only used by OGL -- cgit v1.2.3 From bd0abb3d2fe5047554bb6b87fa8e3f6aa3f42e0b Mon Sep 17 00:00:00 2001 From: degasus Date: Sun, 23 Dec 2012 13:32:23 +0100 Subject: revert last commit, add CheckInvalidState to VideoBackend --- Source/Core/VideoCommon/Src/BPStructs.cpp | 68 ++++++++++------------- Source/Core/VideoCommon/Src/BPStructs.h | 1 - Source/Core/VideoCommon/Src/MainBase.cpp | 14 ++++- Source/Core/VideoCommon/Src/TextureCacheBase.cpp | 12 ---- Source/Core/VideoCommon/Src/TextureCacheBase.h | 1 - Source/Core/VideoCommon/Src/VertexManagerBase.cpp | 2 +- 6 files changed, 41 insertions(+), 57 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp index 1e13a36f96..0bde9cc613 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.cpp +++ b/Source/Core/VideoCommon/Src/BPStructs.cpp @@ -37,7 +37,6 @@ using namespace BPFunctions; static u32 mapTexAddress; static bool mapTexFound; static int numWrites; -static bool s_invalid; extern volatile bool g_bSkipCurrentFrame; @@ -57,7 +56,6 @@ void BPInit() mapTexAddress = 0; numWrites = 0; mapTexFound = false; - s_invalid = false; } void RenderToXFB(const BPCmd &bp, const EFBRectangle &rc, float yScale, float xfbLines, u32 xfbAddr, const u32 dstWidth, const u32 dstHeight, float gamma) @@ -85,7 +83,7 @@ void BPWritten(const BPCmd& bp) */ // check for invalid state, else unneeded configuration are built - BPReload(); + g_video_backend->CheckInvalidState(); // Debugging only, this lets you skip a bp update //static int times = 0; @@ -685,42 +683,32 @@ void BPWritten(const BPCmd& bp) // Called when loading a saved state. void BPReload() { - if(s_invalid) { - s_invalid = false; - - // restore anything that goes straight to the renderer. - // let's not risk actually replaying any writes. - // note that PixelShaderManager is already covered since it has its own DoState. - SetGenerationMode(); - SetScissor(); - SetLineWidth(); - SetDepthMode(); - SetLogicOpMode(); - SetDitherMode(); - SetBlendMode(); - SetColorMask(); - OnPixelFormatChange(); - { - BPCmd bp = {BPMEM_TX_SETMODE0, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_TX_SETMODE0])}; - SetTextureMode(bp); - } - { - BPCmd bp = {BPMEM_TX_SETMODE0_4, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_TX_SETMODE0_4])}; - SetTextureMode(bp); - } - { - BPCmd bp = {BPMEM_FIELDMASK, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_FIELDMASK])}; - SetInterlacingMode(bp); - } - { - BPCmd bp = {BPMEM_FIELDMODE, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_FIELDMODE])}; - SetInterlacingMode(bp); - } + // restore anything that goes straight to the renderer. + // let's not risk actually replaying any writes. + // note that PixelShaderManager is already covered since it has its own DoState. + SetGenerationMode(); + SetScissor(); + SetLineWidth(); + SetDepthMode(); + SetLogicOpMode(); + SetDitherMode(); + SetBlendMode(); + SetColorMask(); + OnPixelFormatChange(); + { + BPCmd bp = {BPMEM_TX_SETMODE0, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_TX_SETMODE0])}; + SetTextureMode(bp); + } + { + BPCmd bp = {BPMEM_TX_SETMODE0_4, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_TX_SETMODE0_4])}; + SetTextureMode(bp); + } + { + BPCmd bp = {BPMEM_FIELDMASK, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_FIELDMASK])}; + SetInterlacingMode(bp); + } + { + BPCmd bp = {BPMEM_FIELDMODE, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_FIELDMODE])}; + SetInterlacingMode(bp); } } - -void BPInvalidate() -{ - s_invalid = true; -} - diff --git a/Source/Core/VideoCommon/Src/BPStructs.h b/Source/Core/VideoCommon/Src/BPStructs.h index 1c1bc23e06..38b3d3a3d4 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.h +++ b/Source/Core/VideoCommon/Src/BPStructs.h @@ -23,6 +23,5 @@ void BPInit(); void LoadBPReg(u32 value0); void BPReload(); -void BPInvalidate(); #endif // _BPSTRUCTS_H_ diff --git a/Source/Core/VideoCommon/Src/MainBase.cpp b/Source/Core/VideoCommon/Src/MainBase.cpp index 6e0fb530db..726ef71b38 100644 --- a/Source/Core/VideoCommon/Src/MainBase.cpp +++ b/Source/Core/VideoCommon/Src/MainBase.cpp @@ -180,6 +180,7 @@ void VideoBackendHardware::InitializeShared() memset((void*)&s_beginFieldArgs, 0, sizeof(s_beginFieldArgs)); memset(&s_accessEFBArgs, 0, sizeof(s_accessEFBArgs)); s_AccessEFBResult = 0; + m_invalid = false; } // Run from the CPU thread @@ -198,16 +199,25 @@ void VideoBackendHardware::DoState(PointerWrap& p) // Refresh state. if (p.GetMode() == PointerWrap::MODE_READ) { - BPInvalidate(); + m_invalid = true; RecomputeCachedArraybases(); // Clear all caches that touch RAM // (? these don't appear to touch any emulation state that gets saved. moved to on load only.) - TextureCache::InvalidateHashes(); VertexLoaderManager::MarkAllDirty(); } } +void VideoBackendHardware::CheckInvalidState() { + if (m_invalid) + { + m_invalid = false; + + BPReload(); + TextureCache::Invalidate(); + } +} + void VideoBackendHardware::PauseAndLock(bool doLock, bool unpauseOnUnlock) { Fifo_PauseAndLock(doLock, unpauseOnUnlock); diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp index 2bcaead19c..7c47c35bb6 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp @@ -72,18 +72,6 @@ void TextureCache::Invalidate() textures.clear(); } -// this function is dirty hack to work around a OGL bug. -// it is only used on loading states. It will work for normal textures, -// but for efb2ram, it wouldn't be checked. So there may be glitches on loading -void TextureCache::InvalidateHashes() -{ - TexCache::iterator - iter = textures.begin(), - tcend = textures.end(); - for (; iter != tcend; ++iter) - iter->second->hash = TEXHASH_INVALID; -} - TextureCache::~TextureCache() { Invalidate(); diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.h b/Source/Core/VideoCommon/Src/TextureCacheBase.h index 4d7124f215..4ef3b8a985 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.h +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.h @@ -106,7 +106,6 @@ public: static void Cleanup(); static void Invalidate(); - static void InvalidateHashes(); static void InvalidateRange(u32 start_address, u32 size); static void MakeRangeDynamic(u32 start_address, u32 size); static void ClearRenderTargets(); // currently only used by OGL diff --git a/Source/Core/VideoCommon/Src/VertexManagerBase.cpp b/Source/Core/VideoCommon/Src/VertexManagerBase.cpp index 23f355fe3b..5be72e4fcf 100644 --- a/Source/Core/VideoCommon/Src/VertexManagerBase.cpp +++ b/Source/Core/VideoCommon/Src/VertexManagerBase.cpp @@ -161,7 +161,7 @@ void VertexManager::AddVertices(int primitive, int numVertices) void VertexManager::Flush() { // loading a state will invalidate BP, so check for it - BPReload(); + g_video_backend->CheckInvalidState(); g_vertex_manager->vFlush(); } -- cgit v1.2.3 From 5a7835103337d754248cda10f9d938765fd28535 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Wed, 19 Dec 2012 16:55:44 +0100 Subject: TextureCacheBase: Fix a potential bug when using custom textures. --- Source/Core/VideoCommon/Src/TextureCacheBase.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp index 7c47c35bb6..9fc18ef1bd 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp @@ -377,7 +377,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage, // // TODO: Don't we need to force texture decoding to RGBA8 for dynamic EFB copies? // TODO: Actually, it should be enough if the internal texture format matches... - if ((entry->type == TCET_NORMAL && width == entry->native_width && height == entry->native_height && full_format == entry->format && entry->num_mipmaps == maxlevel) + if ((entry->type == TCET_NORMAL && width == entry->virtual_width && height == entry->virtual_height && full_format == entry->format && entry->num_mipmaps == maxlevel) || (entry->type == TCET_EC_DYNAMIC && entry->native_width == width && entry->native_height == height)) { // reuse the texture @@ -396,14 +396,21 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage, pcfmt = LoadCustomTexture(tex_hash, texformat, 0, width, height); if (pcfmt != PC_TEX_FMT_NONE) { - expandedWidth = width; - expandedHeight = height; + if (expandedWidth != width || expandedHeight != height) + { + expandedWidth = width; + expandedHeight = height; + + // If we thought we could reuse the texture before, make sure to delete it now! + delete entry; + entry = NULL; + } using_custom_texture = true; } } - // TODO: RGBA8 textures are stored non-continuously in tmem, that might cause problems when preloading is enabled - if (pcfmt == PC_TEX_FMT_NONE) + // TODO: RGBA8 textures are stored non-continuously in tmem, that might cause problems here when preloading is enabled + if (!using_custom_texture) pcfmt = TexDecoder_Decode(temp, src_data, expandedWidth, expandedHeight, texformat, tlutaddr, tlutfmt, g_ActiveConfig.backend_info.bUseRGBATextures); -- cgit v1.2.3 From 4d868705fd312adda1649aebe65c6f82adb21c04 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Mon, 24 Dec 2012 19:49:14 +0100 Subject: VertexShaderGen: Fix a shader compilation error. --- Source/Core/VideoCommon/Src/VertexShaderGen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp index 07ace04b97..2f46a0ee3c 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp @@ -357,7 +357,7 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type) default: _assert_(texinfo.sourcerow <= XF_SRCTEX7_INROW); if (components & (VB_HAS_UV0<<(texinfo.sourcerow - XF_SRCTEX0_INROW)) ) - WRITE(p, "coord = float4(tex%d.x, tex%d.y, 1.0f, 1.0f);\n", texinfo.sourcerow - XF_SRCTEX0_INROW, texinfo.sourcerow - XF_SRCTEX0_INROW); + WRITE(p, "coord = float4(o.tex%d.x, o.tex%d.y, 1.0f, 1.0f);\n", texinfo.sourcerow - XF_SRCTEX0_INROW, texinfo.sourcerow - XF_SRCTEX0_INROW); break; } @@ -389,9 +389,9 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type) default: if (components & (VB_HAS_TEXMTXIDX0< Date: Mon, 24 Dec 2012 21:27:53 +0100 Subject: Revert "VertexShaderGen: Fix a shader compilation error.". I'm an idiot :p This reverts commit 4d868705fd312adda1649aebe65c6f82adb21c04. --- Source/Core/VideoCommon/Src/VertexShaderGen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Source/Core/VideoCommon') diff --git a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp index 2f46a0ee3c..07ace04b97 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp @@ -357,7 +357,7 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type) default: _assert_(texinfo.sourcerow <= XF_SRCTEX7_INROW); if (components & (VB_HAS_UV0<<(texinfo.sourcerow - XF_SRCTEX0_INROW)) ) - WRITE(p, "coord = float4(o.tex%d.x, o.tex%d.y, 1.0f, 1.0f);\n", texinfo.sourcerow - XF_SRCTEX0_INROW, texinfo.sourcerow - XF_SRCTEX0_INROW); + WRITE(p, "coord = float4(tex%d.x, tex%d.y, 1.0f, 1.0f);\n", texinfo.sourcerow - XF_SRCTEX0_INROW, texinfo.sourcerow - XF_SRCTEX0_INROW); break; } @@ -389,9 +389,9 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type) default: if (components & (VB_HAS_TEXMTXIDX0<