Home Page
Posted By: upyourstruly VBO or PBO crash - 06/15/07 02:37 AM
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
Posted By: sgothel Re: VBO or PBO crash - 06/15/07 03:46 AM
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.
Posted By: R. Belmont Re: VBO or PBO crash - 06/15/07 03:58 AM
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 ;-)
Posted By: sgothel Re: VBO or PBO crash - 06/15/07 04:03 AM
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.
Posted By: R. Belmont Re: VBO or PBO crash - 06/15/07 04:08 AM
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.
Posted By: upyourstruly Re: VBO or PBO crash - 06/15/07 04:18 AM
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.
Posted By: upyourstruly Re: VBO or PBO crash - 06/15/07 04:18 AM
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?
Posted By: sgothel Re: VBO or PBO crash - 06/15/07 04:38 AM
Originally Posted By upyourstruly

BTW, what does "sven free" mean?

They don't love me, sniff ;-)
Posted By: sgothel Re: VBO or PBO crash - 06/15/07 04:50 AM
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
Posted By: sgothel Re: VBO or PBO crash - 06/15/07 04:50 AM
To All .. please test the latest snapshot against all your systems, thanks.
Posted By: sgothel Re: VBO or PBO crash - 06/15/07 04:58 AM
Now .. including SDL_opengl.h as well,
for our piece of mind ..

I hope it works for all Mac's and Win machines.
Please test.

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=2b363117f548e4e970e30e903517025990e7a695
Posted By: r0ni Re: VBO or PBO crash - 06/15/07 05:13 AM
I still get a few warnings here on OSX/gcc-4.0.1. The list is getting smaller, so I'll just paste it here:

Compiling src/osd/sdl/drawsdl.c...
src/osd/sdl/drawsdl.c: In function 'texture_compute_size_type':
src/osd/sdl/drawsdl.c:1311: warning: format '%d' expects type 'int', but argument 10 has type 'long int'
src/osd/sdl/drawsdl.c:1311: warning: format '%d' expects type 'int', but argument 11 has type 'long int'
src/osd/sdl/drawsdl.c: In function 'texture_shader_create':
src/osd/sdl/drawsdl.c:1515: warning: passing argument 2 of 'glGenTextures' from incompatible pointer type
src/osd/sdl/drawsdl.c:1526: warning: format '%d' expects type 'int', but argument 5 has type 'GLint'
src/osd/sdl/drawsdl.c:1526: warning: format '%d' expects type 'int', but argument 6 has type 'GLint'
src/osd/sdl/drawsdl.c:1555: warning: passing argument 2 of 'glGenTextures' from incompatible pointer type
src/osd/sdl/drawsdl.c:1572: warning: format '%d' expects type 'int', but argument 5 has type 'GLint'
src/osd/sdl/drawsdl.c:1572: warning: format '%d' expects type 'int', but argument 6 has type 'GLint'
src/osd/sdl/drawsdl.c:1620: warning: format '%d' expects type 'int', but argument 5 has type 'GLint'
src/osd/sdl/drawsdl.c:1620: warning: format '%d' expects type 'int', but argument 6 has type 'GLint'
src/osd/sdl/drawsdl.c: In function 'texture_create':
src/osd/sdl/drawsdl.c:1772: warning: passing argument 2 of 'pfn_glGenBuffers' from incompatible pointer type
src/osd/sdl/drawsdl.c:1778: warning: passing argument 2 of 'glGenTextures' from incompatible pointer type
src/osd/sdl/drawsdl.c: In function 'drawsdl_destroy_all_textures':
src/osd/sdl/drawsdl.c:2148: warning: passing argument 2 of 'pfn_glDeleteBuffers' from incompatible pointer type
src/osd/sdl/drawsdl.c:2153: warning: passing argument 2 of 'glDeleteTextures' from incompatible pointer type
src/osd/sdl/drawsdl.c:2155: warning: passing argument 2 of 'glDeleteTextures' from incompatible pointer type
Compiling src/osd/sdl/window.c...
src/osd/sdl/window.c: In function 'complete_create_wt':
src/osd/sdl/window.c:1189: warning: passing argument 2 of 'glGetIntegerv' from incompatible pointer type
src/osd/sdl/window.c:1190: warning: passing argument 2 of 'glGetIntegerv' from incompatible pointer type
Posted By: sgothel Re: VBO or PBO crash - 06/15/07 05:35 AM
Thanks r0ni, fixed:

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

