From 1e938f3963dca553e6bbf2896d129c461fadc7ba Mon Sep 17 00:00:00 2001 From: Elisha Riedlinger Date: Tue, 3 Jul 2018 18:52:01 -0700 Subject: [PATCH 1/3] Fix single component selection for "oFog" output in vertex shaders if instruction is "mad" instead of "mov" --- source/d3d8to9_device.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/d3d8to9_device.cpp b/source/d3d8to9_device.cpp index 7ddf0e3..0399677 100644 --- a/source/d3d8to9_device.cpp +++ b/source/d3d8to9_device.cpp @@ -1411,7 +1411,7 @@ HRESULT STDMETHODCALLTYPE Direct3DDevice8::CreateVertexShader(const DWORD *pDecl SourceCode = std::regex_replace(SourceCode, std::regex("(oFog|oPts)\\.x"), "$1 /* removed swizzle */"); SourceCode = std::regex_replace(SourceCode, std::regex("(add|sub|mul|min|max) (oFog|oPts), ([cr][0-9]+), (.+)\\n"), "$1 $2, $3.x /* added swizzle */, $4\n"); SourceCode = std::regex_replace(SourceCode, std::regex("(add|sub|mul|min|max) (oFog|oPts), (.+), ([cr][0-9]+)\\n"), "$1 $2, $3, $4.x /* added swizzle */\n"); - SourceCode = std::regex_replace(SourceCode, std::regex("mov (oFog|oPts)(.*), (-?)([crv][0-9]+(?![\\.0-9]))"), "mov $1$2, $3$4.x /* select single component */"); + SourceCode = std::regex_replace(SourceCode, std::regex("(mov|mad) (oFog|oPts)(.*), (-?)([crv][0-9]+(?![\\.0-9]))"), "mov $1$2, $3$4.x /* select single component */"); // Destination register cannot be the same as first source register for m*x* instructions. if (std::regex_search(SourceCode, std::regex("m.x."))) From 736f1483fe17cba90c1cac7eba11727a6285acfd Mon Sep 17 00:00:00 2001 From: Elisha Riedlinger Date: Sun, 15 Jul 2018 14:41:16 -0700 Subject: [PATCH 2/3] Fix merge issues --- source/d3d8to9_device.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/source/d3d8to9_device.cpp b/source/d3d8to9_device.cpp index 5ae8344..0129c8f 100644 --- a/source/d3d8to9_device.cpp +++ b/source/d3d8to9_device.cpp @@ -1411,11 +1411,7 @@ HRESULT STDMETHODCALLTYPE Direct3DDevice8::CreateVertexShader(const DWORD *pDecl SourceCode = std::regex_replace(SourceCode, std::regex("(oFog|oPts)\\.x"), "$1 /* removed swizzle */"); SourceCode = std::regex_replace(SourceCode, std::regex("(add|sub|mul|min|max) (oFog|oPts), ([cr][0-9]+), (.+)\\n"), "$1 $2, $3.x /* added swizzle */, $4\n"); SourceCode = std::regex_replace(SourceCode, std::regex("(add|sub|mul|min|max) (oFog|oPts), (.+), ([cr][0-9]+)\\n"), "$1 $2, $3, $4.x /* added swizzle */\n"); -<<<<<<< HEAD - SourceCode = std::regex_replace(SourceCode, std::regex("(mov|mad) (oFog|oPts)(.*), (-?)([crv][0-9]+(?![\\.0-9]))"), "mov $1$2, $3$4.x /* select single component */"); -======= SourceCode = std::regex_replace(SourceCode, std::regex("(mov|mad) (oFog|oPts)(.*), (-?)([crv][0-9]+(?![\\.0-9]))"), "$1 $2$3, $4$5.x /* select single component */"); ->>>>>>> refs/remotes/crosire/master // Destination register cannot be the same as first source register for m*x* instructions. if (std::regex_search(SourceCode, std::regex("m.x."))) From c8d4e1dfa6c0b8ae91825d9d5e5eee155bd8ae9a Mon Sep 17 00:00:00 2001 From: Elisha Riedlinger Date: Fri, 24 Aug 2018 19:31:32 -0700 Subject: [PATCH 3/3] Fix vertical sync issue --- source/d3d8types.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/d3d8types.cpp b/source/d3d8types.cpp index 325abb7..d28f2ef 100644 --- a/source/d3d8types.cpp +++ b/source/d3d8types.cpp @@ -147,6 +147,12 @@ void ConvertPresentParameters(D3DPRESENT_PARAMETERS8 &Input, D3DPRESENT_PARAMETE Output.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; } + // D3DPRESENT_INTERVAL_DEFAULT is defined as zero and is equivalent to D3DPRESENT_INTERVAL_ONE in D3D9 + if (Output.PresentationInterval == D3DPRESENT_INTERVAL_DEFAULT) + { + Output.PresentationInterval = D3DPRESENT_INTERVAL_ONE; + } + // D3DSWAPEFFECT_COPY_VSYNC is no longer supported in D3D9 if (Output.SwapEffect == D3DSWAPEFFECT_COPY_VSYNC) {