Commit Graph

52 Commits

Author SHA1 Message Date
db963aa002 Make the NDS teardown more robust (#1798)
* 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
2023-09-15 15:31:05 +02:00
35cc79787d update copyright headers 2022-01-09 02:15:50 +01:00
19ddaee13b finally decouple Config from the core. baahhahahahah 2021-11-18 01:17:51 +01:00
2ff065e5ea Fix some compiler warnings 2021-05-03 13:40:44 +01:00
436b3c4c1d update copyright year and add missing GPL headers 2021-03-12 20:07:40 +01:00
a7029aebae Allow for a more modular renderer backends (#990)
* 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.
2021-02-09 23:38:51 +01:00
a3f4aaf503 call glFlush only once
that seems to atleast get rid of the flicker
the weird issue that clears don't work is still there
2021-01-29 12:38:31 +01:00
43348210f9 Fix some compiler warnings 2021-01-25 14:12:13 +00:00
8a3a8b7c68 include polygon attr opaqueness for translucent polygons in render key 2021-01-22 12:19:51 +01:00
8a068c2294 GL: ensure to set depthmask to TRUE before rendering opaque shit 2021-01-21 21:10:43 +01:00
53d5def919 pad ShaderConfig to a multiple of 16 2021-01-17 17:15:03 +01:00
7d448d911d use C++ style structs everywhere 2021-01-02 11:38:06 +01:00
aac843c7de GL: don't break rendering order when translucent polygons contain opaque pixels.
fixes #831

(also disable edgemarking for now. it sucked anyway)
2020-12-11 04:38:11 +01:00
a47a3fa692 GL: align uniform-buffer size to 16-byte boundary. atleast makes RenderDoc happy. 2020-12-11 03:29:37 +01:00
50cdfd0137 fix edge indices count 2020-11-19 17:46:21 +01:00
21dbca9543 use proper index buffers 2020-11-16 15:58:23 +01:00
e7025abcdc * fix build error
* make betterer polygon splitting an option
* add GL_LEQUAL depth test for 'equal' mode, might help
2020-08-24 19:32:07 +02:00
c29e630314 oops.
fixes #725
2020-08-24 12:00:13 +02:00
b5f9278b3a GL: hopefully finally fix the checkerboard issue 2020-08-20 03:01:05 +02:00
0688a15e47 blarg 2020-08-20 01:37:33 +02:00
959e7f568d GL: be more careful with framebuffer mappings. might fix issues. 2020-08-20 01:19:09 +02:00
00f33343e4 3D/GL: experimental attempt at reducing warping on quads, pentagons, etc... 2020-08-19 14:53:42 +02:00
de19ce6250 3D/GL: make polygon generation code cleaner, add quicker codepath for triangles (also laying ground for some evil experiment)
also fix stupid bug with line polygons
2020-08-19 13:02:54 +02:00
0804ab3c78 * rework GPU's settings interface, make it config-agnostic
* make video settings dialog functional, sorta
* fix dialogs that were resizable
2020-05-28 15:53:32 +02:00
0a68eb7803 make it hiDPI compliant (I hope)
also misc tweaks
2020-05-28 11:52:12 +02:00
e8849db78a we don't need a GLShim.
blarg.

I don't understand this anymore.
2020-05-27 21:40:02 +02:00
36f4cdbbbf get the OpenGL renderer going.
sorta.

(also make the blackmagic_II branch obsolete in the process)
2020-05-25 18:25:50 +02:00
83f8e11bc1 update copyright years 2020-02-14 20:18:08 +01:00
c064f738ea OpenGL: fix bug when rendering translucent polygons coming after shadow polygons, against a zero-alpha clear-plane (would use wrong shader, resulting in broken transparency) 2019-11-03 09:55:52 +01:00
204b5d8700 HARK HARK HARK 2019-06-25 19:29:21 +02:00
dac9ccc577 fix OGL renderer not working at all on some GPUs 2019-06-17 13:14:52 +02:00
34c60eaca4 fix bugs with line polygons 2019-06-12 13:14:11 +02:00
27f758d353 hack so that the GL renderer can render lines 2019-06-12 03:55:40 +02:00
a3fed77da3 somewhat better edge marking 2019-06-12 02:23:40 +02:00
9ab331c6dd fix more stupid shit. askzjkdsf 2019-06-09 20:44:35 +02:00
c056dfe509 fix fog alpha 2019-06-09 19:53:28 +02:00
086354a420 miserable, feeble little attempt at edge marking 2019-06-09 19:32:02 +02:00
8fc30d69c5 fix last bugs when changing video settings with no game loaded 2019-06-08 13:06:36 +02:00
06e08b053f do binding of VS inputs and FS outputs before linking shader programs, as per OpenGL standard.
should fix the rendering issues with strict drivers (AMD, Intel).
2019-05-31 02:26:13 +02:00
f6814e02c0 * add needed libui functions under Windows, even if they don't do a whole lot
* fix ass-stupid fog bug
2019-05-31 21:37:30 +02:00
c49dec1acd try to fix fog consecutively to the Intel fix. still not perfect for whatever reason
also clean up more code
2019-05-31 03:00:53 +02:00
ee61b97ec9 OpenGL renderer: fix for Intel driver (doesn't like RGB8UI framebuffers) 2019-05-30 02:44:49 +02:00
70a3243714 simpler GPU-compositing. will make it easier to grab neighbor 2D/3D pixels individually for filtering. 2019-05-25 19:36:47 +02:00
8c93a45574 also support alpha-only fog 2019-05-25 13:45:00 +02:00
478ca019da implement fog correctly
also some base work for edgemarking
2019-05-25 13:43:06 +02:00
7cdeb7fa4e feeble, miserable little attempt at emulating fog 2019-05-25 04:28:00 +02:00
04f1809dd1 finish fixing shadows 2019-05-25 02:34:14 +02:00
182e123598 fix shadow bugs
bahaahah
2019-05-25 01:55:44 +02:00
9e2f47f4a0 fix more bugs 2019-05-24 02:35:25 +02:00
667dee6754 more code botching
it's less shitty tho

but still has bugs
2019-05-24 02:04:41 +02:00