Posted By: M. Twitty Re: VBO or PBO crash - 06/15/07 12:42 PM
Sven;

FYI, here's the output from 0115u4 using your latest patches (as per above post). The compile and link were successful, with the usual warnings.

Pacman runs fine, seemingly. But it has shader problems:

Code:
[twos:~/.advance] mtwitty% sdlmame_0115u4_sven -gl_glsl -gl_glsl_vid_attr pacman
Using SDL single-window OpenGL driver (SDL 1.2)
2007-06-14 21:27:27.889 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x335dfa0 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.889 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x335d9c0 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.889 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x33842b0 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.889 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x3381be0 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.889 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x18703990 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.889 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x18703dd0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.889 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x18703e30 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.889 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x18704300 of class NSCFData autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.902 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x187003f0 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.902 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x18704360 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.902 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x18700380 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.902 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x18705020 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.902 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x1870d5b0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.902 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x18705080 of class NSBundle autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.902 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x33330c0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.902 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x338ee50 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.903 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x338eee0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.903 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x338eff0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.903 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x3333160 of class NSConcreteData autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.903 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x1870d8f0 of class NSCFArray autoreleased with no pool in place - just leaking
OpenGL: ATI Technologies Inc.
OpenGL: ATI Radeon X1600 OpenGL Engine
OpenGL: 2.0 ATI-1.4.52
OpenGL: texture rectangle supported
OpenGL: non-power-of-2 textures supported (new method)
OpenGL: vertex buffer supported
OpenGL: pixel buffers supported
OpenGL: GLSL supported
OpenGL: max texture size 4096 x 4096
OpenGL: VBO supported
OpenGL: PBO supported
src/osd/sdl/gl_shader_tool.c:374: GL Error: object 0x9 compilation failed
src/osd/sdl/gl_shader_tool.c:374 glInfoLog: ERROR: 0:17: '-' :  wrong operand types  no operation '-' exists that takes a left-hand operand of type 'float' and a right operand of type 'const int' (or there is no acceptable conversion)

failed to process shader: <
#pragma optimize (on)
#pragma debug (off)

uniform sampler2D color_texture;
uniform sampler2D colortable_texture;
uniform vec2      colortable_sz;         // orig size for full bgr
uniform vec2      colortable_pow2_sz;    // orig size for full bgr

void main()
{
        vec4 color_tex;
        vec2 color_map_coord;
        float colortable_scale = (colortable_sz.x/3.0) / colortable_pow2_sz.x;

        // normalized texture coordinates ..
        color_tex = texture2D(color_texture, gl_TexCoord[0].st) * ((colortable_sz.x/3.0)-1)/colortable_pow2_sz.x;// lookup space 

        color_map_coord.x = color_tex.b;
        gl_FragColor.b    = texture2D(colortable_texture, color_map_coord).b;

        color_map_coord.x = color_tex.g + colortable_scale;
        gl_FragColor.g    = texture2D(colortable_texture, color_map_coord).g;

        color_map_coord.x = color_tex.r + 2.0 * colortable_scale;
        gl_FragColor.r    = texture2D(colortable_texture, color_map_coord).r;
}

>
OpenGL: GLSL supported, but shader instantiation failed - disabled
GL texture: copy 1 - shader 0 - dynamic 1 -  576x448 576x448 [format: PALETTE16, Equal: 0, Palette: 1, scale 2x2, borderpix 0, pitch 416,576/4096], colors: 514
GL texture: copy 1 - shader 0 - dynamic 1 -  576x448 576x448 [format: PALETTE16, Equal: 0, Palette: 1, scale 2x2, borderpix 0, pitch 416,576/4096], colors: 514
Average speed: 100.00% (15 seconds)


Mortal Kombat also seems to run correctly, with the following errors:

