Commit graph

918 commits

Author SHA1 Message Date
gm-matthew a2645c944f Give PowerPC more cycles to acknowledge sound IRQs
400 cycles was not enough and would cause VF3 to hang. 1000 cycles should be more than plenty
2024-07-13 18:50:31 -07:00
Ian Curtis 5a8cddd09a remove dead code 2024-07-13 12:14:54 +01:00
Ian Curtis 79868e0ad3 fix compilation 2024-07-08 12:19:06 +01:00
gm-matthew 2b186e688c Texture mipmaps must be at least 2x2
Fixes sky in Dirt Devils
2024-07-06 00:04:52 +01:00
gm-matthew 3cf8a1fa94 Implementing texture NP values
For some reason Model 3 uses vertex coordinates rather than texel coordinates to calculate mipmap levels
Revised microtexture implementation; results are very close to real hardware when running at native resolution with supersampling disabled
2024-07-05 15:57:25 +01:00
Ian Curtis 19612e1b13 fix merge error 2024-06-13 13:43:42 +01:00
Ian Curtis 4d1484c0c9 merge conflicts 2024-06-13 13:40:30 +01:00
Ian Curtis edb11dc223 Performance improvements
The old texture code was being bottle necked by the texture reads. We mirrored the real3d texture memory directly, including the mipmaps in a single large texture. I *think* most h/w has some sort of texture cache for a 2x2 or 4x4 block of pixels for a texture. What we were doing was reading the base texture, then reading the mipmap data from a totally separate part of the same texture which I can only assume flushed this cache. What I did was to create mipmap chains for the texture sheet, then copy the mipmap data there. Doing this basically doubles performance.
2024-06-13 13:36:30 +01:00
gm-matthew 42e236be0d Add comment briefly explaining optimization 2024-06-10 15:25:13 -07:00
gm-matthew f30a8ee2a8 Minor shader optimization
If the mipmap level is 0.0, we only need to run texBiLinear() for the highest quality texture mipmap
Adds around 10-20% more performance in Daytona 2
2024-06-10 15:25:13 -07:00
Ian Curtis a6466b353d spelling 2024-06-01 19:20:35 +01:00
Ian Curtis 21e148599a Fix some missing scroll fog background effects in ECA 2024-06-01 10:38:40 +01:00
gm-matthew 7d32bde074 When disabling sound IRQs via MIDI control port, clear current IRQ
Prevents Dirt Devils hanging during boot
2024-05-22 15:36:15 -07:00
gm-matthew 8a0bf29dd8 Sound IRQs are acknowledged by writing to MIDI data port 2024-05-20 13:38:45 +01:00
gm-matthew 3e394d1257 Only access SCSI device at 0xC0xxxxxx if it has been configured to do so
Fixes some step 1.5 games not working in last update
2024-05-04 19:43:02 +01:00
dukeeeey 2245fca796
Merge pull request #147 from gm-matthew/scuddxo
Adding newly dumped version of Scud Race
2024-05-02 23:29:47 +01:00
gm-matthew 39dc16d8ba Use integer value for game stepping 2024-05-02 23:25:53 +01:00
gm-matthew 944e4855d9 Adding newly dumped version of Scud Race
Allow Step 1.5 games to access 53C810 via 0xC00000xx if the netboard is disabled, because scuddxo requires this
2024-05-02 15:43:37 +01:00
dukeeeey dec85032ba
Merge pull request #138 from h0tw1r3/fix/2d-shaders
Fix 2D texture rendering on OSX
2024-03-14 10:30:48 +00:00
Bart Trzynadlowski d9f48db5db CLogger: destructor needs to be virtual 2024-03-09 20:56:50 -08:00
Jeffrey Clark 93f622ee25 cleanup code format 2024-03-06 01:07:56 -06:00
Jeffrey Clark 047b15c210 fix 2d shaders on OSX 2024-03-06 02:11:21 -06:00
baraclese 1bb7de1dd9 fix segfault in CMultiLogger
vsprintf may change its va_list argument so repeatedly calling it with the same va_list arg is undefined behavior.
Fix this by creating a copy of the va_list argument before each vsprintf call.
2024-03-05 16:07:47 -08:00
Bart Trzynadlowski e59ecea32d PowerPC frequency determined by board stepping, config option is now just an override 2024-01-28 21:08:12 -08:00
Ian Curtis 75260f9f2c Clamp LODscale. If the object is drawn at zero we produce an Inf value which will produce Nans with later calculations. 2023-12-29 13:28:10 +00:00
Ian Curtis 0e07f29f80 Amend ambient fog logic
Should stop the sky flashing in lemans24, and the background totally disappearing in sega rally after a game. The logic here is still not totally understood but works well enough for the games.
2023-12-27 12:42:32 +00:00
Ian Curtis c039d08c03 Add supersampling anti-aliasing
Late christmas present. Due to the way alpha works on the model3 adding regular anti-aliasing doesn't really work. Supersampling is very much a brute force solution, render the scene at a higher resolution and mipmap it.

It's enabled via command line with the -ss option, for example -ss=4 for 4x supersampling or by adding Supersampling = 4 in the config file.

