Commit Graph

101 Commits

Author SHA1 Message Date
Joshua Peisach
6b5fbdd27a
Refactor c3d renderer (#14)
* Refactor c3d renderer

* format

* Apply suggestions from code review

Co-authored-by: Anders Jenbo <anders@jenbo.dk>

---------

Co-authored-by: Anders Jenbo <anders@jenbo.dk>
2025-06-30 18:11:09 -04:00
Joshua Peisach
eeb7c16425
Merge remote-tracking branch 'upstream/master' into 3ds 2025-06-30 17:43:25 -04:00
Anders Jenbo
ab48ce60b0
OpenGL ES 2.0 Only lookup shader locations once (#460) 2025-06-30 23:38:44 +02:00
Anders Jenbo
225adda309
Rendering refactoring (#459)
* Hint texture intent to renderer

* improve transparancy for 32bit rendering

* Align OpenGL ES 2.0 with SDL_GPU's 2D rendering
2025-06-30 22:51:26 +02:00
Joshua Peisach
5c560df768
Merge branch 'master' into 3ds 2025-06-30 08:56:23 -04:00
Anders Jenbo
53407adf17
Set correct mipmap level for UI textures (#13) 2025-06-29 14:46:29 -04:00
Joshua Peisach
4d47eebad2
Cleanup 2025-06-29 14:26:36 -04:00
Anders Jenbo
93a4448e89
Optimize texture encoding (#12) 2025-06-29 13:39:07 -04:00
Joshua Peisach
8b9f0b7110
Update miniwin/src/d3drm/backends/citro3d/renderer.cpp
Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2025-06-29 12:34:27 -04:00
David Gow
e87184b502
Fix the OpenGL backends on non-glx Linux platforms (and remove GLEW dependency) (#446)
* Work around issues with depth-buffer size on EGL-based platforms

The OpenGL 1.1 and OpenGL ES 2.0 backends can break on EGL-based platforms,
such as Wayland, or X11 with SDL_VIDEO_FORCE_EGL=1. One of the reasons for
this (the other being glew on the GL1.1 backend) is that SDL/egl get very
confused by the way we set OpenGL attributes, particularly SDL_GL_DEPTH_SIZE,
resulting in SDL_GL_CreateContext() failing with EGL_BAD_MATCH.

The exact cause of this is unknown, but it seems to be a combination of:
- SDL_GL_SetAttribute() is supposed to be called _before_ the window is
  created, and we're calling it afterward.
- Creating several test windows during the enumeration process, mixing
  and matching between OpenGL and OpenGL ES profiles.

The "most correct" solution is probably to delay creating the game window
until the backend creation process, rather than before the enumeration
occurs. But that's a real refactor, which could cause other issues.

Instead, set the 24-bit bit depth (which we've hardcoded anyway) before
creating the window, and use SDL_GL_ResetAttributes() when creating backends.

This seems to work here in all of the cases I was able to try (modulo the GLEW
dependency, which is removed in the next patch).

* miniwin: Remove GLEW dependency for OpenGL 1.1

GLEW normally backs directly onto glXGetProcAddress on Linux, which is broken
on non-GLX setups, such as Wayland (but also X11 with EGL, and presumably KMSDRM).

Replace it with manual calls to SDL_GL_GetProcAddress() for the VBO path.

Note, however, that SDL_opengl.h includes "windows.h", so conflicts with the
miniwin implementation, which breaks builds on windows.

In order to work around this, we do what the Direct3D9 implementation does and
push all of the OpenGL calls to a separate file, actual.cpp.

Going forward, it may make sense to load _all_ OpenGL entry points via SDL,
which would allow us to avoid linking directly with libGL/libOpenGL, and
therefore eliminate the separate build dependency altogether, as well as
allowing more runtime configurability as to the OpenGL library to load.

(But that's definitely a bit uglier, and also useful very rarely.)
2025-06-29 17:47:09 +02:00
Anders Jenbo
019f055b77
Fix tiled textures and improve UI image quality (#11) 2025-06-29 07:23:21 -04:00
Anders Jenbo
d205e00b9b
Fix pure buffer clear frames (#9) 2025-06-28 17:46:21 -04:00
Anders Jenbo
c927ffb217 Apply optimizations 2025-06-28 21:54:08 +02:00
Anders Jenbo
e1c02d05dd Revert "Apply optimizations"
This reverts commit 6660082fef.
2025-06-28 21:06:37 +02:00
Anders Jenbo
ebb8284af0 Merge remote-tracking branch 'upsream/master' into 3ds 2025-06-28 09:09:20 +02:00
Anders Jenbo
87f4c83ff2 Implement lighting 2025-06-28 09:04:09 +02:00
Anders Jenbo
6660082fef Apply optimizations 2025-06-28 03:16:55 +02:00
Anders Jenbo
8891cbc714 Fix 3D rendering 2025-06-28 02:47:34 +02:00
Anders Jenbo
bd9b528660 Try to upload meshes and convert matricies 2025-06-27 23:39:17 +02:00
Anders Jenbo
4aceebaf64 Clean up Citro3D implementation 2025-06-27 21:37:09 +02:00
Anders Jenbo
8a039a81f6 Remove Citro3D init hacks 2025-06-27 21:27:59 +02:00
Anders Jenbo
9dd3feac8e Push mesh dynamically 2025-06-27 20:54:50 +02:00
Anders Jenbo
cf2435134d Render world content, sort of 2025-06-27 19:22:59 +02:00
Anders Jenbo
f80a55d4fb Implement 2D rendering via Citro3D 2025-06-27 05:18:39 +02:00
Danct12
a782c48980
miniwin: Use PRIu32 for printing uint32_t (#436)
Some architecture uses different type for uint32_t.

For example:
x86_64 | aarch64 = unsigned int
xtensa | riscv32 = long unsigned int
arm              = long unsigned int
2025-06-26 19:41:46 +02:00
MaxBrick
356e40c9f0 VERY AWESOME FEATURE FRFR 2025-06-25 23:59:36 -04:00
Anders Jenbo
dcacdcc711
Fix d3drmmesh type error (#433) 2025-06-26 02:46:10 +02:00
Joshua Peisach
d9da420569
[WIP] 3ds port
Recommit of everything after the 2d renderer merge
2025-06-25 16:00:30 -04:00
Anders Jenbo
b65284a7a0
Move 2D drawing and upscaling to the renderer (#348) 2025-06-25 19:45:26 +02:00
dcd4262f76
miniwin: fix OpenGL include on macOS (#350) 2025-06-20 22:54:05 +02:00
Anders Jenbo
ff03ffcc5a
Correct types for IDirect3DRMMesh::AddGroup (#345) 2025-06-19 04:55:33 +00:00
Anders Jenbo
6b2db2d85b
Correct some types for IDirect3DRMMesh (#344) 2025-06-19 04:40:03 +00:00
Anders Jenbo
a0c896a0b8
Fix a couple of memory leaks (#342) 2025-06-19 03:55:22 +00:00
Anders Jenbo
ea4b9ab1c9
Implement DirectX 9 backend (#332) 2025-06-18 18:10:48 +02:00
Anders Jenbo
e9c5e5b9ba
Use extensions to probe for 24 or 32bit depth buffer (#329) 2025-06-17 17:50:36 +02:00
Christian Semmler
3cfa3f5bec
Hotfix: reserve instead of resize 2025-06-16 21:00:12 -07:00
Christian Semmler
83205e2e4e
Fix UB in software renderer (#322)
* Fix UB in software renderer

One cannot access elements of the vector that don't exist. `reserve` allocates memory, but doesn't add elements.

`D3DRMVERTEX& dst = m_transformedVerts[i];` is UB and crashes on Windows debug build

* Update renderer.cpp
2025-06-17 05:25:34 +02:00
Anders Jenbo
0cfcc0fb21
Fix zawtooths during late game stage (#325) 2025-06-17 05:02:24 +02:00
Anders Jenbo
eab95514d6
Add an OpenGL ES 2.0 renderer (#287) 2025-06-17 03:47:23 +02:00
Anders Jenbo
1689a0063f
Fix an optimiaze OpenGL rendere (#320)
Co-authored-by: Christian Semmler <mail@csemmler.com>
2025-06-16 19:49:17 +02:00
Anders Jenbo
79726d25a4
Split framebuffer from general surfaces (#319) 2025-06-16 18:11:56 +02:00
Anders Jenbo
2828452b35
Clean up rendering (#301) 2025-06-16 04:28:32 +02:00
Anders Jenbo
4c80c8d923
Add 32bit color support (#311) 2025-06-14 23:09:23 +00:00
Anders Jenbo
65aafd2f44
Implement some minor functions in miniwin (#310) 2025-06-14 22:00:44 +02:00
Anders Jenbo
975764dc17
Align OpenGL and SDL_GPU specular with software (#305) 2025-06-14 18:05:25 +02:00
Anders Jenbo
d06caa99cb
Dial software speculare color in to match the original as best possible (#302) 2025-06-14 16:52:08 +02:00
Anders Jenbo
81ba75ea65
SIMD optimize z-buffer clear (#283) 2025-06-13 01:21:34 +02:00
Christian Semmler
5080e372f9
Emscripten port (#229)
* Emscripten port

* Fix NCC

* Update CMakeLists.txt

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>

* Update CMakeLists.txt

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>

* Update CMakeLists.txt

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>

* Update CMakeLists.txt

* cmake: set iniparser cmake options in local scope

* ci: try adding emscripten to test matrix

* cmake: try to make CMake install package more usable

* cmake: fix typo

* Update CMakeLists.txt

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>

* Add support for .ini loading

* Different default full screen behavior for Emscripten

* Add comments

* Add web platform

---------

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
Co-authored-by: Anonymous Maarten <anonymous.maarten@gmail.com>
2025-06-13 00:26:43 +02:00
Anders Jenbo
bbb0de6e9a
Implement full screen (#290) 2025-06-12 22:51:52 +02:00
Christian Semmler
b95ca4b2a3
Fix m_callbacks resource issue (#289) 2025-06-12 21:37:51 +02:00