Code:
[twos:~/.advance] mtwitty% sdlmame_0115u4_sven -gl_glsl -gl_glsl_vid_attr mk
Using SDL single-window OpenGL driver (SDL 1.2)
2007-06-14 21:27:50.908 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x338d9a0 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-14 21:27:50.908 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x338d550 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-14 21:27:50.908 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x335f6f0 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-14 21:27:50.908 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x335d9b0 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-14 21:27:50.908 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x18803960 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:50.908 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x188038e0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:50.909 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x18803a70 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:50.909 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x18803ae0 of class NSCFData autoreleased with no pool in place - just leaking
2007-06-14 21:27:50.921 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x18801170 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-14 21:27:50.922 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x18800810 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-14 21:27:50.922 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x18804dc0 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-14 21:27:50.922 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x1880a1c0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:50.922 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x1880a270 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:50.922 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x18804df0 of class NSBundle autoreleased with no pool in place - just leaking
2007-06-14 21:27:50.922 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x33330c0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:50.922 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x1880d6f0 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-14 21:27:50.922 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x1880d780 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:50.922 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x1880d890 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:50.922 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x3333160 of class NSConcreteData autoreleased with no pool in place - just leaking
2007-06-14 21:27:50.923 sdlmame_0115u4_sven[12215] *** _NSAutoreleaseNoPool(): Object 0x1880a5d0 of class NSCFArray autoreleased with no pool in place - just leaking
OpenGL: ATI Technologies Inc.
OpenGL: ATI Radeon X1600 OpenGL Engine
OpenGL: 2.0 ATI-1.4.52
OpenGL: texture rectangle supported
OpenGL: non-power-of-2 textures supported (new method)
OpenGL: vertex buffer supported
OpenGL: pixel buffers supported
OpenGL: GLSL supported
OpenGL: max texture size 4096 x 4096
OpenGL: VBO supported
OpenGL: PBO supported
src/osd/sdl/gl_shader_tool.c:374: GL Error: object 0x9 compilation failed
src/osd/sdl/gl_shader_tool.c:374 glInfoLog: ERROR: 0:17: '-' :  wrong operand types  no operation '-' exists that takes a left-hand operand of type 'float' and a right operand of type 'const int' (or there is no acceptable conversion)

failed to process shader: <
#pragma optimize (on)
#pragma debug (off)

uniform sampler2D color_texture;
uniform sampler2D colortable_texture;
uniform vec2      colortable_sz;         // orig size for full bgr
uniform vec2      colortable_pow2_sz;    // orig size for full bgr

void main()
{
        vec4 color_tex;
        vec2 color_map_coord;
        float colortable_scale = (colortable_sz.x/3.0) / colortable_pow2_sz.x;

        // normalized texture coordinates ..
        color_tex = texture2D(color_texture, gl_TexCoord[0].st) * ((colortable_sz.x/3.0)-1)/colortable_pow2_sz.x;// lookup space 

        color_map_coord.x = color_tex.b;
        gl_FragColor.b    = texture2D(colortable_texture, color_map_coord).b;

        color_map_coord.x = color_tex.g + colortable_scale;
        gl_FragColor.g    = texture2D(colortable_texture, color_map_coord).g;

        color_map_coord.x = color_tex.r + 2.0 * colortable_scale;
        gl_FragColor.r    = texture2D(colortable_texture, color_map_coord).r;
}

>
OpenGL: GLSL supported, but shader instantiation failed - disabled
GL texture: copy 1 - shader 0 - dynamic 1 -  798x506 798x506 [format: PALETTE16, Equal: 0, Palette: 1, scale 2x2, borderpix 0, pitch 544,798/4096], colors: 32770
GL texture: copy 1 - shader 0 - dynamic 1 -  798x506 798x506 [format: PALETTE16, Equal: 0, Palette: 1, scale 2x2, borderpix 0, pitch 544,798/4096], colors: 32770
GL texture: copy 1 - shader 0 - dynamic 1 -  800x508 800x508 [format: PALETTE16, Equal: 0, Palette: 1, scale 2x2, borderpix 0, pitch 544,800/4096], colors: 32770
GL texture: copy 1 - shader 0 - dynamic 1 -  800x508 800x508 [format: PALETTE16, Equal: 0, Palette: 1, scale 2x2, borderpix 0, pitch 544,800/4096], colors: 32770
Average speed: 100.00% (82 seconds)


Virtua Racing just hangs after the warning screen, btw:

