Commit Graph

52 Commits

Author SHA1 Message Date
GPF
f11f7c966a texture: fix Dreamcast hardware texture and scissor regressions
Fix several Dreamcast hardware regressions found while testing real PVR behavior.

- Upload the default white texture through the platform texture loader instead of memcpy directly into PVR texture memory.
- Add GPUTextureLoad so SH4 uses pvr_txr_load while the software backend keeps memcpy behavior.
- Track scissor/userclip application per polygon list and invalidate scissor state at buffer swap.
- Submit queued geometry before USERCLIP/header transitions in the SH4 submit path.
- Remove the stale packed 4bpp source-size double-halving in glTexImage2D.
- Add texture regression coverage for packed 4bpp, unpack row length, compressed palette4 forwarding, and 8bpp-to-4bpp packing.
- Update the scissor sample and add polygon_compare as a small hardware comparison sample.

Verified:
- make -C dcbuild gldc_tests scissor polygon_compare
- scissor sample on Dreamcast hardware
- polygon_compare sample on Dreamcast hardware
- existing strided texture sample on Dreamcast hardware
2026-07-03 09:37:12 -07:00
GPF
424765b07d Fix CMake backend compile definition typo 2026-06-27 19:16:14 -07:00
Paul Cercueil
b10a2f5d54
CMake: Separate GLU into its own library
Some libraries expect GL and GLU to be separate.
Move our existing glu.c code to libGLU.a to keep them happy.

Note that some of the GLU code still exists in matrix.c, but that should
be fine as GLU has a dependency on GL anyway.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
2026-06-27 12:16:28 +02:00
Paul Cercueil
134b58f8db
CMake: Add install rule
Install libGL and its headers to the sysroot directory when
"make install" is executed.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
2026-06-27 12:15:55 +02:00
Paul Cercueil
cfaf24e5ee
CMake: Update CMake script to modern standards
Note that I dropped quite a few things related to CFLAGS:
- the -mfsrra / -mfsca discovery was clean cmake and could have stayed;
  but kos-cc already passes those flags, so -ffast-math is enough to
  enable the FSRRA / FSCA instructions.
- -fomit-frame-pointer is also a default option of KOS.
- -fexpensive-optimizations, -finline-functions and -fstrict-aliasing
  were redundant as they are enabled by the optimization level
  specified.
- -ffp-contract=fast is the default when using GNU C, which we are here.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
2026-06-27 12:14:09 +02:00
Luke Benstead
d3e709cdb0 Merge branch 'nehe06-dt-sample' into 'master'
Add nehe06_dt Dreamcast texture sample

See merge request simulant/GLdc!172
2026-06-27 06:27:06 +00:00
GPF
8aa9a0ec43 Add GL_KOS_texture_stride support 2026-06-20 00:45:11 -07:00
GPF
0d1179808f Add nehe06_dt Dreamcast texture sample
Add a Dreamcast GLdc sample that loads a .dt texture from romdisk.

This adds a new nehe06_dt sample based on the existing NeHe cube demo, but loading a Dreamcast .dt texture directly from romdisk instead of the older texture formats.

Changes:
- add samples/nehe06_dt/main.c
- add samples/nehe06_dt/romdisk/NeHe.dt
- register the sample in CMakeLists.txt

The sample is useful for checking GLdc texture loading with Dreamcast-native .dt assets and for comparing the output against the source artwork on hardware.
2026-06-07 00:33:55 +00:00
Dave
20b57b88b2
Cleanups 2025-12-10 21:39:53 +01:00
Dave
0bda17d4aa
Add options to skip building samples and tests 2025-12-10 21:33:10 +01:00
UnknownShadow200
0e112ffb3c Merge branch 'master' into tnl_effects 2025-02-22 22:35:41 +11:00
UnknownShadow200
ff942e804e Add texture/color matrix sample 2025-02-22 10:52:09 +11:00
UnknownShadow200
93c81739ba WIP on a separate T&L effects file 2025-02-22 06:43:44 +11:00
Falco Girgis
56f5b24d85 Fixed OpenGL Fog implementation + Added New Sample
- Redid fog.c OpenGL fog back-end implementation
    * only reconfigure fog values when changed
    * properly clamp between 0.0f and 1.0f colors
    * error out on negative densities
    * separate fog statics became single struct
- Added Nehe16 example (adapted from KGL)
    * Made spinning much faster (so you can see it better)
    * fixed a few issues with KGL code (invalid GL enums, lol)
    * swapped to new controller API
    * added #ifdef for non-DC file paths
2025-02-18 21:52:19 -06:00
UnknownShadow200
bdecf90d64 Calculate read attribute functions when attribute states changes, instead of at every draw call 2025-02-01 15:38:59 +11:00
UnknownShadow200
165eb9d5c8 Add primitive modes sample, quad strips partially work
Although the second triangle is wrongly culled
2024-10-02 19:28:02 +10:00
Falco Girgis
49f2f0917b Nehe20 Build Fix + Warnings cleanup for GCC14.1.0.
Newest toolchain is bitchier, so I wanted to go ahead and clear up all
of the warnings from building GLdc and the various examples...

