Previous Thread
Next Thread
Print Thread
Page 1 of 3 1 2 3
#30374 06/15/07 02:37 AM
Joined: Jun 2007
Posts: 4
U
Member
OP Offline
Member
U
Joined: Jun 2007
Posts: 4
Hi.

I compiled both sdlmame 0.115u4 and 0.116 (the link seems to work smile ) on Windows XP, and it always crashes in opengl mode, unlike sdlmame 0.115. I debugged a little and it seems that VBO or PBO support is the problem. I have an NVIDIA GeForce Go 7200, and I tried a different set of drivers with no success.

Here's the output on startup:
Code:
Using SDL single-window OpenGL driver (SDL 1.2)
OpenGL: NVIDIA Corporation
OpenGL: GeForce Go 7200/PCI/SSE2
OpenGL: 2.0.1
OpenGL: non-power-of-2 textures supported (new method)
OpenGL: vertex buffer object
OpenGL: pixel buffers supported
OpenGL: max texture size 4096 x 4096
OpenGL: VBO PBO supported

Here's a snap of the gdb session:
Code:
texture_update (sdl=0x40ddb10, prim=0x40df590) at src/osd/sdl/drawsdl.c:1557

(...)

texture_update (sdl=0x40ddb10, prim=0x40df590) at src/osd/sdl/drawsdl.c:1589
1589                        pfn_glBufferData( GL_ARRAY_BUFFER_ARB, 4*2*sizeof(GLfloat), texture->texCoord, GL_STATIC_DRAW_ARB );
(gdb) step
0x696309d0 in _libuser32_a_iname ()
(gdb) step
Single stepping until exit from function _libuser32_a_iname,
which has no line number information.

Program received signal SIGSEGV, Segmentation fault.
0x69668666 in _libuser32_a_iname ()

I tried to see the backtrace, but it only shows that _libuser32_a_iname. Perhaps there's stack corruption.

I then edited loadGLExtensions() to set usevbo and usepbo to false. Setting both or usevbo to false fixes it, setting only usepbo to false still crashes. I don't understand why does it crash as I'm not much into opengl.


PS: Further disassembling reveals compilation fault. The parameter assignment is made with moves instead of pushes, and it overrides the address of variable "texture" (as well as du and dv). My guess is that it only crashes in this function because the previous two only override du and dv.

And further googling, adding __stdcall before the * in PFNGL... declarations resolves it, the compiler sets the stack pointer correctly before assigning parameters. Seems to be windows specific, I don't know.
Code:
diff -r -N -U3 src/osd/sdl/drawsdl.c_ src/osd/sdl/drawsdl.c
--- src/osd/sdl/drawsdl.c_      Sun May 27 13:33:02 2007
+++ src/osd/sdl/drawsdl.c       Thu Jun 14 19:27:59 2007
@@ -31,12 +31,17 @@
 #endif

 #if defined(SDLMAME_MACOSX) || defined(SDLMAME_WIN32)
-typedef void (* PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
-typedef void (* PFNGLBINDBUFFERPROC) (GLenum, GLuint);
-typedef void (* PFNGLBUFFERDATAPROC) (GLenum, GLsizeiptr, const GLvoid *, GLenum);
-typedef GLvoid* (* PFNGLMAPBUFFERPROC) (GLenum, GLenum);
-typedef GLboolean (* PFNGLUNMAPBUFFERPROC) (GLenum);
-typedef void (* PFNGLDELETEBUFFERSPROC) (GLsizei, const GLuint *);
+#ifdef SDLMAME_WIN32
+#define APIENTRY __stdcall
+#else
+#define APIENTRY
+#endif
+typedef void (APIENTRY * PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
+typedef void (APIENTRY * PFNGLBINDBUFFERPROC) (GLenum, GLuint);
+typedef void (APIENTRY * PFNGLBUFFERDATAPROC) (GLenum, GLsizeiptr, const GLvoid *, GLenum);
+typedef GLvoid* (APIENTRY * PFNGLMAPBUFFERPROC) (GLenum, GLenum);
+typedef GLboolean (APIENTRY * PFNGLUNMAPBUFFERPROC) (GLenum);
+typedef void (APIENTRY * PFNGLDELETEBUFFERSPROC) (GLsizei, const GLuint *);
 #endif

 // make sure the extensions compile OK everywhere

Joined: Nov 2006
Posts: 239
S
Senior Member
Offline
Senior Member
S
Joined: Nov 2006
Posts: 239
Would it be possible for you, to test it against the latest
snapshot ?

http://www.jausoft.com/cgi-bin/gitweb.cgi?p=mame/src/osd/sdl;a=shortlog;h=sgothel_stable

+++
Regarding your mentioned fix, the '__stdcall' for the
GL function declarations, can you provide a solution, which works
for both, MAC and WIN ?
It looks like, the MAC solution already works,
but we need your mentioned one for WIN.
While you are doing this, can you add this to all
the GL function declarations (drawsdl/gl_shader_tool) ?

And please, do your work against the latest snapshot.

Thank you.

sgothel #30378 06/15/07 03:58 AM
Joined: Mar 2001
Posts: 16,612
R
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,612
Thanks for the notice, I've deleted the (not for public consumption) private 0.116 that was on my server to prevent anyone else from getting confused by it. The real 0.116 will be "Sven free" simply to ensure the absolute stability that people expect in integer releases (even though that's never been true). We'll resume breaking your calling conventions in u1 ;-)

Joined: Nov 2006
Posts: 239
S
Senior Member
Offline
Senior Member
S
Joined: Nov 2006
Posts: 239
Hi RB, well I don't really like that decision,
but the truth is, we don't have not enough testers.

Even though I believe that the 'sven' stuff is less buggy than
the old one ;-)