Code:
[twos:~/.advance] mtwitty% sdlmame_0115u4_sven -gl_glsl -gl_glsl_vid_attr pacman
Using SDL single-window OpenGL driver (SDL 1.2)
2007-06-14 21:27:27.889 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x335dfa0 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.889 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x335d9c0 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.889 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x33842b0 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.889 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x3381be0 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.889 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x18703990 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.889 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x18703dd0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.889 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x18703e30 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.889 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x18704300 of class NSCFData autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.902 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x187003f0 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.902 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x18704360 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.902 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x18700380 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.902 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x18705020 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.902 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x1870d5b0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.902 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x18705080 of class NSBundle autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.902 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x33330c0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.902 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x338ee50 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.903 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x338eee0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.903 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x338eff0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.903 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x3333160 of class NSConcreteData autoreleased with no pool in place - just leaking
2007-06-14 21:27:27.903 sdlmame_0115u4_sven[12214] *** _NSAutoreleaseNoPool(): Object 0x1870d8f0 of class NSCFArray autoreleased with no pool in place - just leaking
OpenGL: ATI Technologies Inc.
OpenGL: ATI Radeon X1600 OpenGL Engine
OpenGL: 2.0 ATI-1.4.52
OpenGL: texture rectangle supported
OpenGL: non-power-of-2 textures supported (new method)
OpenGL: vertex buffer supported
OpenGL: pixel buffers supported
OpenGL: GLSL supported
OpenGL: max texture size 4096 x 4096
OpenGL: VBO supported
OpenGL: PBO supported
src/osd/sdl/gl_shader_tool.c:374: GL Error: object 0x9 compilation failed
src/osd/sdl/gl_shader_tool.c:374 glInfoLog: ERROR: 0:17: '-' :  wrong operand types  no operation '-' exists that takes a left-hand operand of type 'float' and a right operand of type 'const int' (or there is no acceptable conversion)

failed to process shader: <
#pragma optimize (on)
#pragma debug (off)

uniform sampler2D color_texture;
uniform sampler2D colortable_texture;
uniform vec2      colortable_sz;         // orig size for full bgr
uniform vec2      colortable_pow2_sz;    // orig size for full bgr

void main()
{
        vec4 color_tex;
        vec2 color_map_coord;
        float colortable_scale = (colortable_sz.x/3.0) / colortable_pow2_sz.x;

        // normalized texture coordinates ..
        color_tex = texture2D(color_texture, gl_TexCoord[0].st) * ((colortable_sz.x/3.0)-1)/colortable_pow2_sz.x;// lookup space 

        color_map_coord.x = color_tex.b;
        gl_FragColor.b    = texture2D(colortable_texture, color_map_coord).b;

        color_map_coord.x = color_tex.g + colortable_scale;
        gl_FragColor.g    = texture2D(colortable_texture, color_map_coord).g;

        color_map_coord.x = color_tex.r + 2.0 * colortable_scale;
        gl_FragColor.r    = texture2D(colortable_texture, color_map_coord).r;
}

>
OpenGL: GLSL supported, but shader instantiation failed - disabled
GL texture: copy 1 - shader 0 - dynamic 1 -  576x448 576x448 [format: PALETTE16, Equal: 0, Palette: 1, scale 2x2, borderpix 0, pitch 416,576/4096], colors: 514
GL texture: copy 1 - shader 0 - dynamic 1 -  576x448 576x448 [format: PALETTE16, Equal: 0, Palette: 1, scale 2x2, borderpix 0, pitch 416,576/4096], colors: 514
Average speed: 100.00% (15 seconds)


My environment: iMac Core2Duo, OS X 10.4.9, GCC 4.1.2
Posted By: sgothel Re: VBO or PBO crash - 06/15/07 01:10 PM
Hi Tritty, thanks for testing !

The option '-gl_glsl_vid_attr' is enabled per default.

You are using Windows or Mac ?
Can you post the GL/SDL related warnings ?

I have tested all games, you mentioned, no problems.

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

Snapshot:
http://www.jausoft.com/cgi-bin/gitweb.cgi?p=mame/src/osd/sdl;a=snapshot;h=3d2ef44409d5f66a0288e5ccd29c1dc2862d1817

Posted By: sgothel Re: VBO or PBO crash - 06/15/07 01:12 PM
.. make sure gl_shader_mgr.c is recompiled !
Posted By: sgothel Re: VBO or PBO crash - 06/15/07 01:15 PM
@Twitty: As you can see, you have not used shader yet,
since they did not compiled through ..

Apply my patch and recompile.

