Commit Graph

6570 Commits

Author SHA1 Message Date
Silent cbe534cb54
Patch D3D_CommonSetRenderTarget 2020-11-02 17:52:55 +01:00
Silent 62af56b67a
Fix D3DDevice_SetPixelShader_0 corrupting the stack 2020-11-02 17:52:54 +01:00
Silent 8b7f4a5027
Patch D3DDevice_SetRenderTarget_0 and factorize implementations
CreateDevice would try to call an inexistant guest trampoline,
but in fact we only needed to call the host implementation
2020-10-31 14:44:13 +01:00
Luke Usher 38242d48f9
Merge pull request #2015 from CookiePLMonster/affinity-fix
Fix affinity for EmuCreateDeviceProxy thread
2020-10-28 16:59:52 +00:00
Silent 16efb84eb9
Fix affinity for EmuCreateDeviceProxy thread 2020-10-28 17:47:34 +01:00
Luke Usher 5fe769b906
Merge pull request #2002 from PatrickvL/ps_const_simplfy
Simplfy pixel shader constant handling;
2020-10-28 13:40:57 +00:00
PatrickvL 44f0aee5d4
Merge pull request #2012 from CookiePLMonster/interlocked-lockcounts
Interlocked lockcounts
2020-10-28 11:20:11 +01:00
PatrickvL b8bb054402 Revert unintentional subhook change 2020-10-27 18:23:00 +01:00
patrickvl c09a90e459 Remap host pixel shader constant indexes, so that all constants can be set using just one call to SetPixelShaderConstantsF
Also, added more notes and code on the PSDef.PSTextureMode field (which lies outside of the render state pixel shader range), and skip the values of the final combiner constants when checking for uniqueness of pixel shader definitions.
2020-10-27 18:22:59 +01:00
patrickvl eae97f3f07 Optimize setting host pixel shader constants, by collecting all values and set them using a single call.
Also remove one more unused variable
2020-10-27 18:22:59 +01:00
patrickvl 337946db25 Simplfy pixel shader constant handling;
Since we've ported over to Direct3D 9, and we're using pixel shader version 1.4, we've got more than enough constants available to remove the need for constant packing.

Also, there was a left-over patch on SetPixelShaderConstant which must no longer be applied, since nowadays we read constant values straight from their corresponding render state slots.
This also implies we no longer need to declare the final combiner constants as part of the shader assembly, because these 2 are also read from their corresponding xbox render state slots, and thus can be transferred to host on each update.

This will likely improve the output of pixel shaders which stay otherwise unchanged but rely on changing constant values.
2020-10-27 18:22:58 +01:00
RadWolfie f8593e692d
Merge pull request #1993 from CookiePLMonster/dsound-improvements-alt
DSound improvements (alternative volume heuristics)
2020-10-26 17:29:31 -05:00
Silent dd0e331528
Thread safety fixes for ERWLOCK 2020-10-26 20:55:24 +01:00
Silent 4323e401d8
Thread safety fixes for RtlCriticalSection 2020-10-26 20:51:19 +01:00
Luke Usher 1c465409c2
Merge pull request #2011 from CookiePLMonster/transform-patches-recursive
Guard against nested SetTransform/MultiplyTransform calls
2020-10-26 18:01:11 +00:00
Silent 4dd9aaeed7
Guard against nested SetTransform/MultiplyTransform calls
In the case of 25 to Life, MultiplyTransform calls SetTransform
which corrupted the host's internal state. Introduce a guard variable
to ensure we call to host only once per the patch chain and keep
the internal state pristine
2020-10-26 18:54:39 +01:00
Silent acff986fe1
Add NestedPatchCounter 2020-10-26 18:50:54 +01:00
Luke Usher 3b82af621d
Merge pull request #2007 from CookiePLMonster/burnout-patches
Changes to D3D patches
2020-10-25 19:07:50 +00:00
Silent e81c9fecb8
Unpatch D3DDevice_GetTransform and call to guest in SetTransform and MultiplyTransform
Fixes (not yet visible) rendering in Burnout 3, possibly because to it
having an unpatched LTCG-specific GetTransform or reading from
the D3D state directly.
2020-10-25 18:53:34 +01:00
Silent 5592f81c02
Implement D3D_BlockOnTime_4 2020-10-25 18:52:20 +01:00
Luke Usher 9a773ef7ac
Merge pull request #2003 from CookiePLMonster/fix-apu-timer
Fix APU timer ticking at wrong frequency
2020-10-25 01:41:56 +01:00
Silent d5adbb2ab3
Refactor APU, TSC and ACPI timers to use shared code 2020-10-24 23:53:15 +02:00
PatrickvL 23a3bc4b78
Merge pull request #2005 from CookiePLMonster/fix-vs-precision
Improve reverse screenspace transformation precision
2020-10-24 23:21:48 +02:00
Silent 709a3508ee
Pre-divide reverse scale in reverseScreenspaceTransform
This should improve numerical stability of the reverse transformation
when D24 depth is used by the game, as this caused viewport.z
to be very large (0xFFFFFF).
2020-10-24 23:18:59 +02:00
Silent 9b2c1ba2ce
Submit viewport scale and offset in one batch 2020-10-24 22:36:56 +02:00
Silent 0f88b77bfe
Fix APU timer ticking at wrong frequency 2020-10-24 13:09:37 +02:00
Luke Usher 724a1ca684
Merge pull request #2001 from PatrickvL/fix_ps_sum_reg
Pixel shader fix XFC SUM
2020-10-23 09:10:23 +01:00
patrickvl a412c80b24 Fix how our current pixel shader conversion calculates the final combiner special purpose register 'sum' : it was accidentally multiplying instead of adding it's arguments! 2020-10-23 01:05:24 +02:00
Luke Usher 1ee123900b
Merge pull request #1982 from ergo720/InlineVertexBuffer_as_vector
Use std::vector for g_InlineVertexBuffer_Table instead of realloc
2020-10-21 08:38:02 +01:00
Luke Usher 4e6068f6b4
Merge pull request #1998 from CookiePLMonster/thread-creation-delay
Simplify thread creation logic, remove hardcoded delays and tighten affinity changes
2020-10-21 08:36:10 +01:00
PatrickvL 7938142faf
Merge pull request #2000 from CookiePLMonster/copyrects-fallback
Add a fallback to CopyRects for cases which StretchRect can't handle
2020-10-21 01:04:09 +02:00
ergo720 a4d1807b4c Use std::fill and std::copy where possible 2020-10-20 21:26:43 +02:00
ergo720 47ea099a92 Use std::vector for g_InlineVertexBuffer_Table instead of realloc 2020-10-20 21:26:43 +02:00
Silent ea98d4bdea
Add a fallback to CopyRects for cases which StretchRect can't handle
Fixes menus in World Racing 2 because CopyRects tries to copy
a texture to texture.
2020-10-20 19:40:46 +02:00
Silent b7b2c24fdb
Start child threads suspended and finalize their initialization before resuming
* Closes a possible race condition where a child thread uses
ThreadHandle or dwThreadId AND starts before _beginthreadex even returns
* Allows to remove hardcoded sleeps "slowing down" parent thread
execution in favour of more reliable affinity mask changes on the child thread

