Commit graph

762 commits

Author SHA1 Message Date
fleroviux
a30f9ccd33 [GPU] Treat color and alpha sources as two separate RGBA values
Previously we fetched the RGB channels of the color source and the alpha channel of the alpha source
and combined these into a single RGBA source value that the source operands are applied to.
This is incorrect. The correct behavior is to fetch the full RGBA color for both the color and alpha
sources and to apply the color operand to the color source and the alpha operand to the alpha source,
i.e. using the *alpha* source R-channel when the alpha operand is "One minus source red".
Only after that we combine both sources into a single RGBA color.
2023-06-20 20:20:33 +02:00
Wunkolo
62fdb29646 Add GPU_DEBUG_INFO CMake-Option
Adds a project-wide setting for allowing renderer code to add additional
diagnostic data.  Currently used to allow `opengl.hpp` to conditionally
implement debug-labeling and scopes.
2023-06-20 11:04:52 -07:00
Wunkolo
dbf0597bd8 Add DebugScope utility-class for RAII-based OpenGL debug-scopes
Simply define this object in a C++ scope like:
```cpp
OpenGL::DebugScope glScope("Renderer::display");
```
and it will associate all functions within the current scope within a
named group. Supports `printf` formatting.
2023-06-20 10:10:11 -07:00
wheremyfoodat
dbe293bb52
Merge pull request #43 from Wunkolo/pica-types
Add PICA texel-format and topology types
2023-06-20 13:26:58 +03:00
Wunkolo
1251cecc88 Add setObjectLabel for naming OpenGL functions
Add `OPENGL_PRINTF_FORMAT` and `OPENGL_PRINTF_FORMAT_ATTR` macros for providing
printf diagnostic information across platforms.
2023-06-19 23:48:16 -07:00
Wunkolo
1b9f270b19 Migrate IOFile implementation to io_file.cpp
Makes the implementation of `IOFile` private, allowing inclusions and
defines such as `#define fseeko` and `#include <io.h>` to not poison
client-code or the global namespace.
2023-06-19 19:37:36 -07:00
fleroviux
9b1ed2084f [GPU] Implement initial support for multi-texturing 2023-06-20 00:01:12 +02:00
fleroviux
170fe9a4b2 Merge branch 'GamingProcessingUnit' of github.com:fleroviux/Panda3DS into pica-tev-emulation 2023-06-19 19:54:03 +02:00
wheremyfoodat
c042dbc293
Merge pull request #44 from skylersaleh/macos_fixes
Work around compilation errors on macOS
2023-06-19 00:06:10 +03:00
wheremyfoodat
6b5ec74aa4 [OutputVertex] Avoid unnamed struct 2023-06-18 23:59:41 +03:00
wheremyfoodat
88e3eb1558
Add std::bit_cast fallback for Helpers::bit_cast and run clang-format 2023-06-18 23:33:10 +03:00
fleroviux
927bf9fe32 Merge branch 'GamingProcessingUnit' of github.com:fleroviux/Panda3DS into pica-tev-emulation 2023-06-18 22:27:24 +02:00
wheremyfoodat
952e2d6d22 More accurate VAO implementation 2023-06-18 23:20:28 +03:00
Sky
e9b3b7c2a2 Add workaround helper for bit_cast and missing #include <bit>
Allows compilation on native macOS build system.
2023-06-18 12:33:34 -07:00
Wunkolo
6ee3f73335 Bisect TextureFmt and ColorFmt
Makes framebuffer-formats unrepresentable from texture formats while
allowing them to alias each other. Add utility functions as well that
just re-use the `TextureFmt` ones.
2023-06-18 08:22:14 -07:00
wheremyfoodat
e5b09fefc8
Merge pull request #40 from wheremyfoodat/bottom-screen
Stub screens in a bit less of a sad way
2023-06-18 17:35:37 +03:00
Wunkolo
134e16d8ea Replace Texture::Formats with PICA::ColorFmt
This enum was a duplicate of the PICA one. Now the PICA one is more
complete. Migrate `textureFormatToString` to be next to the enums
definition.
2023-06-18 00:10:04 -07:00
Wunkolo
5f07f77c94 Move hasStencil to regs.hpp 2023-06-17 23:27:19 -07:00
Wunkolo
838d3f27f9 Migrate PICA-types into PICA namespace
Rather than prefixing these types with `PICA`, a namespace is used instead.
2023-06-17 18:23:47 -07:00
fleroviux
1416456035 [GPU] DOT3_RGB(A) modes should remap the operands from [0, 1] to [-1, +1] range 2023-06-18 01:32:32 +02:00
Wunkolo
78a3f9fa23 Add PICA texel-format and topology types
Slowly stepping the codebase towards having renderer-agnostic types and keeping the translation of PICA-types to OpenGL/VK/DX/Software/etc to the renderer-backend.
2023-06-17 12:26:41 -07:00
wheremyfoodat
d0ae5f0546
Merge pull request #37 from marysaka/feat/proper-hle-result
hle: Add proper type for result code
2023-06-17 18:39:36 +03:00
fleroviux
78827886fe Merge branch 'master' of github.com:fleroviux/Panda3DS into pica-tev-emulation 2023-06-17 12:39:48 +02:00
fleroviux
3aeef23b2e Merge branch 'bottom-screen' of github.com:fleroviux/Panda3DS into pica-tev-emulation 2023-06-17 12:38:33 +02:00
wheremyfoodat
0bd77856e5
Merge pull request #42 from marysaka/misc/glad
misc: Switch from gl3w to glad
2023-06-17 12:53:33 +03:00
Mary
f3010f0909 misc: Switch from gl3w to glad
Also add more checks on window and context creation.
2023-06-17 11:26:18 +02:00
wheremyfoodat
6c29e3e0be
Merge pull request #41 from marysaka/fix/linux-cstdint-helper
fix: fix build on Linux with gcc
2023-06-17 11:45:59 +03:00
Mary
a799da1ec5 fix: fix build on Linux with gcc
Tested on Fedora 38, helpers.hpp was missing an import.
2023-06-17 10:11:35 +02:00
fleroviux
c9642292aa [GPU] Do scale on the final texture combiner output, not the individual sources 2023-06-17 02:06:05 +02:00
fleroviux
b854367676 [GPU] Move TEV uniforms update into its own method 2023-06-17 01:58:30 +02:00
fleroviux
a368d77005 [GPU] respect GPUREG_TEXENVi_SCALE 2023-06-17 01:42:53 +02:00
fleroviux
aef808cdfc [GPU] Cleanup TEV shader code to be less redundant 2023-06-17 01:35:35 +02:00
fleroviux
c3acf2b393 [GPU] cleanup and optimize the TEV shader functions 2023-06-17 01:27:26 +02:00
wheremyfoodat
5b3266be34 Fix merge conflict 2023-06-17 02:22:19 +03:00
wheremyfoodat
7b859ad602 Merge branch 'master' into bottom-screen 2023-06-17 02:19:30 +03:00
wheremyfoodat
245f0d2d18 Merge branch 'master' into bottom-screen 2023-06-17 02:11:14 +03:00
wheremyfoodat
1aab10bec7
Merge pull request #35 from Wunkolo/span-cpu-state
Use `std::span` for CPU register-state
2023-06-17 01:39:33 +03:00
wheremyfoodat
dafa919e1b
Merge pull request #33 from Wunkolo/span-vertex
Use `std::span` to pass vertex data
2023-06-17 01:38:40 +03:00
fleroviux
76d6140797 [GPU] Fix order of operands to mix() in the interpolation combine mode. 2023-06-17 00:12:07 +02:00
fleroviux
bcf6401d4d [GPU] Output mangenta when an unimplemented TEV source is used 2023-06-16 23:39:05 +02:00
wheremyfoodat
2f3bc5d38e [CPU] fprs() should return std::span<u32, 32> (Fixes memory corruption bug in threads.cpp) 2023-06-16 22:20:59 +03:00
wheremyfoodat
936302da2a Raise clang-format column size, make std::span support in opengl.hpp version-dependent 2023-06-16 22:06:59 +03:00
Mary
122b1b2727 hle: Add proper type for result code
This should clean up all HLE errorcode in the codebase.