Try option '-videoperformancetest'
so you can see and compare the true number for rendering.
Posted By: positiveinflux Re: VBO or PBO crash - 06/15/07 02:10 PM
I'll test regarding mid range fglrx r300 systems if thats any use...my sincere apologies for not replying to a request for that...moved across the country and have been working 60 + a week since i landed here
Posted By: M. Twitty Re: VBO or PBO crash - 06/15/07 02:17 PM
Sven;

Still no go. Unpacked a virgin copy of 0115u4 and added your snapshot files. Compiled and ran Pacman:

Code:
[twos:~/.advance] mtwitty% sdlmame_0115u4_sven -gl_glsl pacman
Using SDL single-window OpenGL driver (SDL 1.2)
2007-06-14 23:02:20.025 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x3387650 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-14 23:02:20.025 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x335f6e0 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-14 23:02:20.025 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x335d990 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-14 23:02:20.025 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x335df80 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-14 23:02:20.025 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x18703a70 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 23:02:20.025 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x18703d50 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 23:02:20.025 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x18703db0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 23:02:20.025 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x18704280 of class NSCFData autoreleased with no pool in place - just leaking
2007-06-14 23:02:20.038 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x18705070 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-14 23:02:20.038 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x18703170 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-14 23:02:20.038 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x1870a890 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-14 23:02:20.038 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x1870d480 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 23:02:20.038 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x1870d540 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 23:02:20.038 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x1870d4e0 of class NSBundle autoreleased with no pool in place - just leaking
2007-06-14 23:02:20.039 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x338e7d0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 23:02:20.039 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x1870d5a0 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-14 23:02:20.039 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x338ef50 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 23:02:20.039 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x338f060 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-14 23:02:20.039 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x338e710 of class NSConcreteData autoreleased with no pool in place - just leaking
2007-06-14 23:02:20.039 sdlmame_0115u4_sven[5775] *** _NSAutoreleaseNoPool(): Object 0x338efe0 of class NSCFArray autoreleased with no pool in place - just leaking
OpenGL: ATI Technologies Inc.
OpenGL: ATI Radeon X1600 OpenGL Engine
OpenGL: 2.0 ATI-1.4.52
OpenGL: texture rectangle supported
OpenGL: non-power-of-2 textures supported (new method)
OpenGL: vertex buffer supported
OpenGL: pixel buffers supported
OpenGL: GLSL supported
OpenGL: max texture size 4096 x 4096
OpenGL: VBO supported
OpenGL: PBO supported
src/osd/sdl/gl_shader_tool.c:374: GL Error: object 0xF compilation failed
src/osd/sdl/gl_shader_tool.c:374 glInfoLog: ERROR: 0:22: 'f' : syntax error parse error
ERROR: Parser found no code to compile in source strings.

failed to process shader: <
#pragma optimize (on)
#pragma debug (off)

uniform sampler2D color_texture;
uniform vec4      vid_attributes;     // gamma, contrast, brightness

// #define DO_GAMMA  1 // 'pow' is very slow on old hardware, i.e. pre R600 and 'slow' in general

void main()
{
#ifdef DO_GAMMA
        vec4 gamma = vec4( 1.0f / vid_attributes.r, 1.0f / vid_attributes.r, 1.0f / vid_attributes.r, 0.0);

        // gamma, contrast, brightness equation from: rendutil.h / apply_brightness_contrast_gamma_fp
        vec4 color = pow( texture2D(color_texture, gl_TexCoord[0].st) , gamma);
#else
        vec4 color = texture2D(color_texture, gl_TexCoord[0].st);
#endif

        // contrast/brightness
        gl_FragColor =  (color * vid_attributes.g) + vid_attributes.b - 1.0f;
}

>
OpenGL: GLSL supported, but shader instantiation failed - disabled
GL texture: copy 1 - shader 0 - dynamic 1 -  576x448 576x448 [format: PALETTE16, Equal: 0, Palette: 1, scale 2x2, borderpix 0, pitch 416,576/4096], colors: 514
GL texture: copy 1 - shader 0 - dynamic 1 -  576x448 576x448 [format: PALETTE16, Equal: 0, Palette: 1, scale 2x2, borderpix 0, pitch 416,576/4096], colors: 514
Average speed: 100.00% (17 seconds)


'gl_shader_mgr.c' appears to be compiling file. Maybe a makefile problem with the OS X defines?

