aboutsummaryrefslogtreecommitdiff
path: root/src/GPU.cpp
Commit message (Collapse)AuthorAge
* Make the initial 3D renderer configurable via `NDSArgs` (#1913)Jesse Talavera2023-12-15
| | | | | | | * Allow 3D renderers to be created without passing `GPU` to the constructor * Make the initial 3D renderer configurable via `NDSArgs` * Fix a compiler error
* Initialize the framebuffers within the constructor (#1901)Jesse Talavera2023-12-04
|
* Clean up the 3D renderer for enhanced flexibility (#1895)Jesse Talavera-Greenberg2023-11-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Give `GPU2D::Unit` a virtual destructor - Undefined behavior avoided! * Add an `array2d` alias * Move various parts of `GPU2D::SoftRenderer` to `constexpr` - `SoftRenderer::MosaicTable` is now initialized at compile-time - Most of the `SoftRenderer::Color*` functions are now `constexpr` - The aforementioned functions are used with a constant value in at least one place, so they'll be at least partially computed at compile-time * Generalize `GLRenderer::PrepareCaptureFrame` - Declare it in the base `Renderer3D` class, but make it empty * Remove unneeded `virtual` specifiers * Store `Framebuffer`'s memory in `unique_ptr`s - Reduce the risk of leaks this way * Clean up how `GLCompositor` is initialized - Return it as an `std::optional` instead of a `std::unique_ptr` - Make `GLCompositor` movable - Replace `GLCompositor`'s plain arrays with `std::array` to simplify moving * Pass `GPU` to `GLCompositor`'s important functions instead of passing it to the constructor * Move `GLCompositor` to be a field within `GLRenderer` - Some methods were moved up and made `virtual` * Fix some linker errors * Set the renderer in the frontend * Remove unneeded `virtual` specifiers * Remove `RenderSettings` in favor of just exposing the relevant member variables * Update the frontend to accommodate the core changes * Add `constexpr` and `const` to places in the interpolator * Qualify references to `size_t` * Construct the `optional` directly instead of using `make_optional` - It makes the Linux build choke - I think it's because `GLCompositor`'s constructor is `private`
* Refactor `NDS` and `DSi` to be objects (#1893)Jesse Talavera-Greenberg2023-11-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * First crack at refactoring NDS and DSi into objects - Remove all global/`static` variables in `NDS` and related classes - Rely more on virtual dispatch when we need to pick methods at runtime - Pass `NDS&` or `DSi&` to its constituent components where necessary - Introduce some headers or move some definitions to break `#include` cycles * Refactor the frontend to accommodate the core's changes * Move up `SchedList`'s declaration - Move it to before the components are initialized so the `map`s inside are initialized - Fields in C++ are initialized in the order they're declared * Fix a crash when allocating memory * Fix JIT-free builds * Fix GDB-free builds * Fix Linux builds - Explicitly qualify some member types in NDS, since they share the same name as their classes * Remove an unnecessary template argument - This was causing the build to fail on macOS * Fix ARM and Android builds * Rename `Constants.h` to `MemConstants.h` * Add `NDS::IsRunning()` * Use an `#include` guard instead of `#pragma once`
* Move all core types into namespaces (#1886)Jesse Talavera-Greenberg2023-11-25
| | | | | | | | * Reorganize namespaces - Most types are now moved into the `melonDS` namespace - Only good chance to do this for a while, since a big refactor is next * Fix the build
* Refactor the JIT to be object-oriented (#1879)Jesse Talavera-Greenberg2023-11-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move TinyVector to a new file - So it's less sensitive to #include ordering * Forgot to include assert.h * Refactor ARMJIT_Memory into an object * Oops, forgot a declaration * Refactor ARMJIT to be contained in an object * Remove an unused function declaration * Add a missing #include * Remove a now-unused global * Use ARMJIT_Memory's own memory access functions * Fix some omissions in the ARM JIT * Move libandroid to be a member of ARMJIT_Memory instead of a global * Default-initialize most fields in ARMJIT_Compiler.h * Define NOOP_IF_NO_JIT * Finish refactoring the JIT to be object-oriented
* Refactor the GPU to be object-oriented (#1873)Jesse Talavera-Greenberg2023-11-09
| | | | | | | | | | | | | | | | | * Refactor GPU3D to be an object - Who has two thumbs and is the sworn enemy of global state? This guy! * Refactor GPU itself to be an object - Wow, it's used in a lot of places - Also introduce a new `Melon` namespace for a few classes - I expect other classes will be moved into `Melon` over time * Change signature of Renderer3D::SetRenderSettings - Make it noexcept, and its argument const * Remove some stray whitespace
* update copyright yearsArisotura2023-11-04
|
* better, less hacky, more OOP-friendly scheduler designArisotura2023-11-02
|
* RTC revamp (#1867)Arisotura2023-10-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * get this started * implement DSi RTC commands * set up RTC clock timer. lay down basic idea of a clock. * make the date/time registers writable * move RTC state to its own structure, to make it easier to deal with * more RTC work lay base for date/time dialog * get the bulk of the RTC functionality going * much simpler design for RTC stuff * aha, that is what it is * start working on the RTC IRQ * implement all types of RTC IRQ * start refining sleep mode. code still kinda sucks. * implement keypad IRQ * refine it some more * shut the fuck uuuuuupppppppppppppp
* Wrap CurGLCompositor cleanup in an #ifdef (#1837)Jesse Talavera-Greenberg2023-09-24
|
* Clean up some rendering-related resources in DeInit (#1836)Jesse Talavera-Greenberg2023-09-24
| | | - The unique_ptr destructors will take care of the cleanup
* Make the NDS teardown more robust (#1798)Jesse Talavera-Greenberg2023-09-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Make cleanup a little more robust to mitigate undefined behavior - Add some null checks before cleaning up the GPU3D renderer - Make sure that all deleted objects are null - Move cleanup logic out of an assert call - Note that deleting a null pointer is a no-op, so there's no need to check for null beforehand - Use RAII for GLCompositor instead of Init/DeInit methods * Replace a DeInit call that I missed * Make ARMJIT_Memory less likely to generate errors - Set FastMem7/9Start to nullptr at the end - Only close and unmap the file if it's initialized * Make Renderer3D manage its resources with RAII * Don't try to deallocate frontend resources that aren't loaded * Make ARMJIT_Memory::DeInit more robust on the Switch * Reset MemoryFile on Windows to INVALID_HANDLE_VALUE, not nullptr - There is a difference * Don't explicitly store a Valid state in GLCompositor or the 3D renderers - Instead, create them with static methods while making the actual constructors private * Make initialization of OpenGL resources fail if OpenGL isn't loaded * assert that OpenGL is loaded instead of returning failure
* Introduce `Platform::Log` (#1640)Jesse Talavera-Greenberg2023-03-23
| | | | | | | | | | | | | * Add Platform::Log and Platform::LogLevel * Replace most printf calls with Platform::Log calls * Move a brace down * Move some log entries to one Log call - Some implementations of Log may assume a full line * Log the MAC address as LogLevel::Info
* for all people who hate speed, here you can build melonDS againRSDuck2022-08-22
|
* invalidate JIT blocks in ARM7 WVRAM when it's remappedRSDuck2022-08-22
|
* close gaps in VRAM mappingArisotura2022-04-09
|
* update copyright headersArisotura2022-01-09
|
* handle changed VCount+threaded rasteriser more gracefullyRSDuck2021-08-04
|
* Fix some compiler warningsWaluigiWare642021-05-03
|
* update copyright year and add missing GPL headersRSDuck2021-03-12
|
* call Renderer2D::VBlankEnd at vblank endRSDuck2021-03-01
| | | | instead of vblank start
* separate GPU2D registers and rendererRSDuck2021-02-27
|
* directly set VRAMDirty for VRAM BG/OAM writesRSDuck2021-02-23
|
* Allow for a more modular renderer backends (#990)Wunk2021-02-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Draft GPU3D renderer modularization * Update sources C++ standard to C++17 The top-level `CMakeLists.txt` is already using the C++17 standard. * Move GLCompositor into class type Some other misc fixes to push towards better modularity * Make renderer-implementation types move-only These types are going to be holding onto handles of GPU-side resources and shouldn't ever be copied around. * Fix OSX: Remove 'register' storage class specifier `register` has been removed in C++17... But this keyword hasn't done anything in years anyways. OSX builds consider this "warning" an error and it stops the whole build. * Add RestartFrame to Renderer3D interface * Move Accelerated property to Renderer3D interface There are points in the code base where we do: `renderer != 0` to know if we are feeding an openGL renderer. Rather than that we can instead just have this be a property of the renderer itself. With this pattern a renderer can just say how it wants its data to come in rather than have everyone know that they're talking to an OpenGL renderer. * Remove Accelerated flag from GPU * Move 2D_Soft interface in separate header Also make the current 2D engine an "owned" unique_ptr. * Update alignment attribute to standard alignas Uses standardized `alignas` rather than compiler-specific attributes. https://en.cppreference.com/w/cpp/language/alignas * Fix Clang: alignas specifier Alignment must be specified before the array to align the entire array. https://en.cppreference.com/w/cpp/language/alignas * Converted Renderer3D Accelerated to variable This flag is checked a lot during scanline rasterization. So rather than having an expensive vtable-lookup call during mainline rendering code, it is now a public constant bool type that is written to only once during Renderer3D initialization.
* improve and fix NonStupidBitfield also get rid of some UBRSDuck2021-02-09
| | | | fixes optimised lto clang build
* the rasteriser doesn't have to be done on line 144RSDuck2021-01-26
| | | | thanks to the VRAM cache
* fixes to the threadedness of the sw rasteriserRSDuck2021-01-26
| | | | also fix #639 and fix #880
* Fix some compiler warningsWaluigiWare642021-01-25
|
* readd vram invalidation through display captureRSDuck2021-01-07
| | | | also remove stray printf
* fix out of bounds readRSDuck2021-01-07
|
* add palette and OAM dirty flagRSDuck2020-12-23
| | | | currently not used anywhere
* VRAM dirty tracking fix reset/savestate loadRSDuck2020-12-09
|
* rename the class as wellRSDuck2020-12-07
| | | | this is getting emberassing
* lay base for multiple GPU2D backendsRSDuck2020-12-06
|
* Merge vram dirty trackingRSDuck2020-11-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Squashed commit of the following: commit b463a05d4b909372f0cd1ad91caa0c77a25e5901 Author: RSDuck <rsduck@users.noreply.github.com> Date: Mon Nov 30 01:55:35 2020 +0100 minor fix commit ce73cebbdf5da243d7ebade82d8799ded9cd6b28 Author: RSDuck <rsduck@users.noreply.github.com> Date: Mon Nov 30 00:43:08 2020 +0100 fix dirty flags of BG/OBJ mappings not being reset commit fc5d73a6178e3adc444398bdd23de8314b5ca8f8 Author: RSDuck <rsduck@users.noreply.github.com> Date: Mon Nov 30 00:11:13 2020 +0100 use flat vram for gpu2d everywhere commit 34ee9fe2bf04fcfa2a5a1c8d78d70007e606f1a2 Author: RSDuck <rsduck@users.noreply.github.com> Date: Sat Nov 28 19:10:34 2020 +0100 mark VRAM dirty for display capture commit e8778fa2f429c6df0eece19d6a5ee83ae23a0cf4 Author: RSDuck <rsduck@users.noreply.github.com> Date: Sat Nov 28 18:59:31 2020 +0100 use flat VRAM for textures and texpals also skip rendering if nothing changed and a bunch of fixes commit 53f2041e2e1a28b35702a2ed51de885c36689f71 Author: RSDuck <rsduck@users.noreply.github.com> Date: Fri Nov 27 18:29:56 2020 +0100 use vram dirty tracking for extpals also preparations to take this further commit 4cdfa329e95aed26d3b21319c8fd86a04abf20f7 Author: RSDuck <rsduck@users.noreply.github.com> Date: Mon Nov 16 23:32:22 2020 +0100 VRAM dirty tracking
* make OpenGL renderer a build optionRSDuck2020-10-01
| | | | mostly meant for the Switch port
* Merge remote-tracking branch 'remotes/origin/master' into melonDSiArisotura2020-05-30
|\
| * fix bugs, clean up some of the shitArisotura2020-05-28
| |
| * * rework GPU's settings interface, make it config-agnosticArisotura2020-05-28
| | | | | | | | | | * make video settings dialog functional, sorta * fix dialogs that were resizable
| * get the OpenGL renderer going.Arisotura2020-05-25
| | | | | | | | | | | | sorta. (also make the blackmagic_II branch obsolete in the process)
* | Merge commit '4b57416552ec2fa95216e2b044559f215723bf70' into melonDSiArisotura2020-05-30
|\|
| * * add support for a bunch of codes (all of them minus the loop shit, really)Arisotura2020-02-14
| | | | | | | | * hook it betterer so it doesn't asplode
| * update copyright yearsArisotura2020-02-14
| |
| * lay base for AR cheatzorz. baahahhhhArisotura2020-02-14
| |
* | begin renovating melonDSiArisotura2020-05-30
|\|
| * fix potential out-of-bounds writeArisotura2019-07-13
| |
* | add LCD init flag in DISPSTATArisotura2019-06-20
|/
* GPU2D: hardware renders sprites one scanline in advance.Arisotura2019-06-10
| | | | fixes #375 (midframe OAM update)
* fasterer BG/OBJ VRAM readsArisotura2019-06-09
|