Tuesday Oct 25, 2005

Getting there with quake3 on solaris

Its been a long while since I've added anything here. Been busy find a place to live :) Finding some spare time (when not looking for new house and furniture) let me play about with this:

kashyyyk:~/src/q3/quake3/code/unix$ uname -a
SunOS kashyyyk 5.11 snv_25 i86pc i386 i86pc
kashyyyk:~/src/q3/quake3/code/unix$ 
kashyyyk:~/src/q3/quake3/code/unix$ gmake
gmake  targets B=releasei386 CFLAGS="-pipe -DDEBUG -g"
gmake[1]: Entering directory `/export/home/sm97610/src/q3/quake3/code/unix'
gcc -pipe -DDEBUG -g -o releasei386/client/unix_main.o -c ../unix/unix_main.c 
gcc  -o releasei386/SunOSquake3 releasei386/client/cl_cgame.o releasei386/client/cl_cin.o releasei386/client/cl_console.o...
...
...
kashyyyk:~/src/q3/quake3/code/unix/releasei386$ ls -l
total 6150
drwxr-xr-x   9 sm97610  other        512 Oct 24 20:14 ./
drwxr-xr-x   6 sm97610  other       1024 Oct 24 23:39 ../
-rwxr-xr-x   1 sm97610  other    2981132 Oct 24 23:49 SunOSquake3*
drwxr-xr-x   6 sm97610  other        512 Oct 24 23:40 baseq3/
drwxr-xr-x   2 sm97610  other       3072 Oct 24 23:49 client/
-rw-r--r--   1 sm97610  other     135291 Oct 24 19:44 d2
drwxr-xr-x   2 sm97610  other        512 Oct 24 15:43 ded/
drwxr-xr-x   2 sm97610  other        512 Oct 24 15:43 ft2/
drwxr-xr-x   6 sm97610  other        512 Oct 24 15:43 missionpack/
drwxr-xr-x   2 sm97610  other        512 Oct 24 15:43 q3static/
drwxr-xr-x   2 sm97610  other        512 Oct 24 15:43 ref/
hashyyyk:~/src/q3/quake3/code/unix/releasei386$ isalist
pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86
kashyyyk:~/src/q3/quake3/code/unix/releasei386$ 

I need to figure out why it can't call the opengl functions. It does load the libGL.so.1 Mesa library, but can't use em.

kashyyyk:~/src/q3/quake3/code/unix/releasei386$ ./SunOSquake3
ioQ3 1.33 sun-i386 Oct 24 2005
----- FS_Startup -----
Current search path:
/export/home/sm97610/.q3a/baseq3
/export/home/sm97610/src/q3/quake3/code/unix/releasei386/baseq3
./baseq3

----------------------
0 files in pk3 files
execing default.cfg
couldn't exec q3config.cfg
couldn't exec autoexec.cfg
Hunk_Clear: reset the hunk ok
----- Client Initialization -----
----- Initializing Renderer ----
-------------------------------
----- Client Initialization Complete -----
----- R_Init -----

------- Input Initialization -------
------------------------------------
...loading libGL.so.1: Initializing OpenGL display
...setting mode 3: 640 480
Received signal 11, exiting...
----- CL_Shutdown -----
RE_Shutdown( 1 )
-----------------------
kashyyyk:~/src/q3/quake3/code/unix/releasei386$

Comments:

Sean, if you don't remember several years ago exactly the same problem was happening to Quake2. Have you tried the methodical approach - removing the code that sets up the exception handler and backtracking from there.
Or, are you too busy?

Posted by Pete on October 28, 2005 at 11:48 AM IST #

Yo Pete !

I do remember that old Quake2 code. In fact theres a lot of common code between quake2 and quake3. I used it a lot for reference in the porting.

My problem is coming down to the use of function pointers to the opengl calls. The pointers don't point to the correct addresses.

Eg on both quake2 and qukae3 they do this:

#define GPA( a ) dlsym( glw_state.OpenGLLib, a )

qglXChooseVisual             =  GPA("glXChooseVisual");

But its not doing this right with quake3. The addresses are wrong.

Quake2
LoadLibrary("./ref_glx.so")
ref_gl version: GL 0.01
Using libGL.so for OpenGL...
qglXChooseVisual = fe9a60b4
glXChooseVisual = fe9a60b4

Quake3
...loading libGL.so: 
qglXChooseVisual = fef860b4
glXChooseVisual = 806e71c
See what I mean ?

Posted by Sean on October 28, 2005 at 12:04 PM IST #

What does a pmap tell you? Were there any compilation warnings? Have you tried good old fashioned running it under dbx with a breakpoint set?

Posted by Pete on October 29, 2005 at 06:26 PM IST #

pmap:
1240:   ./SunOSquake3
 Address  Kbytes     RSS    Anon  Locked Mode   Mapped File
08035000      76      76      76       - rwx--    [ stack ]
08050000    1168     508       -       - r-x--  SunOSquake3
08183000      20      20      12       - rwx--  SunOSquake3
08188000    8240    1348    1348       - rwx--  SunOSquake3
08994000     432     432     432       - rwx--    [ heap ]
08A00000   75776   75776   75776       - rwx--    [ heap ]
FEC20000      24      20      20       - rwx--    [ anon ]
FEC30000       4       4       4       - rwx--    [ anon ]
FEC40000     760     692       -       - r-x--  libc.so.1
FED0E000      24      24      24       - rw---  libc.so.1
FED14000       8       8       8       - rw---  libc.so.1
FED20000      44      40       -       - r-x--  libsocket.so.1
FED3B000       4       4       4       - rw---  libsocket.so.1
FED40000     524     368       -       - r-x--  libnsl.so.1
FEDD3000      20      20      20       - rw---  libnsl.so.1
FEDD8000      32      12      12       - rw---  libnsl.so.1
FEDF0000       4       4       4       - rwx--    [ anon ]
FEE00000     280     104       -       - r-x--  libm.so.2
FEE55000      16      12       8       - rwx--  libm.so.2
FEE60000      76      72       -       - r-x--  libXext.so.0
FEE83000       4       4       4       - rw---  libXext.so.0
FEE90000     512     464       -       - r-x--  libX11.so.4
FEF10000      16      16      16       - rw---  libX11.so.4
FEF20000       4       4       4       - rwx--    [ anon ]
FEF30000     452     260       -       - r-x--  libGL.so.1
FEFB1000      28      28      28       - rw---  libGL.so.1
FEFB8000       4       -       -       - rw---  libGL.so.1
FEFC7000     140     140       -       - r-x--  ld.so.1
FEFFA000       4       4       4       - rwx--  ld.so.1
FEFFB000       8       8       8       - rwx--  ld.so.1
-------- ------- ------- ------- -------
total Kb   88704   80472   77812       -
Ok, libGL is in the <tt>FEF30000</tt> range, where as I thought it was ment to b in the 806... range.. Been pouring over the warnings, nothing obvious, the usual casting warnings mainly. Running under gdb (don't have the sun compilers on the box yet), tells me:
------- Input Initialization -------
------------------------------------
...loading libGL.so: qglXChooseVisual = fef860b4 89312f8
glXChooseVisual = 806e71c 806e71c

Breakpoint 1, GLW_SetMode (drivername=0x8996d50 "libGL.so", mode=0,
    fullscreen=qfalse) at ../unix/solaris_glimp.c:875
875       int attrib[] = {
(gdb) c
Continuing.
Initializing OpenGL display
...setting mode 0: 320 240

Program received signal SIGILL, Illegal instruction.
0x089312fb in qglXChooseVisual ()
(gdb) where
#0  0x089312fb in qglXChooseVisual ()
#1  0x0815afaf in GLW_SetMode (drivername=0x8996d50 "libGL.so", mode=0,
    fullscreen=qfalse) at ../unix/solaris_glimp.c:1096
#2  0x0815aa72 in GLW_StartDriverAndSetMode (drivername=0x8996d50 "libGL.so",
    mode=0, fullscreen=qfalse) at ../unix/solaris_glimp.c:854
#3  0x0815b748 in GLW_LoadOpenGL (name=0x8996d50 "libGL.so")
    at ../unix/solaris_glimp.c:1349
#4  0x0815b902 in GLimp_Init () at ../unix/solaris_glimp.c:1436
#5  0x0812be8d in InitOpenGL () at ../renderer/tr_init.c:212
#6  0x0812e258 in R_Init () at ../renderer/tr_init.c:1086
#7  0x08136065 in RE_BeginRegistration (glconfigOut=0x8881cd4)
    at ../renderer/tr_model.c:862
#8  0x08081574 in CL_InitRenderer () at ../client/cl_main.c:2120
#9  0x0808161e in CL_StartHunkUsers () at ../client/cl_main.c:2149
#10 0x0809c1d8 in Com_Init (commandLine=0x89944d8 "")
    at ../qcommon/common.c:2492
#11 0x0814cdec in main (argc=1, argv=0x80471b0) at ../unix/unix_main.c:1374
(gdb) 
Its <tt>qglXChooseVisual</tty> isn't pointing to the right place. I may email the icculus.org dudes...

Posted by Sean on October 31, 2005 at 10:46 AM GMT #

Post a Comment:
  • HTML Syntax: NOT allowed