Commit graph

87 commits

Author SHA1 Message Date
GPUCode 88ea66053e
Miscallenious fixes to gl backend and qt frontend (#6834)
* renderer_gl: Make rasterizer normal class member

* It doesn't need to be heap allocated anymore

* gl_rasterizer: Remove default_texture

* It's unused

* gl_rasterizer: General cleanup

* gl_rasterizer: Lower case lambdas

* Match style with review comments from vulkan backend

* rasterizer_cache: Prevent memory leak

* Since the switch from shared_ptr these surfaces were no longer being destroyed properly. Use our garbage collector for that purpose to destroy it safely for both backends

* rasterizer_cache: Make temp copy of old surface

* The custom surface would override the memory region of the old region resulting in garbage data, this ensures the custom surface is constructed correctly

* citra_qt: Manually create dialog tabs

* Allows for custom constructors which is very useful. While at it, global state is now eliminated from configuration

* citra_qt: Eliminate global system usage

* core: Remove global system usage in memory and HIO

* citra_qt: Use qOverload

* tests: Run clang format

* gl_texture_runtime: Fix surface scaling
2023-08-02 01:40:39 +03:00
GPUCode cf9bb90ae3
code: Use std::span where appropriate (#6658)
* code: Use std::span when possible

* code: Prefix memcpy and memcmp with std::
2023-07-07 01:52:40 +03:00
Vitor K 34de77d429
Various miscelaneous changes (#6496) 2023-05-03 17:24:10 +02:00
GPUCode 06f3c90cfb
Custom textures rewrite (#6452)
* common: Add thread pool from yuzu

* Is really useful for asynchronous operations like shader compilation and custom textures, will be used in following PRs

* core: Improve ImageInterface

* Provide a default implementation so frontends don't have to duplicate code registering the lodepng version

* Add a dds version too which we will use in the next commit

* rasterizer_cache: Rewrite custom textures

* There's just too much to talk about here, look at the PR description for more details

* rasterizer_cache: Implement basic pack configuration file

* custom_tex_manager: Flip dumped textures

* custom_tex_manager: Optimize custom texture hashing

* If no convertions are needed then we can hash the decoded data directly removing the needed for duplicate decode

* custom_tex_manager: Implement asynchronous texture loading

* The file loading and decoding is offloaded into worker threads, while the upload itself still occurs in the main thread to avoid having to manage shared contexts

* Address review comments

* custom_tex_manager: Introduce custom material support

* video_core: Move custom textures to separate directory

* Also split the files to make the code cleaner

* gl_texture_runtime: Generate mipmaps for material

* custom_tex_manager: Prevent memory overflow when preloading

* externals: Add dds-ktx as submodule

* string_util: Return vector from SplitString

* No code benefits from passing it as an argument

* custom_textures: Use json config file

* gl_rasterizer: Only bind material for unit 0

* Address review comments
2023-04-27 07:38:28 +03:00
Ian Chamberlain 025913a734
Fix string_view constructor for macOS clang
Some versions of clang 14 (macOS+android) don't implement
`string_view(It first, It last)`, so let's use
`string_view(const CharT*, size_type)` instead.

Also remove unused header leftover from old code that uses std::string.
2023-04-11 10:06:08 -04:00
Ian Chamberlain 4cc181e5b8
Address review comments
Use more modern C++ style casts + std::array, clean up some log
messages, and rename some functions.
2023-04-05 12:41:17 -04:00
Ian Chamberlain 696c0904f8
Update some c-style casts -> reinterpret_cast 2023-04-04 13:21:25 -04:00
Ian Chamberlain 6e45de760e
Cleanup new code, add docs and error handling 2023-04-04 13:13:24 -04:00
Ian Chamberlain 0d4c93d1c2
Undo some changes exposing unused functions 2023-04-04 12:20:41 -04:00
Ian Chamberlain 351730d585
Fix infinite hang if GDB client kills gdbstub 2023-03-31 14:06:43 -04:00
Ian Chamberlain 83138e0c63
Fix some build + impl errors with HIO
After rebase there were some API changes, also fix continuation logic in
the main gdbstub.
2023-03-31 14:05:57 -04:00
Ian Chamberlain f92f494cab
Stop execution when performing HIO request
Since the HIO request is basically treated like a syscall, we need to
stop emulation while waiting for the GDB client to reply with the
result. This ensures any memory queries etc. that GDB makes to fulfill
the HIO request are accessing memory as it was at the time of the
request, instead of afterwards.
2023-03-29 09:09:32 -04:00
Ian Chamberlain b9c11e71d7
Fix ABI mismatch in packed HIO request
Using size_t etc. is incorrect, since these definitions are based on the
build machine which most likely has a different arch than the 3DS.
2023-03-29 09:09:32 -04:00
Ian Chamberlain 874bfebaf9
Add some notes + use stringstream to build packet 2023-03-29 09:09:32 -04:00
Ian Chamberlain 7de1bf3746
Properly parse incoming hio packet
This also does kind of a hacky way of sending HIO requests, since we
don't have a direct way of signaling a request should be sent like the
Rosalina implementation.

To improve this, it could probably do some kind of signal sending which
the main run loop handles instead of GDBStub::HandlePacket();
2023-03-29 09:09:32 -04:00
Ian Chamberlain 6f23ee43ae
Initial port of luma3ds' gdb_hio to Citra 2023-03-29 09:09:32 -04:00
Tobias bb05d8c12a
src/CMakeLists: Enforce multiple warnings on MSVC (#5692) 2022-11-09 23:14:28 +01:00
Tobias 1ddea27ac8
code: Cleanup and warning fixes from the Vulkan PR (#6163)
Co-authored-by: emufan4568 <geoster3d@gmail.com>
Co-authored-by: Kyle Kienapfel <Docteh@users.noreply.github.com>
2022-11-04 23:32:57 +01:00
GPUCode cbd5d1c15c
Upgrade codebase to C++ 20 + fix warnings + update submodules (#6115) 2022-09-21 18:36:12 +02:00
FearlessTobi da908a9ed1 core: Remove unnecessary enum casts in log calls
Follows the video core PR. fmt doesn't require casts for enum classes
anymore, so we can remove quite a few casts.

Co-Authored-By: LC <712067+lioncash@users.noreply.github.com>
2020-12-29 06:39:21 +01:00
MerryMage d17ab5cd91 gdbstub: Fix some gdbstub jankiness
1. Ensure that register information available to gdbstub is most up-to-date.
2. There's no reason to check for current_thread == thread when emitting a trap.
   Doing this results in random hangs whenever a step happens upon a thread switch.
2020-04-06 21:24:54 +01:00
Gauvain "GovanifY" Roussel-Tarbouriech 8fedd5c240 gdbstub: small logic bug fix with defer_start 2020-02-24 14:30:24 +01:00
Gauvain "GovanifY" Roussel-Tarbouriech d8bb37fc2f gdbstub: Ensure gdbstub doesn't drop packets crucial to initialization 2020-02-23 21:37:40 +01:00
Ben 55ec7031cc
Core timing 2.0 (#4913)
* Core::Timing: Add multiple timer, one for each core

* revert clang-format; work on tests for CoreTiming

* Kernel:: Add support for multiple cores, asserts in HandleSyncRequest because Thread->status == WaitIPC

* Add some TRACE_LOGs

* fix tests

* make some adjustments to qt-debugger, cheats and gdbstub(probably still broken)

* Make ARM_Interface::id private, rework ARM_Interface ctor

* ReRename TimingManager to Timing for smaler diff

* addressed review comments
2020-02-21 19:31:32 +01:00
Dimitri A acaca4188e gdbstub: Fix some bugs in IsMemoryBreak() and ServeBreak. Add workaround to let watchpoints break into GDB. (#4651)
* gdbstub: fix IsMemoryBreak() returning false while connected to client

As a result, the only existing codepath for a memory watchpoint hit to break into GDB (InterpeterMainLoop, GDB_BP_CHECK, ARMul_State::RecordBreak) is finally taken,
which exposes incorrect logic* in both RecordBreak and ServeBreak.

* a blank BreakpointAddress structure is passed, which sets r15 (PC) to NULL

* gdbstub: DynCom: default-initialize two members/vars used in conditionals

* gdbstub: DynCom: don't record memory watchpoint hits via RecordBreak()

For now, instead check for GDBStub::IsMemoryBreak() in InterpreterMainLoop and ServeBreak.

Fixes PC being set to a stale/unhit breakpoint address (often zero) when a memory watchpoint (rwatch, watch, awatch) is handled in ServeBreak() and generates a GDB trap.

Reasons for removing a call to RecordBreak() for memory watchpoints:
* The``breakpoint_data`` we pass is typed Execute or None. It describes the predicted next code breakpoint hit relative to PC;

* GDBStub::IsMemoryBreak() returns true if a recent Read/Write operation hit a watchpoint. It doesn't specify which in return, nor does it trace it anywhere. Thus, the only data we could give RecordBreak() is a placeholder BreakpointAddress at offset NULL and type Access. I found the idea silly, compared to simply relying on GDBStub::IsMemoryBreak().

There is currently no measure in the code that remembers the addresses (and types) of any watchpoints that were hit by an instruction, in order to send them to GDB as "extended stop information."
I'm considering an implementation for this.

* gdbstub: Change an ASSERT to DEBUG_ASSERT

I have never seen the (Reg[15] == last_bkpt.address) assert fail in practice, even after several weeks of (locally) developping various branches around GDB.  Only leave it inside Debug builds.
2019-03-08 00:09:06 -05:00
Dimitri ALBORA d388fe58f7 gdbstub: only let Execute breakpoints write/restore BKPT opcodes into target memory 2019-01-26 22:08:39 +01:00
Weiyi Wang c6b3186475 Memory: IsValidVirtualAddress can be global 2018-12-05 20:21:14 -05:00
Weiyi Wang 2582d64fb3 Memory: move block operations into class 2018-12-05 20:21:14 -05:00
Weiyi Wang 405218c3a7 Memory: move IsValidVirtualAddress into class 2018-12-05 20:21:14 -05:00
Weiyi Wang 4e99641a3b Memory: remove WriteBlock with current process 2018-11-19 11:16:55 -05:00
Weiyi Wang 8871f5a4ac Memory: remove ReadBlock with current process 2018-11-19 11:16:55 -05:00
Weiyi Wang 7308b8d294 Memory: remove IsValidVirtualAddress with current process 2018-11-19 11:16:55 -05:00
Weiyi Wang 20ae37ba4f kernel/Thread: move thread list into the manager 2018-10-26 16:07:45 -04:00
Weiyi Wang 7d8f115185 Prefix all size_t with std::
done automatically by executing regex replace `([^:0-9a-zA-Z_])size_t([^0-9a-zA-Z_])` -> `$1std::size_t$2`
2018-09-06 16:03:28 -04:00
fearlessTobi cf8b1726df Address review comments 2018-09-06 00:00:21 +02:00
Lioncash 3284bef360 string_util: Remove StringFromFormat() and related functions
Given we utilize fmt, we don't need to provide our own functions for formatting anymore
2018-09-06 00:00:21 +02:00
Lioncash 91559bfdfe gdbstub: Use type alias for breakpoint maps
Rather than having to type out the full std::map type signature, we can
just use a straightforward alias. While we're at it, rename
GetBreakpointList to GetBreakpointMap, which makes the name more
accurate. We can also get rid of unnecessary u64 static_casts, since
VAddr is an alias for a u64.
2018-08-25 15:34:21 +02:00
fearlessTobi 80f1ffd8dc Remove newline 2018-08-25 15:27:47 +02:00
Lioncash 8a109333b7 gdbstub: Move all file-static variables into the GDBStub namespace
Keeps everything under the same namespace. While we're at it, enclose
them all within an inner anonymous namespace
2018-08-25 15:27:46 +02:00
Lioncash db8ec37066 gdbstub: Replace PAddr alias with VAddr
In all cases, a virtual address is being passed in, not a physical one.
2018-08-25 15:25:12 +02:00
Jarek Syrylak 039fb95f80 More fixes as per PR feedback. 2018-08-16 19:44:31 +01:00
Jarek Syrylak a6ecb3c913 Fixed as per PR feedback. 2018-08-16 16:24:16 +01:00
Jarek Syrylak bd658a8801 GDB Modernization:
- Can be used in either DynCom or Dynarmic mode
- Added support for threads
- Proper support for FPU registers
- Fix for NibbleToHex conversion that used to produce false error codes
- Fix for clang-format failing under Windows
2018-08-16 10:40:52 +01:00
zhupengfei 5a47cbed17
no need to cast to u32 according to @wwylele comment 2018-07-30 22:40:56 +08:00
Lioncash b4cdbf3ee8
gdbstub: Get rid of a few signed/unsigned comparisons
Ensures both operands in comparisons are the same signedness.
2018-07-30 22:40:43 +08:00
wwylele 0eab948728 reformat all files with clang-format 2018-06-29 16:56:12 +03:00
wwylele 7c5a76e58b log: replace all NGLOG with LOG 2018-06-29 14:18:07 +03:00
Daniel Lim Wee Soong 10f0fbc0e5 core/gdbstub: Migrate logging macros
Change to use the new logging macros
2018-04-18 21:53:26 +08:00
James Rowe f61141e86a Update the entire application to use the new clang format style 2018-03-09 10:54:43 -07:00
MerryMage 19814d68c1 gdbstub: Correct typo
Constructing and destructing a Core::System instance for the
GetInstance() call isn't the smartest thing to do.
2017-12-20 18:47:06 +00:00