Commit graph

58 commits

Author SHA1 Message Date
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
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
Ian Curtis acab274526 Set language standard to c++ 17 2023-10-30 14:04:48 +00:00
Ian Curtis 6595b9320e Rewrite the renderer a bit to spit out the finished graphics from the 3d chip on separate buffers. One buffer is for opaque pixels, and 2 more for translucent pixels. Before the frame was composited on the back buffer, which meant the tilegen had to have been drawn first. This way the images are now totally independant of the tilegen chip so can be drawn as soon as the register write 0xC is written to the tilegen.
Some games update the tilegen after the ping_ping bit has flipped at 66% of the frame, so we need to split the tilegen drawing up into two stages to get some effects to work. So having the tilegen draw independantly of the 3d chip can make this happen.
2023-10-14 20:05:00 +01:00
Ian Curtis c6ea81d996 Emulate the entire tilegen chip in a GLSL shader. (This is now possible with opengl 3+). The tilegen drawing was emulated on the CPU, but was one of the most expensive functions in the emulator according to a profiler. On a modern GPU it's pretty much free, because a GPU is a massive SIMD monster.
Tilegen shaders are mapped to uniforms, and the vram and palette are mapped to two textures.

TODO rip out the redundant code in the tilegen class. We don't need to pre-calculate palettes anymore. etc

The tilegen code supports has a start/end line so we can emulate as many lines as we want in a chunk, which will come in later as some games update the tilegen immediately after the ping_pong bit has flipped ~ 66% of the frame.

The scud rolling start tilegen bug is probably actually a bug in the original h/w implementation, that ends up looking correct on original h/w but not for us. Need hardware testing to confirm what it's actually doing.
2023-09-23 15:27:04 +01:00
CapitaineSheridan b19fdb6a77 Change Media folder to Assets folder.
Naming variable convention.
Command line change -crosshair-style = vector|bmp.
Config ini variable change CrosshairStyle = vector|bmp.
CCrosshair::DrawCrosshair optimisation.
Modifying UpdateCrosshairs() to eliminate global variable.
2023-03-13 20:18:51 -07:00
CapitaineSheridan 1b066fe4b3 Crosshair refactor
-add a new separate class for crosshair
-crosshair coordinates are calculated by matrix instead of recreating every object at correct coordinates
-add ability to scale crosshair by dpi
-add ability to use bitmap crosshair (located in ./Media/). 32bits bmp format + alpha
-cmd line "-bitmapcrosshair" or "-vectorcrosshair" and/or BitmapCrosshair=0|1 in config file
-these changes are only for lost world game with Crosshairs=1|2|3

don't forget to copy the 2 crosshair images in Supermodel/Media folder
2023-03-13 20:18:51 -07:00
gm-matthew 50d947deee Add FileSystemPath.cpp to Visual Studio project 2022-12-14 00:29:25 -08:00
Ian Curtis 40c8259130 Rewrite the whole project for GL4+. I figured if we removed the limitation of a legacy rendering API we could improve things a bit. With GL4+ we can do unsigned integer math in the shaders. This allows us to upload a direct copy of the real3d texture sheet, and texture directly from this memory given the x/y pos and type. This massively simplifies the binding and invalidation code. Also the crazy corner cases will work because it essentially works the same way as the original hardware.
The standard triangle render requires gl 4.1 core, so should work on mac. The quad renderer runs on 4.5 core. The legacy renderer should still work, and when enabled a regular opengl context will be created, which allows functions marked depreciated in the core profiles to still work. This will only work in windows/linux I think. Apple doesn't support this.

A GL 4.1 GPU is now the min required spec. Sorry if you have an OLDER gpu. GL 4.1 is over 12 years old now.

