Vanfanel
Posts: 433
Joined: Sat Aug 18, 2012 5:58 pm

DOSBOX with GLES2 + tv shader + dynamic recompiler

Tue May 19, 2015 5:14 pm

Hi there!

I've made a patch that enables GLES2 with a nice scanlines effect working in any resolution, and dynamic recompiler, for Raspberry Pi 1 and 2.
This is, no doubt, the best version of DOSBOX running on the Pi (taking into acount that DOSBOX is a VERY demanding emulator CPU-wise).

For now, until this patch is integrated into DOSBOX code, simply clone the SVN:

Code: Select all

svn checkout svn://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk dosbox-code-0
Unzip and apply the attached patch:

Code: Select all

cd dosbox-code-0
patch -p1 < dosbox_gles.patch
Configure like this for Raspberry Pi 1:

Code: Select all

CFLAGS="-Ofast -mfpu=vfp -march=armv6j -mfloat-abi=hard" CXXFLAGS="-Ofast -mfpu=vfp -march=armv6j -mfloat-abi=hard" ./configure --disable-opengl --enable-opengles
OR like this for Raspberry Pi 2:

Code: Select all

CFLAGS="-Ofast -mfloat-abi=hard -march=armv7-a -mfpu=neon-vfpv4" CXXFLAGS="-Ofast -mfloat-abi=hard -march=armv7-a -mfpu=neon-vfpv4" ./configure --disable-opengl --enable-opengles
and build:

Code: Select all

make -j8
I do -j8 because I use distcc to do compilation on a compilation server with a lot for cores. Don't do that if you're building on a Pi, just use "make".

Now edit .dosbox/dosbox-SVN.conf and get sure that the following values are set like this:

Code: Select all

usescancodes=false
core=dynamic
I can't publish a binary right now because my Pi isn't using Raspbian versions of some libs,so you have to build yourself. A precompiled binary is due soon.

Enjoy!
Attachments
dosbox_gles.zip
DOSBOX patch that enables GLES2, dynamic recompiled and TV effect shader.
(7.93 KiB) Downloaded 250 times
Last edited by Vanfanel on Tue May 19, 2015 7:59 pm, edited 1 time in total.

AmigaGamer
Posts: 91
Joined: Sat Feb 01, 2014 9:02 pm

Re: DOSBOX with GLES2 + tv shader + dynamic recompiler

Tue May 19, 2015 6:24 pm

Thanks for this Vanfanel

Ive been running with a SDL2 patch for a while, will be good to see how this compares.

Since the dynarec is enabled at build time make sure [cpu] core=dynamic in the config file. I found in previous testing setting core=auto didn't always work properly

Looking forward to trying this out.

edit : got this working , i had to set usescancodes=false in the .dosbox/dosbox-SVN.conf to fix keymap errors.

Vanfanel
Posts: 433
Joined: Sat Aug 18, 2012 5:58 pm

Re: DOSBOX with GLES2 + tv shader + dynamic recompiler

Tue May 19, 2015 8:04 pm

AmigaGamer, thanks, I had forgot about the scancodes and cpu settings!
I have added them to the first post with the rest of instructions. Yes, cpu=dynamic is required.

I haven't tested the SDL2 patch, but I see it's done by ny2003 who is a great guy, I met him on #dosbox several times and he helped me when I was starting to grasp how the dosbox build system does certain things.
I guess you will find speed is very similar if you use output=texture with the SDL2 patch. Please tell me how this compares! In the end, SDL2 is the way to go and I should be looking into porting the scanlines shader to the SDL2 dosbox.

AmigaGamer
Posts: 91
Joined: Sat Feb 01, 2014 9:02 pm

Re: DOSBOX with GLES2 + tv shader + dynamic recompiler

Tue May 19, 2015 9:12 pm

Yes speedwise i cant see any real-world difference between sdl2 and the gles renderer at present (which makes sense since sdl2 is scaling with gles i believe??). Ill run some doom fps tests when i get things working how i want them.

One thing i have noticed is with a few games your version isnt scaling games to full screen, for example Ultima8 on sdl2 scales to full screen, on gles2 its centered at about 1/3 of screen size. This may just be a config file issue with fixed resolution on my part (on sdl2 you have to use fullresolution=0x0 to enable the scaling).