I didn't removed Rust::Result as this should be a cleanup for another
iteration.
2023-06-16 20:09:37 +02:00
Wunkolo
553d23974a Use std::span to pass vertex data
Starts utilizing
[std::span](https://en.cppreference.com/w/cpp/container/span) to
indicate a non-owning view of a contiguous array of elements rather than
`T* data, usize count`.
2023-06-16 07:28:35 -07:00
Wunkolo
fde93381a5 Use std::span for CPU register-state
Following the trend of #33: `std::span` provides some useful utility
functions like `size_bytes()` and `as_bytes()` and serves as a better
non-owning "chunk of data"-type over just passing around an
`std::array&`.
2023-06-16 07:24:37 -07:00
wheremyfoodat
c6f5d19983
Merge pull request #34 from Wunkolo/pica-regs-helpers
Add missing header for regs.hpp
2023-06-16 16:05:07 +03:00
Wunkolo
0199918cd2 Add missing header for regs.hpp
This enum was using the `u32` type without including `helpers.hpp`, causing weird intermediate compiler errors when making incremental builds.
2023-06-16 05:48:33 -07:00
wheremyfoodat
519fb35c5f Less UB 2023-06-16 14:22:29 +03:00
fleroviux
2e85f30c10 [GPU] attempt to emulate the previous TEV color buffer 2023-06-16 01:34:11 +02:00
fleroviux
d153133070 [GPU] fix missing break statements in 'previous' combiner mode implementation 2023-06-16 00:52:00 +02:00