This is a big update so I apologise in advance if I accidently broke something :]
2022-11-07 21:33:01 +00:00
toxieainc 519d695f57 address review and move bit casts to new header 2022-10-03 17:59:59 -07:00
Ian Curtis 83e7b5f45d njz3: Proper quadrophonic audio support. Need 4+ speakers to take advantage otherwise down mixed to stereo. 2022-06-09 21:10:39 +00:00
Matthew Daniels 5a570ce7fe Adding simulated netboard; all linked games except Sega Rally 2 working at full speed. 2021-04-14 01:20:45 +00:00
Ian Curtis 0bfc2aea31 Fix project file 2021-02-19 11:03:48 +00:00
Ian Curtis ba917aca6d Update glew version 2020-07-31 19:18:51 +00:00
Ian Curtis daef27be37 Replace network code with new tcp implementation 2020-06-16 11:55:38 +00:00
Ian Curtis 8071efbf79 Add SDLnetworking + some basic tcp classes 2020-06-13 19:46:12 +00:00
Ian Curtis 8b4a4ec93f add missing file 2020-06-10 09:12:34 +00:00
Ian Curtis 90df4afbad update vs project files 2020-06-08 14:27:37 +00:00
Ian Curtis 8aa476aeeb Previous mpeg audio code worked for me in debug mode, but the release build had some serious corruption issues when being built in visual studio. Replaced the old spaghetti code with a more modern implementation. 2019-02-21 14:56:25 +00:00
Ian Curtis b5f9ad9651 Quad rendering engine. Set QuadRendering = 1 in the ini file to use, or -quad-rendering at the end of the command line to use. 2018-09-13 12:50:34 +00:00
Ian Curtis c7ffd0a808 Draw transparent polys to separate layers and composite at the end. This solves a tonne of transparency errors we had been battling with for a long time. The model3 is strange in the fact it only supports a max of two translucent overlapped polys. They are not blended into the frame normally. Doing this means the topmost translucent polys only are visible in the scene, the equivalent of doing a depth pass first, but without the added cost. 2018-06-16 21:31:29 +00:00
Ian Curtis 04758e38b6 Update make files and fix build for the various options (Harry Tuttle) 2018-01-22 21:01:35 +00:00
Ian Curtis 6efa03112e Rewrite projection maths based upon previously unknown viewport values. The previous values used roughly worked as the normals for frustum planes. Perhaps they were only used for culling and not actually rendering, as sometimes the values don't work correctly. 2018-01-08 18:35:42 +00:00
Ian Curtis 0b6da91cc0 add the rest of the network board code (Spindizzi) 2018-01-07 14:07:59 +00:00
Ian Curtis 78ae00faf1 Add basic networking files to supermodel. Currently these are win32 specific but can port to SDL or whatever later. 2017-12-29 11:42:03 +00:00
Ian Curtis 7c84bc6aeb update visual studio project 2017-10-05 18:54:36 +00:00
Ian Curtis 18f460db6f 2017-09-24 22:49:20 +00:00
Ian Curtis da1342b5d9 update project files 2017-09-24 22:39:53 +00:00
Ian Curtis 06cb5708e3 add missing include 2017-04-08 21:01:11 +00:00
Ian Curtis edfb521a9b Daytona seems to use this completely undocumented feature of the real3d pro-1000, the ability to invert texture colours. This patch fixes the colours on the cars, and the signs which should flash by alternating their colours. 2017-04-05 17:57:38 +00:00
Ian Curtis f320af2049 fix project files 2017-03-27 22:01:31 +00:00
Ian Curtis f0a15febd1 implement scroll fog, fixes a tonne of missing fx 2016-10-09 16:34:12 +00:00
Ian Curtis f4311a0ab2 update visual studio project 2016-07-10 13:11:51 +00:00
Ian Curtis 85c4d85562 refactor 2016-06-19 21:43:09 +00:00
Ian Curtis c2b1db11f8 Cull geometry based on the culling distances in the nodes. Should give some sort of speedup on lower end pcs where the CPU is predominantly the bottle neck. 2016-06-16 20:05:29 +00:00
Ian Curtis 6d1aa4d527 fix compilation 2016-05-03 18:38:06 +00:00
Ian Curtis 09e27e3082 color flag 2016-04-27 16:42:31 +00:00
Ian Curtis 74e7ff3d7d update project 2016-04-27 11:17:28 +00:00
Ian Curtis f09dd457c5 Update vs project for encryption code 2016-04-02 22:14:39 +00:00
Ian Curtis 9c2aff72c8 add missing file 2016-04-02 15:41:50 +00:00
Ian Curtis 736f5ab958 add missing project files 2016-04-01 16:36:12 +00:00
Ian Curtis c398cab1b1 update project 2016-03-29 15:29:15 +00:00
Ian Curtis 0327db246f WIP 2016-03-24 13:17:17 +00:00
Ian Curtis 44ea902181 add missing project file 2016-03-22 22:00:17 +00:00
Ian Curtis 93f6b01e0b Update project to vs 2013. Clean compile warnings 2016-03-22 12:30:23 +00:00
Nik Henson 183dca563d Committing various small updates that have been hanging around in my source tree for a while now:
- Added 'crosshairs' command line and config option.
- Added 'vsync' command line and config option (so far only tested on NVidia cards on Windows 7 - other graphics drivers, O/Ss or driver settings may simply chose to ignore this).
- Added fullscreen toggle within game using Alt+Enter key combination.
- Added framework for lamp outputs and 'outputs' command line and config option.  So far only the lamps for driving games are hooked up in the emulator (others to be added later).
- Added an initial outputs implementation for Windows that sends MAMEHooker compatible messages (-outputs=win to enable)
- Fixed fps calculation in Main.cpp that was producing incorrect results and so giving the impression that frame throttling wasn't working properly when in fact it was.
- Fixed palette indexed colours as the index was always off by one, causing incorrect colours in various games, eg drivers' suits and flashing Start sign in Daytona 2.
- Altered caching of models so that models with palette indexed colours use the dynamic cache rather than the static one.  This is so that changes in palette indexed colours appear on screen, eg the flashing Start sign on the advanced course of Daytona 2 (although currently the START message itself is not visible due to other problems with texture decoding).
- Fixed small bug in TileGen.cpp which meant both palettes were being completely recomputed pretty much with every frame.  This was a significant performance hit, particularly as palette recomputation is currently being done in SyncSnapshots (it should be moved out of here at some point, although for now it's no big deal).
- Made sure all OpenGL objects and resources are deleted in Render2D/3D destructors, in particular the deleting of the VBO buffer in DestroyModelCache.
- Made sure that GLSL uniforms are always checked to see if they are bound before using them in order to stop unecessary (but harmless) GL errors.
- Altered the default texture sheet handling to use a single large GL texture holding multiple Model3 texture sheets rather than multiple GL textures as before (if required, the old behaviour can still be selected with the mulisheet fragment shader).  I believe this fixes the disappearing crosshairs/corrupt GL state problem which the multisheet fragment shader seemed to be triggering somehow.
- Fixed a bug in debugger which meant memory watches were not triggering properly
2012-07-15 21:04:46 +00:00
Bart Trzynadlowski ac29fc1e88 Somehow John's Build.bat and Clean.bat did not get added in r262. Here they are. 2012-07-12 06:40:55 +00:00
John Peterson 3963a7a53c Applied a series of patches by John Peterson:
- Fixed a printf statement in ConsoleDebugger.cpp.
- Fixed memory watches not breaking in CPUDebug.h.
- Added some helpful batch files to the VS2008 directory.
- Added support for automatic loading of parent ROM sets.
2012-07-12 05:28:08 +00:00
Nik Henson 3b41239cfb This update fixes (hopefully) the last of the texture upload lags that were affecting some games, in particular Daytona 2 and Spikeout.
To achieve this UploadTextures no longer clears the model cache when called.  Instead the cache is kept in-tact (which should help improve cache hits) and all textures referenced by models being rendered are (re-)decoded with every frame.
To help with tracking all the unique texture references contained in a model a new class TextureRefs has been added.
2012-02-23 23:20:21 +00:00
Nik Henson 8a4ea64994 Added OSD/Video.h to provide OSD-dependent video functionality. The static functions in here get called by Model3.cpp from within the render thread so that any OSD related rendering can also be run in parallel for a further speed increase.
Updated OSD/SDL/Main.cpp to provide the SDL implementations of the functions in OSD/Video.h.
2012-02-13 23:37:48 +00:00