Commit Graph

1031 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
862bcf70d1 Use release-compatible PVR texture stride setup 2026-07-01 20:48:06 -07:00
Falco Girgis
49b7a3f208 Merge branch 'fixCmaketypo' into 'master'
Fix CMake backend compile definition typo

See merge request simulant/GLdc!175
2026-06-28 05:06:13 +00:00
GPF
424765b07d Fix CMake backend compile definition typo 2026-06-27 19:16:14 -07:00
Luke Benstead
488968ce61 Merge branch 'cmake-install' into 'master'
CMake: Update CMake script, fix samples, add install rule

See merge request simulant/GLdc!174
2026-06-27 21:04:15 +00: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
6ea25ff3c7
samples: Fix dual inclusion of romdisk file
The romdisk is automatically initialized when linked, and does not have
to be initialized in any way in C code. Doing so results in multiple
inclusions of the romdisk file.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
2026-06-27 12:14:33 +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
e823205ebc Merge branch 'glPolygonMode-limited-scope-integration' into 'master'
add limited-scope compatability glPolygonMode state for GL_TRIANGLES + GL_LINE/GL_POINT

See merge request simulant/GLdc!169
2026-06-27 06:33:55 +00: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
Luke Benstead
4e959259fd Merge branch 'feature/kos-texture-stride' into 'master'
Add GL_KOS_texture_stride support for Dreamcast strided textures

See merge request simulant/GLdc!173
2026-06-27 06:25:44 +00:00
GPF
35b3946cc4 Fix POT repeat wrap test to upload POT texture first
The test could inherit a previously uploaded NPOT/strided texture from an earlier test, causing GL_REPEAT to be rejected before the POT upload occurred. Upload the POT texture before setting repeat wrap so the test verifies that POT textures still allow repeat wrapping.
2026-06-23 10:10:58 -07:00
Luke Benstead
9ee62ded90 Restore set_clamp_wrap 2026-06-23 05:32:40 +00:00
Luke Benstead
cbc83deee0 Merge branch 'master' into 'feature/kos-texture-stride'
# Conflicts:
#   tests/test_glteximage2d.h
2026-06-23 05:25:48 +00:00
Luke Benstead
9f83169b7a Fix failing test 2026-06-23 06:23:52 +01:00
Luke Benstead
c3a7776f30 Add more extensive test suite 2026-06-22 09:05:44 +01:00
GPF
7b48abc040 Updated the MR based on the feedback:
Replaced GL_KOS_texture_stride with GL_KOS_texture_non_power_of_two
Removed the explicit texture parameter and made supported NPOT GL_TEXTURE_2D textures automatically use the PVR strided backend
Added clamp-only validation and retained the existing restrictions around mipmaps, wrapping, and unsupported formats

The underlying PVR strided implementation remains the same. GL_NV_texture_rectangle can be considered as a future follow-up.
2026-06-20 14:34:27 -07:00
GPF
6915d7a58c Merge remote-tracking branch 'upstream/master' into feature/kos-texture-stride
# Conflicts:
#	GL/texture.c
2026-06-20 01:12:32 -07: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
Luke Benstead
2da4f94b9a Merge branch 'optimize-sdl-texture-streaming' into 'master'
Improve unpack handling for streaming texture uploads

See merge request simulant/GLdc!171
2026-06-06 06:01:04 +00:00
GPF
5065405e71 Optimize streaming texture updates 2026-06-05 21:11:02 -07:00
Luke Benstead
c94bfd7c9c Merge branch 'new-vertex-structure' into 'master'
Start refactoring everything

See merge request simulant/GLdc!167
2026-05-04 10:04:29 +00:00
Luke Benstead
f56bf397de Fix failing tests 2026-05-04 10:35:21 +01:00
Luke Benstead
8aa0e305eb Many texture and lighting fixes 2026-05-04 08:59:12 +01:00
Luke Benstead
b0ef8ed151 Fix fast path calculation 2026-05-03 21:31:58 +01:00
Luke Benstead
57ab4b60a6 Avoid copies when converting textures 2026-05-03 18:47:58 +01:00
Luke Benstead
d85b8e515c Fix lighting issues 2026-04-26 21:24:58 +01:00
Luke Benstead
e685190df0 Use KOS CMake toolchain 2026-04-26 21:24:25 +01:00
Luke Benstead
ce67e37c5d Switch to m4-single 2026-04-23 20:00:48 +01:00
Luke Benstead
8743b0a5b9 Add tests 2026-04-20 22:23:31 +01:00
iann
fca24d106f add limited-scope compatability glPolygonMode state for GL_TRIANGLES + GL_LINE/GL_POINT 2026-04-16 19:27:19 +09:00
Luke Benstead
71da98a0cd Clean up some state 2026-03-04 21:13:42 +00:00
Luke Benstead
21a66c8284 Fix behaviour of current color, normal etc. 2026-03-04 21:04:24 +00:00
Luke Benstead
f0eefc4125 Get non textured polys working 2026-03-01 08:13:04 +00:00
Luke Benstead
13a7de3633 Fix software build 2026-02-28 22:04:08 +00:00
Luke Benstead
bf45f36e82 More float color work 2026-02-28 14:26:22 +00:00
Luke Benstead
cb3153d763 Start refactoring everything 2026-02-23 21:41:00 +00:00
Luke Benstead
ba10615722 Allow compiling containers on Xbox
Obviously GLdc doesn't work on XBox but the containers are fairly generic and are (ab)used
in the Simulant engine which does compile there.
2026-02-15 07:33:44 +00:00
Luke Benstead
105e3253e2 Merge remote-tracking branch 'freakdave/Extend-CMakeLists' 2025-12-10 20:49:48 +00:00
Dave
20b57b88b2
Cleanups 2025-12-10 21:39:53 +01:00
Dave
af223847dc
Update README.md to reflect latest changes 2025-12-10 21:39:09 +01:00
Dave
0bda17d4aa
Add options to skip building samples and tests 2025-12-10 21:33:10 +01:00
Luke Benstead
b67c8976db Don't fail when passing GL_TEXTURE_BINDING_CUBE_MAP_ARB to glGet 2025-11-01 21:15:03 +00:00
Luke Benstead
e61ffaede1 Merge branch 'deinit_fix' into 'master'
Allow for proper shutdown/deinitialization

See merge request simulant/GLdc!165
2025-09-16 19:02:45 +00:00
darc
67f2671618 Allow for proper shutdown/deinitialization 2025-09-15 16:50:02 -05:00
jnmartin84
cae97a2cce mirrored repeat param should only alter mirrored repeat state 2025-09-15 16:50:02 -05:00
jnmartin84
b5bde0a259 sorry, I was wrong about the clamp state for MIRRORED_REPEAT 2025-09-15 16:50:02 -05:00
Falco Girgis
88e7130e98 Changed fabs() to fabfs() within glClipEdge(). 2025-09-15 16:50:02 -05:00