Note non power of two values work as well, so 3 gives a very good balance between speed and quality. 8 will make your GPU bleed, since it is essentially rendering 64 pixels for every visible pixel on the screen.
2023-12-26 18:25:03 +00:00
gm-matthew 6acb1165d4 Added new uniform bool polyAlpha to shaders
Added original matrix functions back into Mat4 class though they are currently unused
2023-12-22 16:31:05 +00:00
gm-matthew 9f66fcaac7 Floating point reversed z-buffer and new clipping code
Also always draw nodes with culling disabled even if they test as being outside the visible frustum
2023-12-22 02:00:47 +00:00
dukeeeey a19ba3cba8
Merge pull request #118 from firewave/uninit
Model3.cpp: avoid usage of uninitialized memory
2023-12-03 18:22:30 +00:00
firewave 71e5baa61b Model3.cpp: avoid usage of uninitialized memory
```
==213531== Thread 20 SoundBoardNoSyn:
==213531== Conditional jump or move depends on uninitialised value(s)
==213531==    at 0x1A1D1E: CModel3::RunSoundBoardThread() (Model3.cpp:2607)
==213531==    by 0x49BECEA: UnknownInlinedFun (SDL_thread.c:292)
==213531==    by 0x49BECEA: RunThread.lto_priv.0 (SDL_systhread.c:76)
==213531==    by 0x4F719EA: start_thread (pthread_create.c:444)
==213531==    by 0x4FF5653: clone (clone.S:100)
```
2023-12-03 14:46:23 +01:00
firewave 1cc94b7d79 Inputs/MultiInputSource.cpp: fixed mismatching allocation and deallocation
Detected by Cppcheck:
```
Src/Inputs/MultiInputSource.cpp:87:3: error: Mismatching allocation and deallocation: CMultiInputSource::m_srcArray [mismatchAllocDealloc]
  delete m_srcArray;
  ^
```
2023-12-03 14:43:22 +01:00
firewave 5332d8f945 fixed some -Wunused-* compiler warnings 2023-12-02 14:27:32 -08:00
Ian Curtis df0034ac1f fix minor error 2023-11-18 22:56:15 +00:00
Ian Curtis bd63400471 Optimise shader code (gm_matthew) 2023-11-17 22:22:50 +00:00
Ian Curtis 44fb32f2a9 fix compilation on linux 2023-11-17 18:03:40 +00:00
Ian Curtis cdf5e4b2b2 Fix transparency depth testing
The two transparency layers, might not be separate layers at all. We believe the hardware is writing each layer to every other pixel (stipple alpha), then using an anti-aliasing filter to effectively blend the pixels. Because the pixels don't overlap they don't depth test against each other. We are using separate layers to emulate this, so the depth buffer must be saved and restored between the layers.
2023-11-17 16:07:20 +00:00
dukeeeey de61835f14
Merge pull request #107 from gm-matthew/lod-blending
Implement LOD blending
2023-11-17 15:53:14 +00:00
Ian Curtis 8778f98c4a Add missing edge on transluency function 2023-11-17 15:50:04 +00:00
gm-matthew ac53101214 Implement LOD blending
If two translucent polygons with opposing patterns overlap the result is always opaque
Also the LOD scale calculation depends on Euclidean distance of x, y and z, not just z
2023-11-17 15:13:27 +00:00
Ian Curtis d726356006 Remove debug code 2023-11-13 23:19:18 +00:00
Ian Curtis 33d65e097f Merge branch 'master' of https://github.com/trzy/Supermodel 2023-11-13 21:17:15 +00:00
Ian Curtis efe3077f53 Fix some stencil issues
The stencil mask must be set to all 1s otherwise we can't clear all the bits in the stencil buffer. Also we no longer need to save/restore the depth buffer into between priority layers.
2023-11-13 21:17:06 +00:00
Bart Trzynadlowski 3022e418c7 Added some TODO notes to Main.cpp 2023-11-11 13:57:30 -08:00
Bart Trzynadlowski 47253d8398 Fixed graphics analysis -gfx-state option 2023-11-11 13:55:02 -08:00
Bart Trzynadlowski a57b379498 DSB.h: when generating a debug build in gcc w/ -g, k_framePeriod was causing a linker error. Not sure why k_timerPeriod wasn't but made them both constexpr. 2023-11-11 13:46:05 -08:00
Bart Trzynadlowski ccca9afceb byte_layout attribute for region tag, intended to support Sega Racing Classic 2 ROM extracted from Yakuza 2023-11-11 13:11:15 -08:00
Ian Curtis c40d6ac17b Rewrite the stencil buffer usage slightly, so both the LOS and layered polys work. LOS uses the top bit of the stencil buffer. Fixes some minor issues with draw order in sega rally. 2023-11-10 19:13:37 +00:00
Ian Curtis f9a0901e8c Fix regression
Scroll attenuation seems to disable ambient fog. If scroll attenuation is enabled it's telling the h/w to draw the real3d spot light on fog for the scroll fog layer. This should fix a regression where the background disappears on sega rally.
2023-11-09 18:41:57 +00:00
Ian Curtis a8976b51a2 typo 2023-11-06 10:56:39 +00:00