Previous Thread
Next Thread
Print Thread
Page 1 of 2 1 2
Joined: Jul 2006
Posts: 56
Junior Member
Junior Member
Joined: Jul 2006
Posts: 56
I just compiled the latest SDLMAME with the test3 patch, but the 3D-acceleration doesn't seem to work.

Changing from soft to opengl results in abysmal framerates and maxed-out CPU, while all games I tried run full speed in software-mode with plenty of CPU power left.

I am running Ubuntu 6.06 and my GFX card is a Ati Radeon x1300 (using the latest official Ati drivers).

Hardware OpenGL works with other programs, so I probably messed something up?

Here is the output of the program:

Code
Using SDL single-window OpenGL driver (SDL 1.2)
1680x1050 -> 0.000457
[...lots of videomodes skipped...]
320x 100 -> 0.000008
OpenGL: ATI Technologies Inc.
OpenGL: Radeon X1300 Series Generic
OpenGL: 2.0.5814 (8.25.18)
OpenGL: forcing power-of-2 textures
OpenGL: max texture size 2048 x 2048
Average FPS: 56.437865 (629 frames)
Note: the Average FPS stated here must be wrong, during the game it was almost always below 20, with choppy sound and everything.

Please help me! I just went through compiling AdvanceMAME, XMAME and XMAME/SDL and it seems like I finally found the perfect version, if it weren't for the not working OpenGL.

Joined: Mar 2001
Posts: 17,316
Likes: 280
R
Very Senior Member
Very Senior Member
R Offline
Joined: Mar 2001
Posts: 17,316
Likes: 280
So this only happens with OpenGL and not if you run with "-video soft"? Because this sounds more like an RDTSC issue than an OpenGL one.

Also, you do realize the OpenGL mode will *not* speed up 3D games - they are still rendered internally in software. Only vector games currently get true h/w acceleration, for the rest it's just a way to get nice filtered hwstretch on Linux at last (although on my GeForce 7800 it's also a lot faster than software).

Joined: Jul 2006
Posts: 56
Junior Member
Junior Member
Joined: Jul 2006
Posts: 56
Yes, it's just as I said.
For example, if I run Puyo Puyo 2 in soft mode I get smooth 60 FPS, in opengl mode I get constant 5 FPS... and the image quality is really poor, as you can see on the screenshot.

[screenshot cut for bandwidth savings]

And yes, I realize the acceleration is only for the scaling which is exactly what I am looking for (I want to scale to my native LCD resolution via OpenGL, like I do in Mednafen already).

Joined: Mar 2001
Posts: 17,316
Likes: 280
R
Very Senior Member
Very Senior Member
R Offline
Joined: Mar 2001
Posts: 17,316
Likes: 280
The text looks awful at output resolutions below 640x480, this is known. You can mitigate it by using a plainer .bdf font.

Apparently whatever I'm doing is hitting a "fallback to MesaGL" path in ATI's drivers. I'll ask Pete, since he's expert with dealing with their Linux drivers.

If you're capable, try changing to different 32-bit pixel formats in glTexImage2D() (src/sdl/drawsdl.c). The game will look wrong then, but if it suddenly gets very fast on some format let me know.

Joined: Jul 2006
Posts: 56
Junior Member
Junior Member
Joined: Jul 2006
Posts: 56
Quote
Originally posted by R. Belmont:
The text looks awful at output resolutions below 640x480, this is known. You can mitigate it by using a plainer .bdf font.
It is not the font. Look at the image around the menu, it is distorted in some places.

This is how it looks in soft mode:

[Linked Image from i3.photobucket.com]

The font looks perfectly fine here, as does the image. (disregard the black blotch on the image, it has nothing to do with SDLMAME)

I tried using RGBA instead of BGRA, but it didn't make any difference, except for the changed colors. The only other 32bit format I could find was GL_DEPTH_COMPONENT32 and while I don't really see anything anymore... the cpu usage is normal now and at least the sound seems perfectly fine!

The image just stays white all the time but if I press Tab I see the menu but the text is just a bunch of white blocks.

Joined: Mar 2001
Posts: 17,316
Likes: 280
R
Very Senior Member
Very Senior Member
R Offline
Joined: Mar 2001
Posts: 17,316
Likes: 280
Odd. I may have to see if I can find an ATI PCI-Express card cheap and bang on it.

Joined: Jul 2006
Posts: 56
Junior Member
Junior Member
Joined: Jul 2006
Posts: 56
I just recompiled Mednafen and there's no problem with OpenGL there at all.
It seems to use GL_RGBA for everything.

Maybe you can figure something out by looking at how it works there? I don't understand much of this...

Follow the above link to get to the source.
You'll probably be interested in src/drivers/opengl.cpp . The file is pretty small, I almost pasted it here.

Let us at least go through all the options before you buy another gfx card (especially if it's such a useless waste of money like my card! wink ).

Joined: Mar 2001
Posts: 17,316
Likes: 280
R
Very Senior Member
Very Senior Member
R Offline
Joined: Mar 2001
Posts: 17,316
Likes: 280
They're doing exactly what I'm doing modulo RGBA vs BGRA. Weird.

ETA: well, ok, a few differences.

Try this:
src/sdl/window.h, line 61 (should be right after "int yprescale", add this line:
int uploadedonce;

And in src/sdl/drawsdl.c, line ~1077 (I'm working off a MAME u11/12 updated codebase here so it's not exactly test 3), delete the glTexImage2D() call and add these lines:

glPixelStorei(GL_UNPACK_ROW_LENGTH, texture->rawwidth);

if (!texture->uploadedonce)
{
glTexImage2D(GL_TEXTURE_2D, 0, 4, texture->rawwidth, texture->rawheight, texture->borderpix ? 1 : 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, dbuf);
texture->uploadedonce = 1;
}
else
{
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, texture->rawwidth, texture->rawheight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, dbuf);
}

In theory, those things (which Medafen also does) should help. In practice I saw no difference on my NVidia card - it was 290 FPS either way in Gokujou Parodius, but maybe ATI's drivers will appreciate the help smile

Joined: Jul 2006
Posts: 56
Junior Member
Junior Member
Joined: Jul 2006
Posts: 56
Unfortunately it didn't help. frown

And why does SDLMAME say my average framerate was 59FPS while actually I had constant 5FPS?

Urge to destroy gfx card rising...

Joined: Mar 2001
Posts: 17,316
Likes: 280
R
Very Senior Member
Very Senior Member
R Offline
Joined: Mar 2001
Posts: 17,316
Likes: 280
If you hit F11 while in-game what rate does it say?

Page 1 of 2 1 2

Moderated by  R. Belmont 

Link Copied to Clipboard
Who's Online Now
0 members (), 628 guests, and 6 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,399
Posts122,883
Members5,092
Most Online3,327
Nov 10th, 2025
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Powered by UBB.threads™ PHP Forum Software 8.0.0