I put a transcript of the compilation here:
0115u4_sven_compile_transcript.gz
Posted By: sgothel Re: VBO or PBO crash - 06/15/07 02:55 PM
Hi Twitty,

this 'bug' has nothing to do with your host compilation,
but with the GL drivers GLSL compiler ;-)

We just have to iterate through the GLSL bugs,
till they are compiled through ;-)

Thank you for fixing this with me.

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

Snapshot:
http://www.jausoft.com/cgi-bin/gitweb.cgi?p=mame/src/osd/sdl;a=snapshot;h=85e2030fd599ac8cfd50af699ebfb9456a87da6b

Posted By: M. Twitty Re: VBO or PBO crash - 06/15/07 04:17 PM
It's 1:15am local time, so I'll have to leave it here till tomorrow.

I'll apply the snapshot and see what happens.
Posted By: M. Twitty Re: VBO or PBO crash - 06/15/07 09:05 PM
Sven;

GL is now compiling and running the GLSL code correctly (I didn't realize the shaders were created on the fly like this). Virtua Racing still has problems, though. The screen initializes, but nothing is rendered past the white rectangle. I can hear the game's attract running in the background, though. Turning gl_glsl_filter off doesn't help. Here's the output from Virtua Racing:

Code:
[twos:~/.advance] mtwitty% sdlmame_0115u4_sven -gl_glsl vr
Using SDL single-window OpenGL driver (SDL 1.2)
2007-06-15 05:28:57.935 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x335d810 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-15 05:28:57.935 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x338cca0 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-15 05:28:57.935 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x3383160 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-15 05:28:57.935 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x338ccb0 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-15 05:28:57.935 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x18703740 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-15 05:28:57.935 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x187036c0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-15 05:28:57.935 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x18703850 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-15 05:28:57.936 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x187038c0 of class NSCFData autoreleased with no pool in place - just leaking
2007-06-15 05:28:57.994 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x187021b0 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-15 05:28:57.994 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x18704c30 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-15 05:28:57.994 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x187003e0 of class NSCFArray autoreleased with no pool in place - just leaking
2007-06-15 05:28:57.994 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x18709ed0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-15 05:28:57.995 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x18709f90 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-15 05:28:57.995 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x18709f30 of class NSBundle autoreleased with no pool in place - just leaking
2007-06-15 05:28:57.995 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x3333510 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-15 05:28:57.995 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x1870d420 of class NSCFString autoreleased with no pool in place - just leaking
2007-06-15 05:28:57.995 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x1870d4b0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-15 05:28:57.995 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x1870d5c0 of class NSPathStore2 autoreleased with no pool in place - just leaking
2007-06-15 05:28:57.995 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x33335b0 of class NSConcreteData autoreleased with no pool in place - just leaking
2007-06-15 05:28:57.995 sdlmame_0115u4_sven[17744] *** _NSAutoreleaseNoPool(): Object 0x1870a2f0 of class NSCFArray autoreleased with no pool in place - just leaking
OpenGL: ATI Technologies Inc.
OpenGL: ATI Radeon X1600 OpenGL Engine
OpenGL: 2.0 ATI-1.4.52
OpenGL: texture rectangle supported
OpenGL: non-power-of-2 textures supported (new method)
OpenGL: vertex buffer supported
OpenGL: pixel buffers supported
OpenGL: GLSL supported
OpenGL: max texture size 4096 x 4096
OpenGL: VBO supported
OpenGL: PBO supported
OpenGL: GLSL using shader filter 1 (vid filter: 0)
OpenGL: GLSL direct brightness, contrast setting for RGB games
vr-tgp.bin ROM NEEDS REDUMP
WARNING: the game might not run correctly.
GL texture: copy 1 - shader 0 - dynamic 1 -  992x768 992x768 [format: RGB15_PALETTE, Equal: 1, Palette: 1, scale 2x2, borderpix 0, pitch 528,992/4096], colors: 8194
Killed


Other than that, it now seems to compile and run under OS X on Intel using gcc 4.1.2.

Let me know if you have a possible solution for the Virtua Racing problem that you'd like me to try.
Posted By: sgothel Re: VBO or PBO crash - 06/16/07 02:36 AM
Twitty:
Your log says: 'GL texture: copy 1 - shader 0 - dynamic 1'

This means - no shader :-(
© Forums