[Despite this last outstanding WIN bug .. never tested]'

Yep, it all depends on the testers now.

sgothel #30381 06/15/07 04:08 AM
Joined: Mar 2001
Posts: 16,612
R
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,612
Agreed, but people have this somewhat unreasonable assumption that the non-u versions are "perfect", and at least this way I can claim it's "as perfect as 0.115" ;-) More testing is definitely in order.

sgothel #30382 06/15/07 04:18 AM
Joined: Jun 2007
Posts: 4
U
Member
OP Offline
Member
U
Joined: Jun 2007
Posts: 4
Originally Posted By sgothel
Would it be possible for you, to test it against the latest
snapshot ?

http://www.jausoft.com/cgi-bin/gitweb.cgi?p=mame/src/osd/sdl;a=shortlog;h=sgothel_stable
I don't understand which is the latest snapshot. The diff I posted was against 0.116 which seems to be available at sdlmame's page if you edit the link.

Quote:
+++
Regarding your mentioned fix, the '__stdcall' for the
GL function declarations, can you provide a solution, which works
for both, MAC and WIN ?
It looks like, the MAC solution already works,
but we need your mentioned one for WIN.
The declaration is generic (ifdef'd for windows), so if macosx worked before, it should still work after this change.

PS: Sorry smile I guess you meant about your latest version. I haven't tested it yet.

Quote:
While you are doing this, can you add this to all
the GL function declarations (drawsdl/gl_shader_tool) ?
I just found out I didn't have to google to get that solution smile Those declarations are all in In SDL_opengl.h. I think that, since you're using SDL, you could include that file instead of vanilla gl.h.

Quote:
And please, do your work against the latest snapshot.

Thank you.
Ok, so I'll assume your patch against sdlmame is the lastest.

Joined: Jun 2007
Posts: 4
U
Member
OP Offline
Member
U
Joined: Jun 2007
Posts: 4
Originally Posted By R. Belmont
Thanks for the notice, I've deleted the (not for public consumption) private 0.116 that was on my server to prevent anyone else from getting confused by it. The real 0.116 will be "Sven free" simply to ensure the absolute stability that people expect in integer releases (even though that's never been true). We'll resume breaking your calling conventions in u1 ;-)
As I answered sgothel, there's SDL_opengl.h which already defines things the right way, so you could use it, or peek into it if you have a reason to still use the OS gl.h. I didn't look much into the rest of the code, I only debugged it until the point it crashed and tried simple fixes.

BTW, what does "sven free" mean?

Joined: Nov 2006
Posts: 239
S
Senior Member
Offline
Senior Member
S
Joined: Nov 2006
Posts: 239
Originally Posted By upyourstruly

BTW, what does "sven free" mean?

They don't love me, sniff ;-)

sgothel #30388 06/15/07 04:50 AM
Joined: Nov 2006
Posts: 239
S
Senior Member
Offline
Senior Member
S
Joined: Nov 2006
Posts: 239
Fixed:
http://www.jausoft.com/cgi-bin/gitweb.cgi?p=mame/src/osd/sdl;a=shortlog;h=sgothel_stable

Just download the snapshot:
http://www.jausoft.com/cgi-bin/gitweb.cgi?p=mame/src/osd/sdl;a=snapshot;h=551e2a002aec94b5c8f43e3414f37e1a6ad5618b

and use the contained 'sdl' folder instead of the original.

-Sven

sgothel #30389 06/15/07 04:50 AM
Joined: Nov 2006
Posts: 239
S
Senior Member
Offline
Senior Member
S
Joined: Nov 2006
Posts: 239
To All .. please test the latest snapshot against all your systems, thanks.

Page 1 of 3 1 2 3

Moderated by  R. Belmont 

Link Copied to Clipboard
Who's Online Now
3 members (Vas Crabb, Duke, AJR), 47 guests, and 1 robot.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,834
Posts116,214
Members4,921
Most Online890
Jan 17th, 2020
Powered by UBB.threads™ PHP Forum Software 7.7.5