Skip to content

Commit

Permalink
Fix single component selection for "oFog" output in vertex shaders if…
Browse files Browse the repository at this point in the history
… instruction is "mad" instead of "mov"

Fixes #81
  • Loading branch information
crosire committed Jun 3, 2018
1 parent 25c6edc commit 52a32ef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/d3d8to9_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]))"), "$1 $2$3, $4$5.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.")))
Expand Down

0 comments on commit 52a32ef

Please sign in to comment.