1) Set CMake CXX standard to 14 instead of 11, since CXXFLAGS were
  enforcing that language standard anyway.
2) Fixed a bunch of strict aliasing violations in immediate.c: glVertex3f.
3) Removed or commented out lots of unused variables.
4) Fixed some "suggested inner braces on initializer" crap.
5) Fixed a bunch of signed vs unsigned pointer assignments.
6) Fixed several printf() warnings from using %d with int32_t (needs to
   be %ld for long int).
7) Fixed build issue with Nehe20 from not including kos.h for the
   KOS_ROMDISK macro.
8) Fixed some signed vs unsigned comparison mismatches in C++ template
   instantiations within clipping tests.
9)
2024-07-31 20:35:34 -05:00
Luke Benstead
5c762b969e Build out to libGL.a instead of libGLdc.a 2023-11-29 11:25:52 +00:00
Luke Benstead
49a0e103cb Fix up CI 2023-09-01 20:34:29 +01:00
Luke Benstead
246cb997da Add optional dcprof to prof_texture_upload 2023-09-01 20:23:55 +01:00
Luke Benstead
4b47f6878f Remove yalloc 2023-09-01 08:34:48 +01:00
Luke Benstead
f278777c0e WIP: Start implementing new allocator 2023-08-31 08:47:00 +01:00
Luke Benstead
77531ca347 Drastically refactor glTexImage2D 2023-08-26 20:34:11 +01:00
Luke Benstead
a5891056db Many bug fixes and optimisations 2023-05-16 13:31:44 +01:00
Luke Benstead
c754c5c338 Ensure RelWithDebInfo builds use release flags + debugging 2023-05-11 15:22:27 +01:00
Luke Benstead
9e1b1bc40a Merge branch 'clipping-rewrite-for-the-last-time-ffs' into 'master'
Restructure clipping to be much MUCH faster in the visible case

See merge request simulant/GLdc!105
2023-04-26 20:00:17 +00:00
Luke Benstead
e54494e995 More clipping work 2023-04-20 20:45:59 +01:00
Luke Benstead
c5ce81a38d WIP: Restructure clipping to be much MUCH faster in the visible case
This currently only works with triangles, anything more and it crashes
due to me not queuing subsequent vertices in the strip correctly
2023-04-19 20:57:44 +01:00
Dave
1a181f702c Update CMakeLists with CXX flags (Debug and Release) 2023-04-17 19:34:56 +02:00
Luke Benstead
25d215dad3 Add some compiler flags for lolz 2023-04-11 20:46:44 +01:00
Dave Reichelt
df9a12bbd6 Added new cubes sample
- A button toggles between glDrawElements and glDrawArrays
- B button toggles glBlend
- Start quits the sample
- Every 10 seconds a log with stats will be sent to the terminal
2023-04-08 21:42:03 +02:00
Colton Pawielski
5bb2691b91 Change CMakeLists.txt to add -mfsrra and -mfsca only if supported by compiler
GCC4.7 does not support these flags and cause a failure to build
2023-03-04 16:13:44 -06:00
Luke Benstead
aa875ae4d1 Fix compiler flags 2022-11-04 19:34:42 +00:00
Luke Benstead
a248f3a50c Faster inversion 2022-11-03 20:24:38 +00:00
Luke Benstead
9d9a502e96 Remove old clipping 2022-06-13 20:16:46 +01:00
Luke Benstead
68c6936b25 Add nehe10 sample 2022-06-10 20:26:51 +01:00
Luke Benstead
83e325ab3c Fix CMake 32bit issues 2022-05-21 20:16:26 +01:00
T_chan
ae3ebe2e5c regroup the BMP file loading into 1 file, and correct some types that give... 2022-01-31 10:30:26 +00:00
T_chan
ab627b5ef5 merge of blend_test and lerabot_blend_test, addition of 1 case, and... 2022-01-31 10:04:50 +00:00
Luke Benstead
dd16530a1f Fix an assertion in debug, and building on PC 2021-09-18 14:36:47 +01:00
Luke Benstead
4adc49cd40 Optimisations 2021-09-12 15:04:52 +01:00
Luke Benstead
cfefce44a6 Add nehe20 sample 2021-05-08 14:17:57 +01:00
Luke Benstead
0a8d43d47b Add nehe08 sample 2021-04-30 20:47:33 +01:00
Luke Benstead
5a9b7bb37e Force inline aligned vector functions 2021-04-20 16:49:00 +01:00
Luke Benstead
ea25251944 Optimisations 2021-04-20 16:08:58 +01:00
Luke Benstead
faf24ac61d Small optimisations 2021-04-20 09:07:14 +01:00
Luke Benstead
8977fbf6e2 Compile quadmark on PC 2021-04-19 20:43:56 +01:00
Luke Benstead
b480c0a01f Fix optimisations 2021-04-19 20:21:46 +01:00
Luke Benstead
ce9f3677f6 Immediate mode optimisation 2021-04-18 21:33:23 +01:00
Luke Benstead
f03f0e8f04 Implement glScissor correctly 2021-04-14 21:38:33 +01:00