While your working on dosbox (and scummvm) you might find the fluidsynth patches interesting http://www.vogons.org/viewtopic.php?f=3 ... 1&start=20 I use the fsynth-3-reverb patch on dosbox. With scummvm(inbuilt) and dosbox(patched) i use an awe32 soundfont to get rid of the nasty fm synthesis. Surprisingly the fluidsynth patch doesnt seem to add any lag to dosbox emulation in my experience... maybe its because theres less translating midi to fm going on, or perhaps fluidsynth as a different thread is using a different core? (im guessing- i havent investigated much )

somewhere i have this stuff prepatched/diffed against 3910 , if its any interest ill send it over

bidinou
Posts: 68
Joined: Fri Sep 27, 2013 8:53 am
Location: France

Re: DOSBOX with GLES2 + tv shader + dynamic recompiler

Fri Apr 15, 2016 1:20 pm

Hi ! This is exactly what I was looking for :) I'm planning to use dosbox on my Pi 3 with pixel shaders and an external MIDI synth (which should significantly unload the CPU and improve the music).

Is it possible to have up to date information for building it on the Pi 3 ? Is the patch still working on the current SVN ? Thanks a lot !

Also... Is it possible to use it without the X server ? I build dosbox svn and managed to start it from the console without X. It seems to work but keyboard keys were incorrect.

bidinou
Posts: 68
Joined: Fri Sep 27, 2013 8:53 am
Location: France

Re: DOSBOX with GLES2 + tv shader + dynamic recompiler

Fri Apr 15, 2016 2:01 pm

OK, I applied the patch to the latest CVS (or SVN I'm a bit lost) and specified the configuration options as suggested above. It compiled properly with dynrec and gles. However when starting dosbox (from X) I get the following message :

libEGL warning : DRI2: failed to authenticate
dosbox: gles_ctx.cpp:486: void pi_init_egl [...] failed

(on a Pi 3)

When starting it without X I get a black screen with a mouse pointer and have to unplug the Pi :)

Surface mode does work, though, but is not really usable as scalers are not applied, so the window is extremly tiny :)

I'm sure I'm pretty close to an amazing result :) BTW, I'm also interested in your scummvm patch with TV shader :)

Vanfanel
Posts: 433
Joined: Sat Aug 18, 2012 5:58 pm

Re: DOSBOX with GLES2 + tv shader + dynamic recompiler

Sat Apr 16, 2016 12:51 am

Hello,

I am not using anything based on SDL1 anymore, so my advice is to patch DOSBOX to SDL2 using this:

http://www.vogons.org/viewtopic.php?t=34770

And rebuild it. No tv-like shaders.
I can upload ready-to-use patched sources if you want them too.
I don't have time or motivation to improve dosbox for the Pi anymore, sorry.

bidinou
Posts: 68
Joined: Fri Sep 27, 2013 8:53 am
Location: France

Re: DOSBOX with GLES2 + tv shader + dynamic recompiler

Sat Apr 16, 2016 7:34 am

Hi !

Thanks for the reply :)

Would it be difficult for someone else to add scanlines the dosbox/sdl2, based on your previous patch ? I guess we could fall back to this dosbox fork that supports libsdl2 and pixel shaders : https://github.com/duganchen/dosbox/blo ... CEMENTS.md

I have trouble getting it to work though. If anyone else manages to, please let us know :) Well, it does build but is extremely slow in opengl mode for some reason. Probably because it requires OpenGL 3 ! (I'm a little clueless sorry :)

Cheers !
Mahen

bidinou
Posts: 68
Joined: Fri Sep 27, 2013 8:53 am
Location: France

Re: DOSBOX with GLES2 + tv shader + dynamic recompiler

Sat Apr 16, 2016 11:00 am

Okay, I finally found a satisfying solution : using the dosbox build from the RetroPie project. Dynamic mode is enabled, no opengl output (only surface) but scalers work and display is fullscreen. The result is pretty good with the "tv2x" scaler (nice scanlines). There is tearing though (and enabling fullscreen + fulldouble makes it slow).

User avatar
johannesl
Posts: 17
Joined: Thu May 23, 2013 8:38 pm

Re: DOSBOX with GLES2 + tv shader + dynamic recompiler

Sun Apr 30, 2017 7:02 pm

Fully understandable that you don't have the motivation to keep improving this after two years. :arrow:

Would be great if you could upload ready-to-use SDL2-patches if you have them.

raysaaron
Posts: 31
Joined: Sun Feb 12, 2017 4:20 am

Re: DOSBOX with GLES2 + tv shader + dynamic recompiler

Mon May 01, 2017 7:29 am

will glide be possible? (3dfx)

Return to “Gaming”