Commit graph

1313 commits

Author SHA1 Message Date
riperiperi 08332bdc04
Ensure storage is set for Buffer Textures when binding an Image. (#1627) 2020-10-20 18:56:23 -03:00
gdkchan 5264d55b39
Fix gl_in being used with built-in variables that are not per-vertex (#1624) 2020-10-17 10:16:40 +02:00
riperiperi b4d8d893a4
Memory Read/Write Tracking using Region Handles (#1272)
* WIP Range Tracking

- Texture invalidation seems to have large problems
- Buffer/Pool invalidation may have problems
- Mirror memory tracking puts an additional `add` in compiled code, we likely just want to make HLE access slower if this is the final solution.
- Native project is in the messiest possible location.
- [HACK] JIT memory access always uses native "fast" path
- [HACK] Trying some things with texture invalidation and views.

It works :)

Still a few hacks, messy things, slow things

More work in progress stuff (also move to memory project)

Quite a bit faster now.
- Unmapping GPU VA and CPU VA will now correctly update write tracking regions, and invalidate textures for the former.
- The Virtual range list is now non-overlapping like the physical one.
- Fixed some bugs where regions could leak.
- Introduced a weird bug that I still need to track down (consistent invalid buffer in MK8 ribbon road)

Move some stuff.

I think we'll eventually just put the dll and so for this in a nuget package.

Fix rebase.

[WIP] MultiRegionHandle variable size ranges

- Avoid reprotecting regions that change often (needs some tweaking)
- There's still a bug in buffers, somehow.
- Might want different api for minimum granularity

Fix rebase issue

Commit everything needed for software only tracking.

Remove native components.

Remove more native stuff.

Cleanup

Use a separate window for the background context, update opentk. (fixes linux)

Some experimental changes

Should get things working up to scratch - still need to try some things with flush/modification and res scale.

Include address with the region action.

Initial work to make range tracking work

Still a ton of bugs

Fix some issues with the new stuff.

* Fix texture flush instability

There's still some weird behaviour, but it's much improved without this. (textures with cpu modified data were flushing over it)

* Find the destination texture for Buffer->Texture full copy

Greatly improves performance for nvdec videos (with range tracking)

* Further improve texture tracking

* Disable Memory Tracking for view parents

This is a temporary approach to better match behaviour on master (where invalidations would be soaked up by views, rather than trigger twice)

The assumption is that when views are created to a texture, they will cover all of its data anyways. Of course, this can easily be improved in future.

* Introduce some tracking tests.

WIP

* Complete base tests.

* Add more tests for multiregion, fix existing test.

* Cleanup Part 1

* Remove unnecessary code from memory tracking

* Fix some inconsistencies with 3D texture rule.

* Add dispose tests.

* Use a background thread for the background context.

Rather than setting and unsetting a context as current, doing the work on a dedicated thread with signals seems to be a bit faster.

Also nerf the multithreading test a bit.

* Copy to texture with matching alignment

This extends the copy to work for some videos with unusual size, such as tutorial videos in SMO. It will only occur if the destination texture already exists at XCount size.

* Track reads for buffer copies. Synchronize new buffers before copying overlaps.

* Remove old texture flushing mechanisms.

Range tracking all the way, baby.

* Wake the background thread when disposing.

Avoids a deadlock when games are closed.

* Address Feedback 1

* Separate TextureCopy instance for background thread

Also `BackgroundContextWorker.InBackground` for a more sensible idenfifier for if we're in a background thread.

* Add missing XML docs.

* Address Feedback

* Maybe I should start drinking coffee.

* Some more feedback.

* Remove flush warning, Refocus window after making background context
2020-10-16 17:18:35 -03:00
gdkchan f02791b20c
Fix LOP3 (cbuf) shader instruction encoding (#1616) 2020-10-13 19:33:04 -03:00
riperiperi aec8177850
Replace Host FPS with GPU command queue load ("Fifo %") (#1585)
* Replace Host FPS with FIFO%

* Change measurement order. Improve calculation.

Now at 100% when FIFO is blocking game exectution, rather than "0".

* Address feedback (1)

* Remove Host FPS

* FIFO rather than Fifo

* Address Ac_k feedback

* Rebase
2020-10-14 07:54:42 +11:00
LDj3SNuD 04e330cc00
Add Umaal & Vabd_I, Vabdl_I, Vaddl_I, Vhadd, Vqshrn, Vshll inst.s (slow paths). (#1577)
* Add Umaal & Vabd_I, Vabdl_I, Vaddl_I, Vhadd, Vqshrn, Vshll inst.s (slow paths).

No test provided (i.e. draft).

* Ptc InternalVersion = 1577
2020-10-13 22:41:33 +02:00
gdkchan 329ba5b39b
Fix incorrect GPU GL blend func values (#1612) 2020-10-13 14:45:41 +11:00
gdkchan d36c4bfba5
Fix output component register on pixel shaders (#1613)
* Fix output component register on pixel shaders

* Clean up usings

* Do not advance if no component is enabled for the target, this keeps the previous behavior
2020-10-13 14:44:55 +11:00
gdkchan 6a51b628f9
Fix error when dual source blend is used (#1610)
* Fix error when dual source blend is used

* Ensure framebuffer
2020-10-12 21:50:41 -03:00
gdkchan e4777717cd
Implement LEA.HI shader instruction (#1609) 2020-10-12 21:46:04 -03:00
gdkchan b066cfc1a3
Add support for shader constant buffer slot indexing (#1608)
* Add support for shader constant buffer slot indexing

* Fix typo
2020-10-12 21:40:50 -03:00
gdkchan 14fd9aa640
Fix H264 output frame size when decoding videos of different sizes (#1606) 2020-10-11 11:09:38 +02:00
Mary c482718d2e
surfaceflinger: Disable async buffer (#1603)
This fix a mistake I made during my original reimplementation of SurfaceFlinger by disabling async buffer.

This fix a memory corruption on Super Mario All-Stars 3D (Super Mario Sunshine & Super
Mario Galaxy now go ingame).

Thanks to @gdkchan for tracing the memory corruption.
2020-10-10 21:45:49 +11:00
Thog ace67ed324 Rollback the CreateExitDialog function that was lost with auto updater 2020-10-10 01:22:25 +02:00
Xpl0itR ce87650d81
Show confirmation dialog when attempting to close while a game is loaded (#1582) 2020-10-10 01:06:48 +02:00
Mary 8506b7a334
Fix exiting emulator with multi programs (#1590)
THis fix a bug introduced in #1560 that would cause "Stop emulation" to
actually restart the game all the time.
2020-10-10 00:52:11 +02:00
gdkchan 0954e76a26
Improve BRX target detection heuristics (#1591) 2020-10-03 15:43:33 +10:00
gdkchan 86412ed30a
Supper 2D array ASTC compressed texture formats decoding (#1593) 2020-10-02 11:22:23 +10:00
jduncanator f8c41a9a51
Touch README (#1592)
This touches the README to trigger a rebuild of CI.
2020-10-01 09:39:27 +02:00
Mary 2ac0ce4557
Fix GetStream implementation (#1588)
Fix wrong argument usage on GetStream.

Doesn't change anything as it's not used but a nice catch from jD ^^.
2020-10-01 05:22:09 +02:00
gdkchan f2b12c9749
Remove old, unused CPU optimization (#1586) 2020-09-30 16:16:34 -03:00
emmauss 26319d5ab3
Add Motion controls (#1363)
* Add motion controls

Apply suggestions from code review

Co-authored-by: Ac_K <Acoustik666@gmail.com>

* cleanup

* add reference orientation and derive relative orientation from it

* cleanup

* remove unused variable and strange file

* Review_2.

* change GetInput to TryGetInput

* Review_3.

Co-authored-by: Ac_K <Acoustik666@gmail.com>
Co-authored-by: LDj3SNuD <dvitiello@gmail.com>
2020-09-29 23:32:42 +02:00
Thog a6f8a0b01e Do not show update being availaible when appveyor is still building 2020-09-29 22:52:41 +02:00
gdkchan 1560f236da
Convert 1D texture targets to 2D (#1584)
* Convert 1D texture targets to 2D

* Fix typo

* Simplify some code

* Should mask that too

* Consistency
2020-09-29 22:28:50 +02:00
MelonSpeedruns a15459366e
Appveyor Ryujinx Updater (#1403)
Co-authored-by: Xpl0itR <xpl0itr@outlook.com>
2020-09-29 22:05:25 +02:00
Ac_K 4f65043ad7
Basic impl of Error Applet (#1551) 2020-09-28 00:00:38 +02:00
riperiperi f89b754abb
Always set new texture data for textures initialized by a copy. (#1576) 2020-09-27 09:37:45 +10:00
mageven 16e9d15674
Isolate more services to separate threads (#1573)
* Isolate more services to separate threads

* Fix DisplayServer

* Add explanation for vi services
2020-09-25 20:18:28 +10:00
gdkchan bd28ce90e6
Implement small indexed draws and other fixes to make guest Vulkan work (#1558) 2020-09-24 09:48:34 +10:00
riperiperi e00ca92063
Return "NotAvailable" when no UserChannel data is present. (#1569)
* Return "NotAvailable" when no UserChannel data is present.

* Return ObjectInvalid for undefined parameter kinds.

* No need to specify which, there's only one.

* Just works as a literal string.
2020-09-23 18:57:18 -03:00
mageven 840afabc22
Run audren in a separate thread (#1572) 2020-09-23 23:21:43 +02:00
gdkchan 6c9565693f
IPC refactor part 1: Use explicit separate threads to process requests (#1447)
* Changes to allow explicit management of service threads

* Remove now unused code

* Remove ThreadCounter, its no longer needed

* Allow and use separate server per service, also fix exit issues

* New policy change: PTC version now uses PR number
2020-09-22 14:50:40 +10:00
riperiperi 5dd6f41ff4
Make viewStorage still valid after view removal. (#1564) 2020-09-21 16:51:33 -03:00
Mary 33f8284bc0
hle/ui: Basic multi programs support (#1560)
* hos/gui: Add a check of NCA program index in titleid

This add a check to `ApplicationLoader` for the last 2 digits of the game TitleId who seems to be the NCA program index.
We currently return the last index, instead of the lower one.
Same check is added to ApplicationLibrary in the UI.

I've cleaned up both file too.

* hle: implement partial relaunch logic

TODO: make the emulator auto relauch.

* Handle auto relaunch

* hle: Unify update usage system

* hle: Implement support of multi programs in update system

* Add some documentation

* Address rip's comment

Co-authored-by: Ac_K <Acoustik666@gmail.com>
2020-09-21 13:45:30 +10:00
gdkchan 90ab28d1c6
Align register index between output targets on pixel shaders (#1559) 2020-09-21 13:45:04 +10:00
Ac_K 0158dc4db3
acc/hid: Implement ListQualifiedUsers and SetTouchScreenConfiguration (#1555)
* acc/hid: Implement ListQualifiedUsers and SetTouchScreenConfiguration

* Fix symbols
2020-09-20 14:32:58 +10:00
Xpl0itR d0e36b7b19
Move the open logs folder from setting into the File menu in the main window (#1550) 2020-09-20 14:31:05 +10:00
Ac_K 31a84eedcb
friend: Implement GetCompletionEvent and AddPlayHistory (#1554) 2020-09-20 13:45:46 +10:00
Ac_K ac04cfa96c
am: Stub Begin/EndBlockingHomeButton (#1553) 2020-09-20 13:40:10 +10:00
Ac_K da3a53a29c
caps: Stub SetShimLibraryVersion (#1552) 2020-09-20 13:32:48 +10:00
LDj3SNuD 66b799a6e4
Fix host stack overflow caused by some recursive guest methods. (#1528)
* Fix host stack overflow caused by some recursive guest methods.

* PPTC flag up.

* Address comments.

Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2020-09-19 20:16:30 -03:00
FICTURE7 f60033e0aa
Implement block placement (#1549)
* Implement block placement

Implement a simple pass which re-orders cold blocks at the end of the
list of blocks in the CFG.

* Set PPTC version

* Use Array.Resize

Address gdkchan's feedback
2020-09-19 20:00:24 -03:00
gdkchan 1eea35554c
Better viewport flipping and depth mode detection method (#1556)
* Use a better viewport flipping approach

* New approach to detect depth mode

* nit: Sort method on the OpenGL backend

* Adjust spacing on comment

* Unswap near and far parameters based on ScaleZ
2020-09-19 19:46:49 -03:00
Billy Laws 4b1bed1b05
Correct the threshold for control stick buttons (#1483)
This was tested against HW with https://github.com/Xpl0itR/Input-Test/tree/master/Input-Test and a few changes to record the minimum value axis value when the stick buttons were marked as pressed.
2020-09-19 17:10:53 +02:00
Mary 2ce59c44bc
Fix debug Config using res scaling 2x by default (#1546)
As the title say, this restore the value to 1.
2020-09-13 11:02:45 +10:00
FICTURE7 36ec1bc6c0
Relax block ordering constraints (#1535)
* Relax block ordering constraints

Before `block.Next` had to follow `block.ListNext`, now it does not.
Instead `CodeGenerator` will now emit the necessary jump instructions
to ensure control flow.

This makes control flow and block order modifications easier. It also
eliminates some simple cases of redundant branches.

* Set PPTC version
2020-09-12 12:32:53 -03:00
riperiperi 3d055da5fc
Allow swizzles to match with "undefined" components (#1538)
* Add swizzle matching rules.

Improves rules which try to match incompatible formats as perfect, such as D32 float -> R32 float.

Remove Format.HasOneComponent, since this information is now available via the FormatInfo struct.

* Fix this rule.

* Update component counts for depth formats.
2020-09-11 09:48:48 +10:00
riperiperi 5d69d9103e
Texture/Buffer Memory Management Improvements (#1408)
* Initial implementation. Still pending better valid-overlap handling,
disposed pool, compressed format flush fix.

* Very messy backend resource cache.

* Oops

* Dispose -> Release

* Improve Release/Dispose.

* More rule refinement.

* View compatibility levels as an enum - you can always know if a view is only copy compatible.

* General cleanup.

Use locking on the resource cache, as it is likely to be used by other threads in future.

* Rename resource cache to resource pool.

* Address some of the smaller nits.

* Fix regression with MK8 lens flare

Texture flushes done the old way should trigger memory tracking.

* Use TextureCreateInfo as a key.

It now implements IEquatable and generates a hashcode based on width/height.

* Fix size change for compressed+non-compressed view combos.

Before, this could set either the compressed or non compressed texture with a size with the wrong size, depending on which texture had its size changed. This caused exceptions when flushing the texture.

Now it correctly takes the block size into account, assuming that these textures are only related because a pixel in the non-compressed texture represents a block in the compressed one.

* Implement JD's suggestion for HashCode Combine

Co-authored-by: jduncanator <1518948+jduncanator@users.noreply.github.com>

* Address feedback

* Address feedback.

Co-authored-by: jduncanator <1518948+jduncanator@users.noreply.github.com>
2020-09-10 16:44:04 -03:00
FICTURE7 4c7bebf3e6
Do not emit StoreToContext before Return (#1537)
* Do not emit StoreToContext before Return

* Set PPTC version
2020-09-07 12:52:17 +10:00
Mary 6aef271661
Amadeus: Fix multi-channel PCM sources on REV8 (#1536)
This add a missing offset on the output buffer of the DataSourceVersion2Command.

This fix music only playing on the left channel on Fairy Tail, Family Mysteries: Poisonous Promises, SEGA AGES Sonic the Hedgehog 2 and probably more.
2020-09-06 16:54:33 -03:00