Test case: The Warriors and its race condition on event creation
(child thread waits on the event parent thread creates AFTER spawning
the child thread)
2020-10-19 23:59:22 +02:00
Silent b04980a150
Remove hStartedEvent
It doesn't seem to be useful anymore (does not protect any thread-unsafe
initialization), and it was encouraging the OS scheduler to keep executing
the child thread before returning the parent thread from PsCreateSystemThreadEx

Test case: The Warriors and its race condition on event creation
(child thread waits on the event parent thread creates AFTER spawning
the child thread)
2020-10-19 21:49:46 +02:00
Silent 6f27d335f7
Change ThreadId parameter type to PWORD
Purely cosmetic change, does not change any functionality.
2020-10-19 21:27:16 +02:00
PatrickvL 8588230ee1
Merge pull request #1997 from LukeUsher/fix-shenmue-bios-read
emux86: fix bad bios rom mapping
2020-10-18 17:22:50 +02:00
PatrickvL b07ca858d5
Merge pull request #1999 from CookiePLMonster/pixel-combiner-fixes
Pixel combiner fixes
2020-10-18 16:49:12 +02:00
Silent 2d33a1bb6b
Implement better Blue-to-Alpha
Fixes pixel shaders decoding BINK videos (together with the previous commits).
Cleaned up a few TODOs.
2020-10-18 16:46:57 +02:00
Silent cc98adb38c
Fix SimplifyLRP remapping to wrong intermediate registers 2020-10-18 15:49:17 +02:00
Luke Usher 03d864c465 emux86: update flash read function with a better explaination 2020-10-17 22:37:01 +01:00
Luke Usher 4665bd0c3f emux86: fix bad bios rom mapping
Prevents a crash in Shenmue II
2020-10-17 16:05:17 +01:00
Luke Usher 6a70a08c59
Merge pull request #1996 from CookiePLMonster/viewport-clear-improvements
SetViewport & Clear improvements
2020-10-17 16:04:51 +01:00
Silent 21092a5d38
Support multiple rects in Clear 2020-10-17 14:15:53 +02:00
Anthony Miles 4b85f0949a
Scale viewport X and Y as well as height.
Fixes cases where X and Y are nonzero e.g. DoA3 character select
2020-10-17 14:06:29 +02:00
Silent fa10dcfd29
Refactor SetMixBinVolumes
* Clears the code up
* Picks the buffer volume from the maximum speaker volume
2020-10-17 12:40:57 +02:00
RadWolfie d9ec4342d7
Merge pull request #1995 from CookiePLMonster/dsound-improvements-split
Dsound improvements (split)
2020-10-17 05:37:41 -05:00
Silent 6d2e598c8c
IDirectSoundBuffer_SetBufferData: Fix 0 byte buffers not stoppping audio
NASCAR Heat 2002 (and probably plenty of other titles) submit
an empty buffer to stop audio. Handling this properly fixes
issues with audio samples lingering throughout the session.
2020-10-17 12:33:44 +02:00
Silent 3dcf1e67e0
Fix a copypaste typo in GetFormat_4034_lower and change its signature
Allows GetFormat() to be used more cleanly
2020-10-17 12:31:26 +02:00