New Open GL API Released
- Indiket
- DC Developer
- Posts: 99
- https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
- Joined: Sun Sep 05, 2010 5:44 am
- Has thanked: 0
- Been thanked: 0
Re: New Open GL API Released
Hey there Ph3nom
Thanks for your fixes, but still no cigar!!
The cpp example compiles fine (just a single cpp file).
My problem is with multiple definitions, not the undefined ones. It seems that C++ links in a different way that C, and of course, problem only arises when there are more than one .cpp file using the <GL/gl.h> lib.
It's strange, because gl.h is already defined to be using the externals C class (the sys/cdefs), but even more curious, it's only with the glVertex definitions!
Thanks for your fixes, but still no cigar!!
The cpp example compiles fine (just a single cpp file).
My problem is with multiple definitions, not the undefined ones. It seems that C++ links in a different way that C, and of course, problem only arises when there are more than one .cpp file using the <GL/gl.h> lib.
It's strange, because gl.h is already defined to be using the externals C class (the sys/cdefs), but even more curious, it's only with the glVertex definitions!
- BlueCrab
- The Crabby Overlord
- Posts: 5677
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: New Open GL API Released
I definitely cannot reproduce that particular problem on my end. That example compiles just fine.Jae686 wrote:You are right, I just did the same thing and it compiled fine.Indiket wrote:Jae686, I've just re-built the toolchain with GCC 4.7.3 and now compiles fines, so yeah, a nasty GCC bug.
I'm still having the second issue with C++ programs, anyone has a clue about it?
About C++, I have no idea.
The specular example did not compile due to the .c calling "Font.h" and the file being "font.h".
Now only some modem related examples wont compile with :Code: Select all
make[2]: Entering directory `/home/jaerder/development/Tools/dreamcast/kallistios/examples/dreamcast/modem/basic' rm -f example1.elf romdisk.* kos-cc -c example1.c -o example1.o kos-cc -o example1.elf example1.o /home/jaerder/development/Tools/dreamcast/kallistios/lib/dreamcast/libkallisti.a(modem.o): In function `modemCreateCInfoFromPS': /home/jaerder/development/Tools/dreamcast/kallistios/kernel/arch/dreamcast/hardware/modem/modem.c:123: undefined reference to `_speedCodeToBPS' /home/jaerder/development/Tools/dreamcast/kallistios/lib/dreamcast/libkallisti.a(modem.o): In function `modemCreateCInfoFromCC': /home/jaerder/development/Tools/dreamcast/kallistios/kernel/arch/dreamcast/hardware/modem/modem.c:190: undefined reference to `_speedCodeToBPS' /home/jaerder/development/Tools/dreamcast/kallistios/lib/dreamcast/libkallisti.a(modem.o): In function `modemSelfTest': /home/jaerder/development/Tools/dreamcast/kallistios/kernel/arch/dreamcast/hardware/modem/modem.c:422: undefined reference to `_verifyControllerData' /home/jaerder/development/Tools/dreamcast/kallistios/kernel/arch/dreamcast/hardware/modem/modem.c:422: undefined reference to `_verifyDSPData' collect2: error: ld returned 1 exit status make[2]: *** [example1.elf] Error 1 make[2]: Leaving directory `/home/jaerder/development/Tools/dreamcast/kallistios/examples/dreamcast/modem/basic' make[1]: *** [all] Error 2 make[1]: Leaving directory `/home/jaerder/development/Tools/dreamcast/kallistios/examples/dreamcast/modem' /bin/sh: 1: exit: Illegal number: -1 make: *** [all] Error 2
All the symbols it is complaining about being undefined are defined in the same file (and should be inlined). Perhaps your compiler is doing something wonky with inlining? Dunno, to be honest.
- BlueCrab
- The Crabby Overlord
- Posts: 5677
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: New Open GL API Released
I can explain that pretty easily...Indiket wrote:Hey there Ph3nom
Thanks for your fixes, but still no cigar!!
The cpp example compiles fine (just a single cpp file).
My problem is with multiple definitions, not the undefined ones. It seems that C++ links in a different way that C, and of course, problem only arises when there are more than one .cpp file using the <GL/gl.h> lib.
It's strange, because gl.h is already defined to be using the externals C class (the sys/cdefs), but even more curious, it's only with the glVertex definitions!
The glVertex* functions were defined as function pointers in libgl. The way they were declared in the .h file works differently between C and C++ (at least with GCC). Basically, they needed to be declared as extern in the .h file and actually defined somewhere in a .c file that gets compiled to make sure everything works regardless of whether C or C++ was being used. I've gone ahead and fixed that in the Git repo, although I can't test to make sure everything actually works with that change (beyond that it compiles and that a C++ program can link it successfully).
- PH3NOM
- DC Developer
- Posts: 576
- Joined: Fri Jun 18, 2010 9:29 pm
- Has thanked: 0
- Been thanked: 5 times
Re: New Open GL API Released
Hey Indiket. I just had a quick look at the project you sent me.Indiket wrote:Hey there Ph3nom
Thanks for your fixes, but still no cigar!!
The cpp example compiles fine (just a single cpp file).
My problem is with multiple definitions, not the undefined ones. It seems that C++ links in a different way that C, and of course, problem only arises when there are more than one .cpp file using the <GL/gl.h> lib.
Unfortunately I cannot compile because it is using a non-official fork of SDL that does not come with KOS, I get a "fatal error: SDL/SDL_dreamcast.h: No such file..."
Looking at the makefile, the project is linking to -lSDL_gl_1213. Where is that lib?
Furthermore, the makefile is linking to "-lkglx", note that the new lib is simply "-lgl".
If you are linking to "-lkglx", I can understand the multiple definition errors arising from the fact that my API defines glVertex3f as a function pointer, where in kglx glVertex3f is a standard function call, as BlueCrab pointed out.
Re: New Open GL API Released
Oh yes, you're right. That is the Chui's SDL library we're using in our projects (the one that has a different dc_video.c file). My idea is to update the game from kglx to gl, but do not worry: with latest BlueCrab commit now it will compile OK.PH3NOM wrote:
Hey Indiket. I just had a quick look at the project you sent me.
Unfortunately I cannot compile because it is using a non-official fork of SDL that does not come with KOS, I get a "fatal error: SDL/SDL_dreamcast.h: No such file..."
Looking at the makefile, the project is linking to -lSDL_gl_1213. Where is that lib?
Furthermore, the makefile is linking to "-lkglx", note that the new lib is simply "-lgl".
If you are linking to "-lkglx", I can understand the multiple definition errors arising from the fact that my API defines glVertex3f as a function pointer, where in kglx glVertex3f is a standard function call, as BlueCrab pointed out.
For testing, you can just link to -lSDL and comment SDL/SDL_dreamcast.h and the SDL_DC_mapkey functions. We just need to update the SDL video routines to support the new OpenGL lib
- SWAT
- Insane DCEmu
- Posts: 191
- Joined: Sat Jan 31, 2004 2:34 pm
- Location: Russia/Novosibirsk
- Has thanked: 1 time
- Been thanked: 0
- Contact:
Re: New Open GL API Released
Have problem with GCC 4.9.1.
It is very sad, because with this compiler your library would work even faster.
Sorry for the Russian language.
It is very sad, because with this compiler your library would work even faster.
Code: Select all
gl-matrix.c: В функции «glhLookAtf2»:
gl-matrix.c:342:1: ошибка: не найден регистр класса «FP0_REGS» для выталкивания в память
}
^
gl-matrix.c:342:1: ошибка: это insn:
(insn 47 46 48 2 (parallel [
(set (reg/v:SF 64 fr0 [ __x ])
(fma:SF (reg:SF 65 fr1 [orig:185 D.3395 ] [185])
(reg:SF 69 fr5 [orig:171 forward$1 ] [171])
(reg:SF 67 fr3 [orig:228 D.3395 ] [228])))
(use (reg/v:PSI 151 ))
]) gl-matrix.c:294 446 {fmasf4_i}
(expr_list:REG_DEAD (reg:SF 67 fr3 [orig:228 D.3395 ] [228])
(nil)))
gl-matrix.c:342: невозможно восстановление после предыдущих ошибок
make[1]: *** [gl-matrix.o] Ошибка 1
make[1]: Выход из каталога `/usr/local/dc/kos/kos-ports/libgl'
Re: New Open GL API Released
It's the same issue I had with GCC 4.8.2 , yeah maybe can be fixed or do a workarround, dunno!
- PH3NOM
- DC Developer
- Posts: 576
- Joined: Fri Jun 18, 2010 9:29 pm
- Has thanked: 0
- Been thanked: 5 times
Re: New Open GL API Released
Hi SWAT.SWAT wrote:Have problem with GCC 4.9.1.
It is very sad, because with this compiler your library would work even faster.
Sorry for the Russian language.Code: Select all
gl-matrix.c: В функции «glhLookAtf2»: gl-matrix.c:342:1: ошибка: не найден регистр класса «FP0_REGS» для выталкивания в память } ^ gl-matrix.c:342:1: ошибка: это insn: (insn 47 46 48 2 (parallel [ (set (reg/v:SF 64 fr0 [ __x ]) (fma:SF (reg:SF 65 fr1 [orig:185 D.3395 ] [185]) (reg:SF 69 fr5 [orig:171 forward$1 ] [171]) (reg:SF 67 fr3 [orig:228 D.3395 ] [228]))) (use (reg/v:PSI 151 )) ]) gl-matrix.c:294 446 {fmasf4_i} (expr_list:REG_DEAD (reg:SF 67 fr3 [orig:228 D.3395 ] [228]) (nil))) gl-matrix.c:342: невозможно восстановление после предыдущих ошибок make[1]: *** [gl-matrix.o] Ошибка 1 make[1]: Выход из каталога `/usr/local/dc/kos/kos-ports/libgl'
Thanks for having a look.
All I could ask is that you comment out the function body of glhLookAtf2 on gl-matrix.c then try to compile.
If that compiles, can you try to un-comment blocks of code to see if you can narrow it down to a specific function call that seems to freak out GCC 4.9.1.
- BlueCrab
- The Crabby Overlord
- Posts: 5677
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: New Open GL API Released
Internal compiler errors like that one should be reported to the GCC developers at https://gcc.gnu.org/bugzilla/ , as they are GCC bugs in general. Make sure to include relevant information if you go to file a bug report, including the error message you've included there, the target your compiler is targeting (probably sh-elf, unless you've done some sort of extra patching to your compiler), and the source code file that is causing the problem (preferably as spit out after preprocessing).
- SWAT
- Insane DCEmu
- Posts: 191
- Joined: Sat Jan 31, 2004 2:34 pm
- Location: Russia/Novosibirsk
- Has thanked: 1 time
- Been thanked: 0
- Contact:
Re: New Open GL API Released
The problem in macro vec3f_normalizePH3NOM wrote: All I could ask is that you comment out the function body of glhLookAtf2 on gl-matrix.c then try to compile.
If that compiles, can you try to un-comment blocks of code to see if you can narrow it down to a specific function call that seems to freak out GCC 4.9.1.
Other code compiles fine.
- PH3NOM
- DC Developer
- Posts: 576
- Joined: Fri Jun 18, 2010 9:29 pm
- Has thanked: 0
- Been thanked: 5 times
Re: New Open GL API Released
That is strange indeed
I utilized that macro on dreamcast/math/matrix3d.c, so the fact that KOS compiles fine for you, tells me there is no problem with the macro.
If I had to guess, the compiler optimizations are likely the source of the problem.
Can you try to test compiling libgl/gl-matrix.c using -O0 on the makefile?
I am curious if the code will compile as-is by disabling compiler optimizations...
I utilized that macro on dreamcast/math/matrix3d.c, so the fact that KOS compiles fine for you, tells me there is no problem with the macro.
If I had to guess, the compiler optimizations are likely the source of the problem.
Can you try to test compiling libgl/gl-matrix.c using -O0 on the makefile?
I am curious if the code will compile as-is by disabling compiler optimizations...
Re: New Open GL API Released
Just a mini-bump
Tested BlueCrab last commit, works OK now, thanks!!
About GL support for SDL, I changed a few lines to get it compiled again, but still does not work yet. I think it should be quick to fix it btw
Tested BlueCrab last commit, works OK now, thanks!!
About GL support for SDL, I changed a few lines to get it compiled again, but still does not work yet. I think it should be quick to fix it btw
-
- DCEmu Banned
- Posts: 1876
- Joined: Mon Mar 22, 2004 4:55 pm
- Location: #%^&*!!!11one Super Sonic
- Has thanked: 82 times
- Been thanked: 64 times
- Contact:
Re: New Open GL API Released
Hey dudes, I'm really sorry for not being particularly active in the community lately, but we've been super swamped... I was following this project since the beginning, and I have always been impressed with it. I feel like while ESTk will bring lots of modders and RPG-ers, this has the potential to really hit lots of mobile and GL developers and convince them to start targeting the Dreamcast.
Keep kicking ass, guys, because it looks awesome. I will start telling people when they go "ZOMG HOW U GET ON DRMCSAT" that the scene is working on OpenGL support, so they can migrate their projects over fairly easily.
edit: Dude, you should come shoot the shit with us in the #dreamcastdev IRC channel. I was hoping to look at some of your code and share some of ours with you, because we're both working at the metal trying to push polys here.
Keep kicking ass, guys, because it looks awesome. I will start telling people when they go "ZOMG HOW U GET ON DRMCSAT" that the scene is working on OpenGL support, so they can migrate their projects over fairly easily.
edit: Dude, you should come shoot the shit with us in the #dreamcastdev IRC channel. I was hoping to look at some of your code and share some of ours with you, because we're both working at the metal trying to push polys here.
- SWAT
- Insane DCEmu
- Posts: 191
- Joined: Sat Jan 31, 2004 2:34 pm
- Location: Russia/Novosibirsk
- Has thanked: 1 time
- Been thanked: 0
- Contact:
Re: New Open GL API Released
Compiles fine with "-O2" instead of "-O3".PH3NOM wrote:That is strange indeed
I utilized that macro on dreamcast/math/matrix3d.c, so the fact that KOS compiles fine for you, tells me there is no problem with the macro.
If I had to guess, the compiler optimizations are likely the source of the problem.
Can you try to test compiling libgl/gl-matrix.c using -O0 on the makefile?
I am curious if the code will compile as-is by disabling compiler optimizations...
I compile all files with -O3 and only gl-matrix with -O2
- BlueCrab
- The Crabby Overlord
- Posts: 5677
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: New Open GL API Released
It'd probably be a good idea, in general, to compile the GL library with the normal set of KOS CFLAGS anyway.
That said, that error should still be pointed out to the GCC developers, as it appears to be a GCC optimizer bug.
That said, that error should still be pointed out to the GCC developers, as it appears to be a GCC optimizer bug.
- mankrip
- DCEmu Ex-Mod
- Posts: 3712
- Joined: Sun Nov 04, 2001 5:12 pm
- Has thanked: 0
- Been thanked: 0
- Contact:
Re: New Open GL API Released
GCC's optimizations were always buggy for me. They rounded down some floats, as if the floats had been converted into integers.
Too bad I can't remember exactly which problem this caused in Quake.
Too bad I can't remember exactly which problem this caused in Quake.
- BlueCrab
- The Crabby Overlord
- Posts: 5677
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: New Open GL API Released
The optimizer does seem to do some REALLY weird things for SuperH. That's why the default CFLAGS for KOS have tended to have flags to turn off certain optimizations, at least ever since -O2 was the recommended optimization level in KOS' environ script.
I'm not sure how I missed that the optimization flags were being overridden, but they probably should be toned down to the default set.
That said, this somewhat reinforces why KOS recommends (and only includes patches for) 4.7.x and some earlier versions at this point.
I'm not sure how I missed that the optimization flags were being overridden, but they probably should be toned down to the default set.
That said, this somewhat reinforces why KOS recommends (and only includes patches for) 4.7.x and some earlier versions at this point.
- PH3NOM
- DC Developer
- Posts: 576
- Joined: Fri Jun 18, 2010 9:29 pm
- Has thanked: 0
- Been thanked: 5 times
Re: New Open GL API Released
Glad to get things working for youSWAT wrote:Compiles fine with "-O2" instead of "-O3".
I compile all files with -O3 and only gl-matrix with -O2
Can you upload your compiled .lib? I am now curious to test the result of using the newer GCC on my API.
Yes, in the makefile I set the optimization to 03.BlueCrab wrote:The optimizer does seem to do some REALLY weird things for SuperH. That's why the default CFLAGS for KOS have tended to have flags to turn off certain optimizations, at least ever since -O2 was the recommended optimization level in KOS' environ script.
I'm not sure how I missed that the optimization flags were being overridden, but they probably should be toned down to the default set.
That said, this somewhat reinforces why KOS recommends (and only includes patches for) 4.7.x and some earlier versions at this point.
I cant remember benchmarking 02 vs 03, but I can say for sure that going from O0 to O3 brought some very nice increases in performance.
But now that I think of it, at one point I observed some strange behavior in my old z clipping algorithm when enabling all GCC optimizations.
Honestly, I think it would be best to actually figure out which specific optimizations to enable, as opposed to using the generic -Ox flags.
But for now, for stability reasons, I agree that it might be better to remove the 03 flags from the libgl makefile.
We can leave that as an "experimental" optional compile method.
Hey Gyro, Thanks for posting!GyroVorbis wrote:Hey dudes, I'm really sorry for not being particularly active in the community lately, but we've been super swamped... I was following this project since the beginning, and I have always been impressed with it. I feel like while ESTk will bring lots of modders and RPG-ers, this has the potential to really hit lots of mobile and GL developers and convince them to start targeting the Dreamcast.
Keep kicking ass, guys, because it looks awesome. I will start telling people when they go "ZOMG HOW U GET ON DRMCSAT" that the scene is working on OpenGL support, so they can migrate their projects over fairly easily.
edit: Dude, you should come shoot the shit with us in the #dreamcastdev IRC channel. I was hoping to look at some of your code and share some of ours with you, because we're both working at the metal trying to push polys here.
Funny thing, when I began working on the API, it was my dream to see it used in a commercial project.
In the back of my mind, I even thought of your project making that a reality
Congrats to you and your team for really making things happen!
Very inspiring to everyone in the DC homebrew community.
I would be happy to share any code / logic with you guys, but I do not use IRC atm, feel free to shoot me a PM here!
- SWAT
- Insane DCEmu
- Posts: 191
- Joined: Sat Jan 31, 2004 2:34 pm
- Location: Russia/Novosibirsk
- Has thanked: 1 time
- Been thanked: 0
- Contact:
Re: New Open GL API Released
No problem. In archive two versions (O2 and O3): But I think, for maximum result, you need KOS library compiled on GCC 4.9.1 too:PH3NOM wrote:Glad to get things working for youSWAT wrote:Compiles fine with "-O2" instead of "-O3".
I compile all files with -O3 and only gl-matrix with -O2
Can you upload your compiled .lib? I am now curious to test the result of using the newer GCC on my API.