From 9276b76fbc0ac77bad5f15ba3d8038c53943249e Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Fri, 2 Mar 2012 18:43:44 +0100 Subject: VideoSoftware: Implement zfreeze (GXSetCoPlanar). Fixes Mario Golf: Toadstool Tour's menus. Reference: The OpenGL extension SGIX_reference_plane seems to provide the same functionality: http://www.opengl.org/registry/specs/SGIX/reference_plane.txt --- Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Source/Plugins') diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp index f688a33b78..c212c93601 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/Rasterizer.cpp @@ -64,7 +64,12 @@ RasterBlock rasterBlock; void Init() { - tev.Init(); + tev.Init(); + + // Set initial z reference plane in the unlikely case that zfreeze is enabled when drawing the first primitive. + // TODO: This is just a guess! + ZSlope.dfdx = ZSlope.dfdy = 0.f; + ZSlope.f0 = 1.f; } inline int iround(float x) @@ -364,7 +369,8 @@ void DrawTriangleFrontFace(OutputVertexData *v0, OutputVertexData *v1, OutputVer float w[3] = { 1.0f / v0->projectedPosition.w, 1.0f / v1->projectedPosition.w, 1.0f / v2->projectedPosition.w }; InitSlope(&WSlope, w[0], w[1], w[2], fltdx31, fltdx12, fltdy12, fltdy31); - InitSlope(&ZSlope, v0->screenPosition[2], v1->screenPosition[2], v2->screenPosition[2], fltdx31, fltdx12, fltdy12, fltdy31); + if (!bpmem.genMode.zfreeze) + InitSlope(&ZSlope, v0->screenPosition[2], v1->screenPosition[2], v2->screenPosition[2], fltdx31, fltdx12, fltdy12, fltdy31); for(unsigned int i = 0; i < bpmem.genMode.numcolchans; i++) { -- cgit v1.2.3 From f5d4fe0bfe13937fa3736aa6b78974ceb6e190ad Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sat, 3 Mar 2012 20:07:20 +0100 Subject: Fix some minor bugs pointed out by PVS Studio (thanks!) --- Source/Plugins/Plugin_VideoDX11/Src/D3DUtil.cpp | 2 +- Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Plugins') diff --git a/Source/Plugins/Plugin_VideoDX11/Src/D3DUtil.cpp b/Source/Plugins/Plugin_VideoDX11/Src/D3DUtil.cpp index 81a4cf96a6..8ee8081b2c 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/D3DUtil.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/D3DUtil.cpp @@ -595,7 +595,7 @@ void drawShadedTexSubQuad(ID3D11ShaderResourceView* texture, // only upload the data to VRAM if it changed if (stsq_observer || - memcmp(rDest, &tex_sub_quad_data.rdest, sizeof(rDest)) != 0 || + memcmp(rDest, &tex_sub_quad_data.rdest, sizeof(*rDest)) != 0 || tex_sub_quad_data.u1 != u1 || tex_sub_quad_data.v1 != v1 || tex_sub_quad_data.u2 != u2 || tex_sub_quad_data.v2 != v2 || tex_sub_quad_data.G != G) { diff --git a/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp b/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp index 3a4b5d0699..9510ad444c 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp @@ -383,7 +383,7 @@ void drawShadedTexQuad(IDirect3DTexture9 *texture, float v2=((float)rSource->bottom) * sh; float g = 1.0f/Gamma; - struct Q2DVertex { float x,y,z,rhw,u,v,w,h,G; } coords[4] = { + const struct Q2DVertex { float x,y,z,rhw,u,v,w,h,G; } coords[4] = { {-1.0f - dw,-1.0f + dh, 0.0f,1.0f, u1, v2, sw, sh, g}, {-1.0f - dw, 1.0f + dh, 0.0f,1.0f, u1, v1, sw, sh, g}, { 1.0f - dw,-1.0f + dh, 0.0f,1.0f, u2, v2, sw, sh, g}, -- cgit v1.2.3 From b0f75f17ae19484735675fea348f7e95740f597f Mon Sep 17 00:00:00 2001 From: marcosvitali Date: Mon, 5 Mar 2012 02:40:10 -0300 Subject: This release still fixed the hangs produced by fifo overflow without sacrifice performance. For example you can test Tutorial moves at the beginning of The last history now is fluid 30/60. Shuffle2: I've delete the hacky line, I think is not necessary anymore. Additional some clean in CommandProcessor. Please test The Last Story and others games affected in the previous commits and give me a feedback. --- Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp | 6 ++++++ Source/Plugins/Plugin_VideoSoftware/Src/VideoBackend.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'Source/Plugins') diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp index abfd9155f5..c591bd0957 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/SWmain.cpp @@ -215,6 +215,12 @@ bool VideoSoftware::Video_IsPossibleWaitingSetDrawDone(void) return false; } +bool VideoSoftware::Video_IsHiWatermarkActive(void) +{ + return false; +} + + void VideoSoftware::Video_AbortFrame(void) { } diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/VideoBackend.h b/Source/Plugins/Plugin_VideoSoftware/Src/VideoBackend.h index 08b4c155ad..7c52e34291 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/VideoBackend.h +++ b/Source/Plugins/Plugin_VideoSoftware/Src/VideoBackend.h @@ -36,7 +36,7 @@ class VideoSoftware : public VideoBackend void Video_SetRendering(bool bEnabled); void Video_GatherPipeBursted(); - + bool Video_IsHiWatermarkActive(); bool Video_IsPossibleWaitingSetDrawDone(); void Video_AbortFrame(); -- cgit v1.2.3 From c3d13b048c40b9df99d401939bd747e1de5c878e Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Sun, 18 Mar 2012 02:31:19 -0700 Subject: build against wxWidgets3 from Externals on Windows. use Externals version of libpng on Windows. --- .../Plugin_VideoDX11/Plugin_VideoDX11.vcxproj | 12 ++++++------ .../Plugins/Plugin_VideoDX9/Plugin_VideoDX9.vcxproj | 12 ++++++------ .../Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcxproj | 12 ++++++------ .../Plugin_VideoSoftware.vcxproj | 21 ++++++--------------- 4 files changed, 24 insertions(+), 33 deletions(-) (limited to 'Source/Plugins') diff --git a/Source/Plugins/Plugin_VideoDX11/Plugin_VideoDX11.vcxproj b/Source/Plugins/Plugin_VideoDX11/Plugin_VideoDX11.vcxproj index 2903bd0550..52d1c37aed 100644 --- a/Source/Plugins/Plugin_VideoDX11/Plugin_VideoDX11.vcxproj +++ b/Source/Plugins/Plugin_VideoDX11/Plugin_VideoDX11.vcxproj @@ -117,7 +117,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets\include;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) true @@ -127,7 +127,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets\include;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) true @@ -137,7 +137,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets\include;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) true @@ -149,7 +149,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets\include;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) true @@ -161,7 +161,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets\include;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) true @@ -173,7 +173,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets\include;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) true diff --git a/Source/Plugins/Plugin_VideoDX9/Plugin_VideoDX9.vcxproj b/Source/Plugins/Plugin_VideoDX9/Plugin_VideoDX9.vcxproj index 604fea8a2b..c152fcb630 100644 --- a/Source/Plugins/Plugin_VideoDX9/Plugin_VideoDX9.vcxproj +++ b/Source/Plugins/Plugin_VideoDX9/Plugin_VideoDX9.vcxproj @@ -122,7 +122,7 @@ Disabled - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets\include;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) _SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreadedDebug stdafx.h @@ -135,7 +135,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets\include;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) true @@ -144,7 +144,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets\include;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) true @@ -155,7 +155,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets\include;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) true @@ -166,7 +166,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets\include;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) true @@ -177,7 +177,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets\include;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories) true diff --git a/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcxproj b/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcxproj index f782fd2c93..d72f0fa9a9 100644 --- a/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcxproj +++ b/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcxproj @@ -117,7 +117,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\GLew\include;..\..\..\Externals;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\include;..\..\..\Externals\GLew\include;..\..\..\Externals;%(AdditionalIncludeDirectories) true @@ -129,7 +129,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\GLew\include;..\..\..\Externals;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\include;..\..\..\Externals\GLew\include;..\..\..\Externals;%(AdditionalIncludeDirectories) true @@ -141,7 +141,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\GLew\include;..\..\..\Externals;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\include;..\..\..\Externals\GLew\include;..\..\..\Externals;%(AdditionalIncludeDirectories) true @@ -155,7 +155,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\GLew\include;..\..\..\Externals;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\include;..\..\..\Externals\GLew\include;..\..\..\Externals;%(AdditionalIncludeDirectories) true @@ -169,7 +169,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\GLew\include;..\..\..\Externals;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\include;..\..\..\Externals\GLew\include;..\..\..\Externals;%(AdditionalIncludeDirectories) true @@ -183,7 +183,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\GLew\include;..\..\..\Externals;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\include;..\..\..\Externals\GLew\include;..\..\..\Externals;%(AdditionalIncludeDirectories) true diff --git a/Source/Plugins/Plugin_VideoSoftware/Plugin_VideoSoftware.vcxproj b/Source/Plugins/Plugin_VideoSoftware/Plugin_VideoSoftware.vcxproj index db6f072f20..7235327fb9 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Plugin_VideoSoftware.vcxproj +++ b/Source/Plugins/Plugin_VideoSoftware/Plugin_VideoSoftware.vcxproj @@ -115,7 +115,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\GLew\include;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\GLew\include;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\Include;..\..\..\Externals;%(AdditionalIncludeDirectories) true @@ -126,7 +126,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\GLew\include;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\GLew\include;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\Include;..\..\..\Externals;%(AdditionalIncludeDirectories) true @@ -137,7 +137,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\GLew\include;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\GLew\include;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\Include;..\..\..\Externals;%(AdditionalIncludeDirectories) true @@ -150,7 +150,7 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\GLew\include;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\GLew\include;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\Include;..\..\..\Externals;%(AdditionalIncludeDirectories) true @@ -163,12 +163,12 @@ - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\GLew\include;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\GLew\include;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\Include;..\..\..\Externals;%(AdditionalIncludeDirectories) - ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\GLew\include;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals;%(AdditionalIncludeDirectories) + ..\..\Core\Common\Src;..\..\Core\Core\Src;..\..\Core\VideoCommon\Src;..\..\Core\DolphinWX\Src;..\..\..\Externals\GLew\include;..\..\..\Externals\wxWidgets3;..\..\..\Externals\wxWidgets3\Include;..\..\..\Externals;%(AdditionalIncludeDirectories) @@ -233,15 +233,6 @@ - - {0e231fb1-f3c9-4724-accb-de8bcb3c089e} - - - {1c8436c9-dbaf-42be-83bc-cf3ec9175abe} - - - {11f55366-12ec-4c44-a8cb-1d4e315d61ed} - {3e5c4e02-1ba9-4776-bdbe-e3f91ffa34cf} -- cgit v1.2.3 From c5d746f3d87f70beb803218fc42f0c4859544b64 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Sun, 18 Mar 2012 06:41:12 -0700 Subject: remove scons files from VS projects --- Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcxproj | 1 - Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcxproj.filters | 1 - Source/Plugins/Plugin_VideoSoftware/Plugin_VideoSoftware.vcxproj | 1 - Source/Plugins/Plugin_VideoSoftware/Plugin_VideoSoftware.vcxproj.filters | 1 - 4 files changed, 4 deletions(-) (limited to 'Source/Plugins') diff --git a/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcxproj b/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcxproj index d72f0fa9a9..18b8ac4d84 100644 --- a/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcxproj +++ b/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcxproj @@ -235,7 +235,6 @@ - diff --git a/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcxproj.filters b/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcxproj.filters index ed581ff963..cd170691da 100644 --- a/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcxproj.filters +++ b/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcxproj.filters @@ -74,7 +74,6 @@ - diff --git a/Source/Plugins/Plugin_VideoSoftware/Plugin_VideoSoftware.vcxproj b/Source/Plugins/Plugin_VideoSoftware/Plugin_VideoSoftware.vcxproj index 7235327fb9..66cfab9b01 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Plugin_VideoSoftware.vcxproj +++ b/Source/Plugins/Plugin_VideoSoftware/Plugin_VideoSoftware.vcxproj @@ -239,7 +239,6 @@ - diff --git a/Source/Plugins/Plugin_VideoSoftware/Plugin_VideoSoftware.vcxproj.filters b/Source/Plugins/Plugin_VideoSoftware/Plugin_VideoSoftware.vcxproj.filters index 57784e2717..4bc1901325 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Plugin_VideoSoftware.vcxproj.filters +++ b/Source/Plugins/Plugin_VideoSoftware/Plugin_VideoSoftware.vcxproj.filters @@ -56,7 +56,6 @@ - -- cgit v1.2.3 From 56b1373baff6f152e51fda96d8d7c0296bff2a70 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Sun, 25 Mar 2012 12:55:02 -0700 Subject: Remove scons-related files --- Source/Plugins/Plugin_VideoOGL/SConscript | 22 ---------------- Source/Plugins/Plugin_VideoSoftware/SConscript | 35 -------------------------- 2 files changed, 57 deletions(-) delete mode 100644 Source/Plugins/Plugin_VideoOGL/SConscript delete mode 100644 Source/Plugins/Plugin_VideoSoftware/SConscript (limited to 'Source/Plugins') diff --git a/Source/Plugins/Plugin_VideoOGL/SConscript b/Source/Plugins/Plugin_VideoOGL/SConscript deleted file mode 100644 index 4b601fca83..0000000000 --- a/Source/Plugins/Plugin_VideoOGL/SConscript +++ /dev/null @@ -1,22 +0,0 @@ -# -*- python -*- - -Import('env') -import os -import sys - -files = [ - 'Src/FramebufferManager.cpp', - 'Src/GLUtil.cpp', - 'Src/NativeVertexFormat.cpp', - 'Src/PixelShaderCache.cpp', - 'Src/PostProcessing.cpp', - 'Src/RasterFont.cpp', - 'Src/Render.cpp', - 'Src/TextureCache.cpp', - 'Src/TextureConverter.cpp', - 'Src/VertexManager.cpp', - 'Src/VertexShaderCache.cpp', - 'Src/main.cpp', - ] - -env['LIBS'] += env.StaticLibrary('videoogl', files) diff --git a/Source/Plugins/Plugin_VideoSoftware/SConscript b/Source/Plugins/Plugin_VideoSoftware/SConscript deleted file mode 100644 index c7a1197f46..0000000000 --- a/Source/Plugins/Plugin_VideoSoftware/SConscript +++ /dev/null @@ -1,35 +0,0 @@ -# -*- python -*- - -Import('env') -import os -import sys - -files = [ - 'Src/BPMemLoader.cpp', - 'Src/CPMemLoader.cpp', - 'Src/Clipper.cpp', - 'Src/DebugUtil.cpp', - 'Src/EfbCopy.cpp', - 'Src/EfbInterface.cpp', - 'Src/HwRasterizer.cpp', - 'Src/OpcodeDecoder.cpp', - 'Src/Rasterizer.cpp', - 'Src/SWCommandProcessor.cpp', - 'Src/SWPixelEngine.cpp', - 'Src/SWRenderer.cpp', - 'Src/SWStatistics.cpp', - 'Src/SWVertexLoader.cpp', - 'Src/SWVideoConfig.cpp', - 'Src/SWmain.cpp', - 'Src/SetupUnit.cpp', - 'Src/Tev.cpp', - 'Src/TextureEncoder.cpp', - 'Src/TextureSampler.cpp', - 'Src/TransformUnit.cpp', - 'Src/XFMemLoader.cpp', - ] - -if not env['nowx']: - files += ['Src/VideoConfigDialog.cpp'] - -env['LIBS'] += env.StaticLibrary('videosoftware', files) -- cgit v1.2.3 From 2afe605069fe28fe0f7e22de787514180700b01c Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Sat, 24 Mar 2012 06:04:00 +0100 Subject: D3D11: Disable mipmapping when no mipmap filter is selected. --- Source/Plugins/Plugin_VideoDX11/Src/Render.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Source/Plugins') diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp index 69f0d0215a..941bcef4ba 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp @@ -1420,9 +1420,10 @@ void Renderer::SetSamplerState(int stage, int texindex) gx_state.sampdc[stage].AddressU = d3dClamps[tm0.wrap_s]; gx_state.sampdc[stage].AddressV = d3dClamps[tm0.wrap_t]; - gx_state.sampdc[stage].MipLODBias = (float)tm0.lod_bias/32.0f; - gx_state.sampdc[stage].MaxLOD = (float)tm1.max_lod/16.f; + // When mipfilter is set to "none", just disable mipmapping altogether + gx_state.sampdc[stage].MaxLOD = (mip == TEXF_NONE) ? 0.0f : (float)tm1.max_lod/16.f; gx_state.sampdc[stage].MinLOD = (float)tm1.min_lod/16.f; + gx_state.sampdc[stage].MipLODBias = (float)tm0.lod_bias/32.0f; } void Renderer::SetInterlacingMode() -- cgit v1.2.3 From fee98b426b5a0c4d78042a2db3b352c4fe79ef56 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Sat, 24 Mar 2012 04:47:28 +0100 Subject: Revert r41bcf657f89d, r3a9fed0ba285, r9adc119e3c2f and re58692653afd (all of them are wrong). --- .../Plugin_VideoDX11/Src/PixelShaderCache.cpp | 28 ++++++++++------------ .../Plugins/Plugin_VideoDX11/Src/VertexManager.cpp | 4 ++-- .../Plugins/Plugin_VideoDX9/Src/VertexManager.cpp | 4 ++-- .../Plugins/Plugin_VideoOGL/Src/VertexManager.cpp | 4 ++-- 4 files changed, 19 insertions(+), 21 deletions(-) (limited to 'Source/Plugins') diff --git a/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp b/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp index fe33c4db80..56f3719057 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/PixelShaderCache.cpp @@ -552,22 +552,20 @@ static const unsigned int ps_constant_offset_table[] = { 16, 20, 24, 28, // C_KCOLORS, 16 32, // C_ALPHA, 4 36, 40, 44, 48, 52, 56, 60, 64, // C_TEXDIMS, 32 - 68, 72, 76, 80, // C_VTEXSCALE, 16 (unused) - 84, 88, // C_ZBIAS, 8 - 92, 96, // C_INDTEXSCALE, 8 - 100, 104, 108, 112, 116, 120, // C_INDTEXMTX, 24 - 124, 128, 132, // C_FOG, 12 - 136, 140, 144, 148, 152, // C_PLIGHTS0, 20 - 156, 160, 164, 168, 172, // C_PLIGHTS1, 20 - 176, 180, 184, 188, 192, // C_PLIGHTS2, 20 - 196, 200, 204, 208, 212, // C_PLIGHTS3, 20 - 216, 220, 224, 228, 232, // C_PLIGHTS4, 20 - 236, 240, 244, 248, 252, // C_PLIGHTS5, 20 - 256, 260, 264, 268, 272, // C_PLIGHTS6, 20 - 276, 280, 284, 288, 292, // C_PLIGHTS7, 20 - 296, 300, 304, 308, // C_PMATERIALS, 16 + 68, 72, // C_ZBIAS, 8 + 76, 80, // C_INDTEXSCALE, 8 + 84, 88, 92, 96, 100, 104, // C_INDTEXMTX, 24 + 108, 112, 116, // C_FOG, 12 + 120, 124, 128, 132, 136, // C_PLIGHTS0, 20 + 140, 144, 148, 152, 156, // C_PLIGHTS1, 20 + 160, 164, 168, 172, 176, // C_PLIGHTS2, 20 + 180, 184, 188, 192, 196, // C_PLIGHTS3, 20 + 200, 204, 208, 212, 216, // C_PLIGHTS4, 20 + 220, 224, 228, 232, 236, // C_PLIGHTS5, 20 + 240, 244, 248, 252, 256, // C_PLIGHTS6, 20 + 260, 264, 268, 272, 276, // C_PLIGHTS7, 20 + 280, 284, 288, 292 // C_PMATERIALS, 16 }; - void Renderer::SetPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4) { psconstants[ps_constant_offset_table[const_number] ] = f1; diff --git a/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp index 1079863347..d0f5a1c338 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp @@ -234,7 +234,7 @@ void VertexManager::vFlush() if (tentry) { // 0s are probably for no manual wrapping needed. - PixelShaderManager::SetTexDims(i, tentry->native_width, tentry->native_height, tentry->virtual_width, tentry->virtual_height, 0, 0, API_D3D11); + PixelShaderManager::SetTexDims(i, tentry->native_width, tentry->native_height, 0, 0); } else ERROR_LOG(VIDEO, "error loading texture"); @@ -243,7 +243,7 @@ void VertexManager::vFlush() // set global constants VertexShaderManager::SetConstants(); - PixelShaderManager::SetConstants(API_D3D11); + PixelShaderManager::SetConstants(); bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate && bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24; diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp index 2083d4f1d8..c4e8225db1 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp @@ -143,7 +143,7 @@ void VertexManager::vFlush() if (tentry) { // 0s are probably for no manual wrapping needed. - PixelShaderManager::SetTexDims(i, tentry->native_width, tentry->native_height, tentry->virtual_width, tentry->virtual_height, 0, 0, API_D3D9); + PixelShaderManager::SetTexDims(i, tentry->native_width, tentry->native_height, 0, 0); } else ERROR_LOG(VIDEO, "error loading texture"); @@ -152,7 +152,7 @@ void VertexManager::vFlush() // set global constants VertexShaderManager::SetConstants(); - PixelShaderManager::SetConstants(API_D3D9); + PixelShaderManager::SetConstants(); if (!PixelShaderCache::SetShader(DSTALPHA_NONE,g_nativeVertexFmt->m_components)) { diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp index 5117f6ddb6..dff7f8299e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp @@ -161,7 +161,7 @@ void VertexManager::vFlush() if (tentry) { // 0s are probably for no manual wrapping needed. - PixelShaderManager::SetTexDims(i, tentry->native_width, tentry->native_height, tentry->virtual_width, tentry->virtual_height, 0, 0, API_OPENGL); + PixelShaderManager::SetTexDims(i, tentry->native_width, tentry->native_height, 0, 0); if (g_ActiveConfig.iLog & CONF_SAVETEXTURES) { @@ -179,7 +179,7 @@ void VertexManager::vFlush() // set global constants VertexShaderManager::SetConstants(); - PixelShaderManager::SetConstants(API_OPENGL); + PixelShaderManager::SetConstants(); bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate && bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24; -- cgit v1.2.3 From 450dcc9d2cd874f6ab40d4a339afc29f55751319 Mon Sep 17 00:00:00 2001 From: rodolfoosvaldobogado Date: Tue, 27 Mar 2012 15:44:58 -0300 Subject: As requested, this is my implementation of zcomploc using a multi-pass algorithm. My apologize to the others devs for committing in the main branch but is the only way to get this tested as soon as possible. please test for regressions, speed and for other issues fixed, as a example, the black color in water splash in super mario galaxy are fixed with this rev. please as soon as yo find a bug let me know. --- Source/Plugins/Plugin_VideoDX11/Src/Render.cpp | 8 ++--- Source/Plugins/Plugin_VideoDX11/Src/Render.h | 4 +-- .../Plugins/Plugin_VideoDX11/Src/VertexManager.cpp | 4 +-- Source/Plugins/Plugin_VideoDX9/Src/Render.cpp | 33 +++++++++++++++++--- Source/Plugins/Plugin_VideoDX9/Src/Render.h | 4 +-- .../Plugins/Plugin_VideoDX9/Src/VertexManager.cpp | 36 +++++++++++++++++----- Source/Plugins/Plugin_VideoOGL/Src/Render.h | 4 +-- 7 files changed, 68 insertions(+), 25 deletions(-) (limited to 'Source/Plugins') diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp index 941bcef4ba..1c40d3c3b1 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp @@ -1211,11 +1211,11 @@ void Renderer::RestoreAPIState() BPFunctions::SetScissor(); } -void Renderer::ApplyState(bool bUseDstAlpha) +void Renderer::ApplyState(RenderStateMode mode) { HRESULT hr; - if (bUseDstAlpha) + if (mode == RSM_UseDstAlpha) { // Colors should blend against SRC1_ALPHA if (gx_state.blenddc.RenderTarget[0].SrcBlend == D3D11_BLEND_SRC_ALPHA) @@ -1275,7 +1275,7 @@ void Renderer::ApplyState(bool bUseDstAlpha) D3D::stateman->Apply(); - if (bUseDstAlpha) + if (mode == RSM_UseDstAlpha) { // restore actual state SetBlendMode(false); @@ -1289,7 +1289,7 @@ void Renderer::ApplyState(bool bUseDstAlpha) D3D::context->VSSetShader(VertexShaderCache::GetActiveShader(), NULL, 0); } -void Renderer::RestoreState() +void Renderer::RestoreState(RenderStateMode mode) { ID3D11ShaderResourceView* shader_resources[8] = { NULL }; D3D::context->PSSetShaderResources(0, 8, shader_resources); diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.h b/Source/Plugins/Plugin_VideoDX11/Src/Render.h index 8f6c78fae1..64a05b280a 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/Render.h +++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.h @@ -25,8 +25,8 @@ public: void SetInterlacingMode(); // TODO: Fix confusing names (see ResetAPIState and RestoreAPIState) - void ApplyState(bool bUseDstAlpha); - void RestoreState(); + void ApplyState(RenderStateMode mode); + void RestoreState(RenderStateMode mode); void ApplyCullDisable(); void RestoreCull(); diff --git a/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp index d0f5a1c338..e5995ec13d 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp @@ -264,13 +264,13 @@ void VertexManager::vFlush() unsigned int stride = g_nativeVertexFmt->GetVertexStride(); g_nativeVertexFmt->SetupVertexPointers(); - g_renderer->ApplyState(useDstAlpha); + g_renderer->ApplyState(useDstAlpha ? RSM_UseDstAlpha : RSM_None); LoadBuffers(); Draw(stride); GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true); - g_renderer->RestoreState(); + g_renderer->RestoreState(useDstAlpha ? RSM_UseDstAlpha : RSM_None); shader_fail: ResetBuffer(); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index a5aaa6485b..5d836ec6ed 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -1204,19 +1204,42 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons XFBWrited = false; } -void Renderer::ApplyState(bool bUseDstAlpha) +void Renderer::ApplyState(RenderStateMode mode) { - if (bUseDstAlpha) + if(mode == RSM_Zcomploc) + { + D3D::ChangeRenderState(D3DRS_COLORWRITEENABLE, 0); + } + else if(mode == RSM_Multipass) + { + D3D::ChangeRenderState(D3DRS_ZENABLE, TRUE); + D3D::ChangeRenderState(D3DRS_ZWRITEENABLE, false); + D3D::ChangeRenderState(D3DRS_ZFUNC, D3DCMP_EQUAL); + } + else if (mode == RSM_UseDstAlpha) { D3D::ChangeRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA); D3D::ChangeRenderState(D3DRS_ALPHABLENDENABLE, false); } } -void Renderer::RestoreState() +void Renderer::RestoreState(RenderStateMode mode) { - D3D::RefreshRenderState(D3DRS_COLORWRITEENABLE); - D3D::RefreshRenderState(D3DRS_ALPHABLENDENABLE); + if(mode == RSM_Zcomploc) + { + D3D::RefreshRenderState(D3DRS_COLORWRITEENABLE); + } + else if(mode == RSM_Multipass) + { + D3D::RefreshRenderState(D3DRS_ZENABLE); + D3D::RefreshRenderState(D3DRS_ZWRITEENABLE); + D3D::RefreshRenderState(D3DRS_ZFUNC); + } + else if(mode == RSM_UseDstAlpha) + { + D3D::RefreshRenderState(D3DRS_COLORWRITEENABLE); + D3D::RefreshRenderState(D3DRS_ALPHABLENDENABLE); + } // TODO: Enable this code. Caused glitches for me however (neobrain) // for (unsigned int i = 0; i < 8; ++i) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.h b/Source/Plugins/Plugin_VideoDX9/Src/Render.h index 6e5198b3cd..58716a679b 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.h @@ -24,8 +24,8 @@ public: void SetSamplerState(int stage,int texindex); void SetInterlacingMode(); - void ApplyState(bool bUseDstAlpha); - void RestoreState(); + void ApplyState(RenderStateMode mode); + void RestoreState(RenderStateMode mode); void RenderText(const char* pstr, int left, int top, u32 color); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp index c4e8225db1..82ee8d1623 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp @@ -154,11 +154,6 @@ void VertexManager::vFlush() VertexShaderManager::SetConstants(); PixelShaderManager::SetConstants(); - if (!PixelShaderCache::SetShader(DSTALPHA_NONE,g_nativeVertexFmt->m_components)) - { - GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");}); - goto shader_fail; - } if (!VertexShaderCache::SetShader(g_nativeVertexFmt->m_components)) { GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set vertex shader\n");}); @@ -168,6 +163,25 @@ void VertexManager::vFlush() int stride = g_nativeVertexFmt->GetVertexStride(); g_nativeVertexFmt->SetupVertexPointers(); + bool UseZcomploc = bpmem.zcontrol.zcomploc && bpmem.zmode.updateenable && g_ActiveConfig.bAcurateZcomploc; + if (UseZcomploc) + { + if (!PixelShaderCache::SetShader(DSTALPHA_ZCOMPLOC,g_nativeVertexFmt->m_components)) + { + GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");}); + goto shader_fail; + } + g_renderer->ApplyState(RSM_Zcomploc); + Draw(stride); + g_renderer->RestoreState(RSM_Zcomploc); + g_renderer->ApplyState(RSM_Multipass); + } + + if (!PixelShaderCache::SetShader(DSTALPHA_NONE,g_nativeVertexFmt->m_components)) + { + GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");}); + goto shader_fail; + } Draw(stride); @@ -175,16 +189,22 @@ void VertexManager::vFlush() bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24; if (useDstAlpha) { - DWORD write = 0; if (!PixelShaderCache::SetShader(DSTALPHA_ALPHA_PASS, g_nativeVertexFmt->m_components)) { GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");}); goto shader_fail; } // update alpha only - g_renderer->ApplyState(true); + g_renderer->ApplyState(RSM_UseDstAlpha); + if(!UseZcomploc && bpmem.zmode.updateenable) + g_renderer->ApplyState(RSM_Multipass); Draw(stride); - g_renderer->RestoreState(); + g_renderer->RestoreState(RSM_UseDstAlpha); + } + + if (UseZcomploc || (useDstAlpha && bpmem.zmode.updateenable)) + { + g_renderer->RestoreState(RSM_Multipass); } GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.h b/Source/Plugins/Plugin_VideoOGL/Src/Render.h index 9cf1573b56..5a184dceeb 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.h @@ -27,8 +27,8 @@ public: void SetInterlacingMode(); // TODO: Implement and use these - void ApplyState(bool bUseDstAlpha) {} - void RestoreState() {} + void ApplyState(RenderStateMode mode){} + void RestoreState(RenderStateMode mode){} void RenderText(const char* pstr, int left, int top, u32 color); void DrawDebugInfo(); -- cgit v1.2.3 From 48d8d71391fc2cc40d85732680eb6421164bf87c Mon Sep 17 00:00:00 2001 From: rodolfoosvaldobogado Date: Tue, 27 Mar 2012 23:14:59 -0300 Subject: Fix for my last commit, this must fix the problem in the algorithm pointed by neobrain. thanks --- .../Plugins/Plugin_VideoDX9/Src/VertexManager.cpp | 39 +++++++++++----------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'Source/Plugins') diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp index 82ee8d1623..8dd13f3e3b 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp @@ -154,6 +154,9 @@ void VertexManager::vFlush() VertexShaderManager::SetConstants(); PixelShaderManager::SetConstants(); + int stride = g_nativeVertexFmt->GetVertexStride(); + g_nativeVertexFmt->SetupVertexPointers(); + if (!VertexShaderCache::SetShader(g_nativeVertexFmt->m_components)) { GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set vertex shader\n");}); @@ -161,22 +164,6 @@ void VertexManager::vFlush() } - int stride = g_nativeVertexFmt->GetVertexStride(); - g_nativeVertexFmt->SetupVertexPointers(); - bool UseZcomploc = bpmem.zcontrol.zcomploc && bpmem.zmode.updateenable && g_ActiveConfig.bAcurateZcomploc; - if (UseZcomploc) - { - if (!PixelShaderCache::SetShader(DSTALPHA_ZCOMPLOC,g_nativeVertexFmt->m_components)) - { - GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");}); - goto shader_fail; - } - g_renderer->ApplyState(RSM_Zcomploc); - Draw(stride); - g_renderer->RestoreState(RSM_Zcomploc); - g_renderer->ApplyState(RSM_Multipass); - } - if (!PixelShaderCache::SetShader(DSTALPHA_NONE,g_nativeVertexFmt->m_components)) { GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");}); @@ -196,16 +183,28 @@ void VertexManager::vFlush() } // update alpha only g_renderer->ApplyState(RSM_UseDstAlpha); - if(!UseZcomploc && bpmem.zmode.updateenable) + if (bpmem.zmode.updateenable) g_renderer->ApplyState(RSM_Multipass); Draw(stride); g_renderer->RestoreState(RSM_UseDstAlpha); + if (bpmem.zmode.updateenable) + g_renderer->RestoreState(RSM_Multipass); } - - if (UseZcomploc || (useDstAlpha && bpmem.zmode.updateenable)) + + bool UseZcomploc = bpmem.zcontrol.zcomploc && bpmem.zmode.updateenable && g_ActiveConfig.bAcurateZcomploc; + + if (UseZcomploc) { - g_renderer->RestoreState(RSM_Multipass); + if (!PixelShaderCache::SetShader(DSTALPHA_ZCOMPLOC,g_nativeVertexFmt->m_components)) + { + GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");}); + goto shader_fail; + } + g_renderer->ApplyState(RSM_Zcomploc); + Draw(stride); + g_renderer->RestoreState(RSM_Zcomploc); } + GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true); shader_fail: -- cgit v1.2.3 From 402006a83a89bc0f790934096e915f0e8c23f808 Mon Sep 17 00:00:00 2001 From: rodolfoosvaldobogado Date: Thu, 29 Mar 2012 18:26:58 -0300 Subject: more fixes to zcomplock and opengl implementation --- Source/Plugins/Plugin_VideoDX9/Src/Render.cpp | 3 +- .../Plugins/Plugin_VideoDX9/Src/VertexManager.cpp | 2 +- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 37 ++++++++++++++++++++++ Source/Plugins/Plugin_VideoOGL/Src/Render.h | 5 ++- .../Plugins/Plugin_VideoOGL/Src/VertexManager.cpp | 25 ++++++++++----- 5 files changed, 59 insertions(+), 13 deletions(-) (limited to 'Source/Plugins') diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index 5d836ec6ed..d3de48b190 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -1211,7 +1211,7 @@ void Renderer::ApplyState(RenderStateMode mode) D3D::ChangeRenderState(D3DRS_COLORWRITEENABLE, 0); } else if(mode == RSM_Multipass) - { + { D3D::ChangeRenderState(D3DRS_ZENABLE, TRUE); D3D::ChangeRenderState(D3DRS_ZWRITEENABLE, false); D3D::ChangeRenderState(D3DRS_ZFUNC, D3DCMP_EQUAL); @@ -1231,6 +1231,7 @@ void Renderer::RestoreState(RenderStateMode mode) } else if(mode == RSM_Multipass) { + D3D::RefreshRenderState(D3DRS_ALPHABLENDENABLE); D3D::RefreshRenderState(D3DRS_ZENABLE); D3D::RefreshRenderState(D3DRS_ZWRITEENABLE); D3D::RefreshRenderState(D3DRS_ZFUNC); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp index 8dd13f3e3b..af5bc3c839 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp @@ -191,7 +191,7 @@ void VertexManager::vFlush() g_renderer->RestoreState(RSM_Multipass); } - bool UseZcomploc = bpmem.zcontrol.zcomploc && bpmem.zmode.updateenable && g_ActiveConfig.bAcurateZcomploc; + bool UseZcomploc = bpmem.zcontrol.zcomploc && bpmem.zmode.updateenable && !g_ActiveConfig.bEnableFastZcomploc; if (UseZcomploc) { diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 9883d35fbb..6b0a3f1481 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -632,6 +632,43 @@ void Renderer::SetScissorRect(const TargetRectangle& rc) glScissor(rc.left, rc.bottom, rc.GetWidth(), rc.GetHeight()); } +void Renderer::ApplyState(RenderStateMode mode) +{ + if(mode == RSM_Zcomploc) + { + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + } + else if(mode == RSM_Multipass) + { + glEnable(GL_DEPTH_TEST); + glDepthMask(GL_FALSE); + glDepthFunc(GL_EQUAL); + } + else if (mode == RSM_UseDstAlpha) + { + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); + glDisable(GL_BLEND); + } +} + +void Renderer::RestoreState(RenderStateMode mode) +{ + if(mode == RSM_Zcomploc) + { + SetColorMask(); + } + else if(mode == RSM_Multipass) + { + SetDepthMode(); + } + else if (mode == RSM_UseDstAlpha) + { + SetColorMask(); + if (bpmem.blendmode.blendenable || bpmem.blendmode.subtract) + glEnable(GL_BLEND); + } +} + void Renderer::SetColorMask() { // Only enable alpha channel if it's supported by the current EFB format diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.h b/Source/Plugins/Plugin_VideoOGL/Src/Render.h index 5a184dceeb..ca87adea6b 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.h @@ -26,9 +26,8 @@ public: void SetSamplerState(int stage,int texindex); void SetInterlacingMode(); - // TODO: Implement and use these - void ApplyState(RenderStateMode mode){} - void RestoreState(RenderStateMode mode){} + void ApplyState(RenderStateMode mode); + void RestoreState(RenderStateMode mode); void RenderText(const char* pstr, int left, int top, u32 color); void DrawDebugInfo(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp index dff7f8299e..dacb0f3b0e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp @@ -224,17 +224,26 @@ void VertexManager::vFlush() ps = PixelShaderCache::SetShader(DSTALPHA_ALPHA_PASS,g_nativeVertexFmt->m_components); if (ps) PixelShaderCache::SetCurrentShader(ps->glprogid); - // only update alpha - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); - - glDisable(GL_BLEND); + g_renderer->ApplyState(RSM_UseDstAlpha); + if (bpmem.zmode.updateenable) + g_renderer->ApplyState(RSM_Multipass); Draw(); - // restore color mask - g_renderer->SetColorMask(); + + g_renderer->RestoreState(RSM_UseDstAlpha); + if (bpmem.zmode.updateenable) + g_renderer->RestoreState(RSM_Multipass); + } + + bool UseZcomploc = bpmem.zcontrol.zcomploc && bpmem.zmode.updateenable && !g_ActiveConfig.bEnableFastZcomploc; - if (bpmem.blendmode.blendenable || bpmem.blendmode.subtract) - glEnable(GL_BLEND); + if (UseZcomploc) + { + FRAGMENTSHADER* ps = PixelShaderCache::SetShader(DSTALPHA_ZCOMPLOC,g_nativeVertexFmt->m_components); + if (ps) PixelShaderCache::SetCurrentShader(ps->glprogid); + g_renderer->ApplyState(RSM_Zcomploc); + Draw(); + g_renderer->RestoreState(RSM_Zcomploc); } GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true); -- cgit v1.2.3 From 460610ea0e0d5083e261ed9d137048f2a5fc7e59 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Fri, 30 Mar 2012 01:56:24 +0200 Subject: Revert Rodolfo's recent zcomploc commits until they actually work correctly. This reverts commit 402006a83a89bc0f790934096e915f0e8c23f808. This reverts commit 48d8d71391fc2cc40d85732680eb6421164bf87c. This reverts commit 450dcc9d2cd874f6ab40d4a339afc29f55751319. --- Source/Plugins/Plugin_VideoDX11/Src/Render.cpp | 8 ++--- Source/Plugins/Plugin_VideoDX11/Src/Render.h | 4 +-- .../Plugins/Plugin_VideoDX11/Src/VertexManager.cpp | 4 +-- Source/Plugins/Plugin_VideoDX9/Src/Render.cpp | 34 +++---------------- Source/Plugins/Plugin_VideoDX9/Src/Render.h | 4 +-- .../Plugins/Plugin_VideoDX9/Src/VertexManager.cpp | 39 ++++++---------------- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 37 -------------------- Source/Plugins/Plugin_VideoOGL/Src/Render.h | 5 +-- .../Plugins/Plugin_VideoOGL/Src/VertexManager.cpp | 25 +++++--------- 9 files changed, 36 insertions(+), 124 deletions(-) (limited to 'Source/Plugins') diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp index 1c40d3c3b1..941bcef4ba 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp @@ -1211,11 +1211,11 @@ void Renderer::RestoreAPIState() BPFunctions::SetScissor(); } -void Renderer::ApplyState(RenderStateMode mode) +void Renderer::ApplyState(bool bUseDstAlpha) { HRESULT hr; - if (mode == RSM_UseDstAlpha) + if (bUseDstAlpha) { // Colors should blend against SRC1_ALPHA if (gx_state.blenddc.RenderTarget[0].SrcBlend == D3D11_BLEND_SRC_ALPHA) @@ -1275,7 +1275,7 @@ void Renderer::ApplyState(RenderStateMode mode) D3D::stateman->Apply(); - if (mode == RSM_UseDstAlpha) + if (bUseDstAlpha) { // restore actual state SetBlendMode(false); @@ -1289,7 +1289,7 @@ void Renderer::ApplyState(RenderStateMode mode) D3D::context->VSSetShader(VertexShaderCache::GetActiveShader(), NULL, 0); } -void Renderer::RestoreState(RenderStateMode mode) +void Renderer::RestoreState() { ID3D11ShaderResourceView* shader_resources[8] = { NULL }; D3D::context->PSSetShaderResources(0, 8, shader_resources); diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.h b/Source/Plugins/Plugin_VideoDX11/Src/Render.h index 64a05b280a..8f6c78fae1 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/Render.h +++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.h @@ -25,8 +25,8 @@ public: void SetInterlacingMode(); // TODO: Fix confusing names (see ResetAPIState and RestoreAPIState) - void ApplyState(RenderStateMode mode); - void RestoreState(RenderStateMode mode); + void ApplyState(bool bUseDstAlpha); + void RestoreState(); void ApplyCullDisable(); void RestoreCull(); diff --git a/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp index e5995ec13d..d0f5a1c338 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp @@ -264,13 +264,13 @@ void VertexManager::vFlush() unsigned int stride = g_nativeVertexFmt->GetVertexStride(); g_nativeVertexFmt->SetupVertexPointers(); - g_renderer->ApplyState(useDstAlpha ? RSM_UseDstAlpha : RSM_None); + g_renderer->ApplyState(useDstAlpha); LoadBuffers(); Draw(stride); GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true); - g_renderer->RestoreState(useDstAlpha ? RSM_UseDstAlpha : RSM_None); + g_renderer->RestoreState(); shader_fail: ResetBuffer(); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index d3de48b190..a5aaa6485b 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -1204,43 +1204,19 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons XFBWrited = false; } -void Renderer::ApplyState(RenderStateMode mode) +void Renderer::ApplyState(bool bUseDstAlpha) { - if(mode == RSM_Zcomploc) - { - D3D::ChangeRenderState(D3DRS_COLORWRITEENABLE, 0); - } - else if(mode == RSM_Multipass) - { - D3D::ChangeRenderState(D3DRS_ZENABLE, TRUE); - D3D::ChangeRenderState(D3DRS_ZWRITEENABLE, false); - D3D::ChangeRenderState(D3DRS_ZFUNC, D3DCMP_EQUAL); - } - else if (mode == RSM_UseDstAlpha) + if (bUseDstAlpha) { D3D::ChangeRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA); D3D::ChangeRenderState(D3DRS_ALPHABLENDENABLE, false); } } -void Renderer::RestoreState(RenderStateMode mode) +void Renderer::RestoreState() { - if(mode == RSM_Zcomploc) - { - D3D::RefreshRenderState(D3DRS_COLORWRITEENABLE); - } - else if(mode == RSM_Multipass) - { - D3D::RefreshRenderState(D3DRS_ALPHABLENDENABLE); - D3D::RefreshRenderState(D3DRS_ZENABLE); - D3D::RefreshRenderState(D3DRS_ZWRITEENABLE); - D3D::RefreshRenderState(D3DRS_ZFUNC); - } - else if(mode == RSM_UseDstAlpha) - { - D3D::RefreshRenderState(D3DRS_COLORWRITEENABLE); - D3D::RefreshRenderState(D3DRS_ALPHABLENDENABLE); - } + D3D::RefreshRenderState(D3DRS_COLORWRITEENABLE); + D3D::RefreshRenderState(D3DRS_ALPHABLENDENABLE); // TODO: Enable this code. Caused glitches for me however (neobrain) // for (unsigned int i = 0; i < 8; ++i) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.h b/Source/Plugins/Plugin_VideoDX9/Src/Render.h index 58716a679b..6e5198b3cd 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.h @@ -24,8 +24,8 @@ public: void SetSamplerState(int stage,int texindex); void SetInterlacingMode(); - void ApplyState(RenderStateMode mode); - void RestoreState(RenderStateMode mode); + void ApplyState(bool bUseDstAlpha); + void RestoreState(); void RenderText(const char* pstr, int left, int top, u32 color); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp index af5bc3c839..c4e8225db1 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp @@ -154,9 +154,11 @@ void VertexManager::vFlush() VertexShaderManager::SetConstants(); PixelShaderManager::SetConstants(); - int stride = g_nativeVertexFmt->GetVertexStride(); - g_nativeVertexFmt->SetupVertexPointers(); - + if (!PixelShaderCache::SetShader(DSTALPHA_NONE,g_nativeVertexFmt->m_components)) + { + GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");}); + goto shader_fail; + } if (!VertexShaderCache::SetShader(g_nativeVertexFmt->m_components)) { GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set vertex shader\n");}); @@ -164,11 +166,8 @@ void VertexManager::vFlush() } - if (!PixelShaderCache::SetShader(DSTALPHA_NONE,g_nativeVertexFmt->m_components)) - { - GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");}); - goto shader_fail; - } + int stride = g_nativeVertexFmt->GetVertexStride(); + g_nativeVertexFmt->SetupVertexPointers(); Draw(stride); @@ -176,35 +175,17 @@ void VertexManager::vFlush() bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24; if (useDstAlpha) { + DWORD write = 0; if (!PixelShaderCache::SetShader(DSTALPHA_ALPHA_PASS, g_nativeVertexFmt->m_components)) { GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");}); goto shader_fail; } // update alpha only - g_renderer->ApplyState(RSM_UseDstAlpha); - if (bpmem.zmode.updateenable) - g_renderer->ApplyState(RSM_Multipass); - Draw(stride); - g_renderer->RestoreState(RSM_UseDstAlpha); - if (bpmem.zmode.updateenable) - g_renderer->RestoreState(RSM_Multipass); - } - - bool UseZcomploc = bpmem.zcontrol.zcomploc && bpmem.zmode.updateenable && !g_ActiveConfig.bEnableFastZcomploc; - - if (UseZcomploc) - { - if (!PixelShaderCache::SetShader(DSTALPHA_ZCOMPLOC,g_nativeVertexFmt->m_components)) - { - GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");}); - goto shader_fail; - } - g_renderer->ApplyState(RSM_Zcomploc); + g_renderer->ApplyState(true); Draw(stride); - g_renderer->RestoreState(RSM_Zcomploc); + g_renderer->RestoreState(); } - GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true); shader_fail: diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 6b0a3f1481..9883d35fbb 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -632,43 +632,6 @@ void Renderer::SetScissorRect(const TargetRectangle& rc) glScissor(rc.left, rc.bottom, rc.GetWidth(), rc.GetHeight()); } -void Renderer::ApplyState(RenderStateMode mode) -{ - if(mode == RSM_Zcomploc) - { - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - } - else if(mode == RSM_Multipass) - { - glEnable(GL_DEPTH_TEST); - glDepthMask(GL_FALSE); - glDepthFunc(GL_EQUAL); - } - else if (mode == RSM_UseDstAlpha) - { - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); - glDisable(GL_BLEND); - } -} - -void Renderer::RestoreState(RenderStateMode mode) -{ - if(mode == RSM_Zcomploc) - { - SetColorMask(); - } - else if(mode == RSM_Multipass) - { - SetDepthMode(); - } - else if (mode == RSM_UseDstAlpha) - { - SetColorMask(); - if (bpmem.blendmode.blendenable || bpmem.blendmode.subtract) - glEnable(GL_BLEND); - } -} - void Renderer::SetColorMask() { // Only enable alpha channel if it's supported by the current EFB format diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.h b/Source/Plugins/Plugin_VideoOGL/Src/Render.h index ca87adea6b..9cf1573b56 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.h @@ -26,8 +26,9 @@ public: void SetSamplerState(int stage,int texindex); void SetInterlacingMode(); - void ApplyState(RenderStateMode mode); - void RestoreState(RenderStateMode mode); + // TODO: Implement and use these + void ApplyState(bool bUseDstAlpha) {} + void RestoreState() {} void RenderText(const char* pstr, int left, int top, u32 color); void DrawDebugInfo(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp index dacb0f3b0e..dff7f8299e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp @@ -224,26 +224,17 @@ void VertexManager::vFlush() ps = PixelShaderCache::SetShader(DSTALPHA_ALPHA_PASS,g_nativeVertexFmt->m_components); if (ps) PixelShaderCache::SetCurrentShader(ps->glprogid); - g_renderer->ApplyState(RSM_UseDstAlpha); - if (bpmem.zmode.updateenable) - g_renderer->ApplyState(RSM_Multipass); + // only update alpha + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); - Draw(); - - g_renderer->RestoreState(RSM_UseDstAlpha); - if (bpmem.zmode.updateenable) - g_renderer->RestoreState(RSM_Multipass); - } - - bool UseZcomploc = bpmem.zcontrol.zcomploc && bpmem.zmode.updateenable && !g_ActiveConfig.bEnableFastZcomploc; + glDisable(GL_BLEND); - if (UseZcomploc) - { - FRAGMENTSHADER* ps = PixelShaderCache::SetShader(DSTALPHA_ZCOMPLOC,g_nativeVertexFmt->m_components); - if (ps) PixelShaderCache::SetCurrentShader(ps->glprogid); - g_renderer->ApplyState(RSM_Zcomploc); Draw(); - g_renderer->RestoreState(RSM_Zcomploc); + // restore color mask + g_renderer->SetColorMask(); + + if (bpmem.blendmode.blendenable || bpmem.blendmode.subtract) + glEnable(GL_BLEND); } GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true); -- cgit v1.2.3 From ec0ddb476ebea7d40bc11333264c42eacea936dc Mon Sep 17 00:00:00 2001 From: skidau Date: Sun, 6 May 2012 10:51:38 +1000 Subject: Fixed texture encoding in DX11. Thanks to wordmanwords for the patch. --- .../Plugin_VideoDX11/Src/PSTextureEncoder.cpp | 70 +++++++++++++--------- 1 file changed, 43 insertions(+), 27 deletions(-) (limited to 'Source/Plugins') diff --git a/Source/Plugins/Plugin_VideoDX11/Src/PSTextureEncoder.cpp b/Source/Plugins/Plugin_VideoDX11/Src/PSTextureEncoder.cpp index aa96aac51d..d62517e99b 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/PSTextureEncoder.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/PSTextureEncoder.cpp @@ -156,18 +156,34 @@ static const char EFB_ENCODE_PS[] = "return (a << 16) | b;\n" "}\n" +"uint Float8ToUint3(float v) {\n" + "return (uint)(v*255.0) >> 5;\n" +"}\n" + +"uint Float8ToUint4(float v) {\n" + "return (uint)(v*255.0) >> 4;\n" +"}\n" + +"uint Float8ToUint5(float v) {\n" + "return (uint)(v*255.0) >> 3;\n" +"}\n" + +"uint Float8ToUint6(float v) {\n" + "return (uint)(v*255.0) >> 2;\n" +"}\n" + "uint EncodeRGB5A3(float4 pixel) {\n" "if (pixel.a >= 224.0/255.0) {\n" // Encode to ARGB1555 - "return UINT_1555(1, pixel.r*31, pixel.g*31, pixel.b*31);\n" + "return UINT_1555(1, Float8ToUint5(pixel.r), Float8ToUint5(pixel.g), Float8ToUint5(pixel.b));\n" "} else {\n" // Encode to ARGB3444 - "return UINT_3444(pixel.a*7, pixel.r*15, pixel.g*15, pixel.b*15);\n" + "return UINT_3444(Float8ToUint3(pixel.a), Float8ToUint4(pixel.r), Float8ToUint4(pixel.g), Float8ToUint4(pixel.b));\n" "}\n" "}\n" "uint EncodeRGB565(float4 pixel) {\n" - "return UINT_565(pixel.r*31, pixel.g*63, pixel.b*31);\n" + "return UINT_565(Float8ToUint5(pixel.r), Float8ToUint6(pixel.g), Float8ToUint5(pixel.b));\n" "}\n" "float2 CalcTexCoord(float2 coord)\n" @@ -385,14 +401,14 @@ static const char EFB_ENCODE_PS[] = "uint dw[4];\n" "for (uint i = 0; i < 4; ++i) {\n" "dw[i] = UINT_44444444_BE(\n" - "15*sample[8*i+0].r,\n" - "15*sample[8*i+1].r,\n" - "15*sample[8*i+2].r,\n" - "15*sample[8*i+3].r,\n" - "15*sample[8*i+4].r,\n" - "15*sample[8*i+5].r,\n" - "15*sample[8*i+6].r,\n" - "15*sample[8*i+7].r\n" + "Float8ToUint4(sample[8*i+0].r),\n" + "Float8ToUint4(sample[8*i+1].r),\n" + "Float8ToUint4(sample[8*i+2].r),\n" + "Float8ToUint4(sample[8*i+3].r),\n" + "Float8ToUint4(sample[8*i+4].r),\n" + "Float8ToUint4(sample[8*i+5].r),\n" + "Float8ToUint4(sample[8*i+6].r),\n" + "Float8ToUint4(sample[8*i+7].r)\n" ");\n" "}\n" @@ -460,28 +476,28 @@ static const char EFB_ENCODE_PS[] = "float4 sampleF = SampleEFB(subBlockUL+float2(7,1));\n" "uint dw0 = UINT_44444444_BE(\n" - "15*sample0.a, 15*sample0.r,\n" - "15*sample1.a, 15*sample1.r,\n" - "15*sample2.a, 15*sample2.r,\n" - "15*sample3.a, 15*sample3.r\n" + "Float8ToUint4(sample0.a), Float8ToUint4(sample0.r),\n" + "Float8ToUint4(sample1.a), Float8ToUint4(sample1.r),\n" + "Float8ToUint4(sample2.a), Float8ToUint4(sample2.r),\n" + "Float8ToUint4(sample3.a), Float8ToUint4(sample3.r)\n" ");\n" "uint dw1 = UINT_44444444_BE(\n" - "15*sample4.a, 15*sample4.r,\n" - "15*sample5.a, 15*sample5.r,\n" - "15*sample6.a, 15*sample6.r,\n" - "15*sample7.a, 15*sample7.r\n" + "Float8ToUint4(sample4.a), Float8ToUint4(sample4.r),\n" + "Float8ToUint4(sample5.a), Float8ToUint4(sample5.r),\n" + "Float8ToUint4(sample6.a), Float8ToUint4(sample6.r),\n" + "Float8ToUint4(sample7.a), Float8ToUint4(sample7.r)\n" ");\n" "uint dw2 = UINT_44444444_BE(\n" - "15*sample8.a, 15*sample8.r,\n" - "15*sample9.a, 15*sample9.r,\n" - "15*sampleA.a, 15*sampleA.r,\n" - "15*sampleB.a, 15*sampleB.r\n" + "Float8ToUint4(sample8.a), Float8ToUint4(sample8.r),\n" + "Float8ToUint4(sample9.a), Float8ToUint4(sample9.r),\n" + "Float8ToUint4(sampleA.a), Float8ToUint4(sampleA.r),\n" + "Float8ToUint4(sampleB.a), Float8ToUint4(sampleB.r)\n" ");\n" "uint dw3 = UINT_44444444_BE(\n" - "15*sampleC.a, 15*sampleC.r,\n" - "15*sampleD.a, 15*sampleD.r,\n" - "15*sampleE.a, 15*sampleE.r,\n" - "15*sampleF.a, 15*sampleF.r\n" + "Float8ToUint4(sampleC.a), Float8ToUint4(sampleC.r),\n" + "Float8ToUint4(sampleD.a), Float8ToUint4(sampleD.r),\n" + "Float8ToUint4(sampleE.a), Float8ToUint4(sampleE.r),\n" + "Float8ToUint4(sampleF.a), Float8ToUint4(sampleF.r)\n" ");\n" "return uint4(dw0, dw1, dw2, dw3);\n" -- cgit v1.2.3