Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
22 user(s) are online (14 user(s) are browsing Forums)

Members: 0
Guests: 22

more...
Support us!
Recent OS4 Files
OS4Depot.net
Report message:*
 

Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress

Subject: Re: GL4ES: another OpenGL over OpenGLES2 emulation - some tech. info and porting progress
by kas1e on 2019/9/18 18:08:44

@all
Hate to bring another bug-report again, but probably still worth to discuss to understand from where issues come.

So, to make it short, there something wrong with BGRA Texture hardware extension. There is 2 issues: one cosmetic one, and another one is hardcore crash when those BGRA Textures used with/in FBO.

First one, just pure cosmetic one, and didn't cause any issues except visuall differences: colors are swapped. Where they should be blue, they are red. Where they should be red, they are blue.

For example, there is one of irrlicht examples (13.rendertotexture) and how it looks like on our side now (@all: don't fear of number "6" in the title about fps, its just not whole string fit in my theme, its 600 fps) :

(press open in new tab for fullsize):

Resized Image

And that, how it looks like once i set via gl4es environments to ignore BGRA Texture hardware extension:

(press open in new tab for fullsize):

Resized Image

On win32 and on pandora colors are blue too, i.e. that the correct look, and red one are wrong.

The same issue happens in supertuxkart in the car choice screen, where cars should be red, they blue, where should be blue, they red. And the same once i disable usage of BGRA in texture, it start to show correct colors.

At first i of course think its gl4es and something about endian formats to be done inside, but then, ptitSeb says that no, there isn't much Irrlicht engine and gl4es do here. Texture with GL_BGRA format are supported on AmigaOS, as there are other games that support it, so it's an issue with this format. It's very well may be that on our side reading are fine, but writing to texture are not.

Second issue, is that i have very hardcore ISI crash, when i do choice a car in the car-selection-screen , and before it all crashes i have that warning:

[error] Irrlicht: FBO has one or serveral incomplete image attachements
[error] Irrlicht: FBO error
[error] main: Exception caught : std::bad_alloc
[error] main: Aborting SuperTuxKart

One time i even got:

[error] Irrlicht: FBO has one or serveral incomplete image attachements
[error] Irrlicht: FBO error
[error] Irrlicht: Fatal Error: Tried to set a texture not owned by this driver

We at first thinking that it can be related to that issue with swapped colors , but when i set to ignore that BGRA texture extensions, then colors are start to be fine, but crash still there. So issues probabaly not related, but in the same area about texture's and BGRA format. Or maybe related, hard to say now.

Now crash looks like this:

Crash log for task "supertuxkart"
Generated by GrimReaper 53.19
Crash occured in module  at address 0x590F9168
Type of crash
ISI (Instruction Storage Interruptexception
Alert number
0x80000003

Register dump
:
GPR (General Purpose Registers):
   
07EF95EB4 63DB1470 00000002 590F9170 590F9170 63DB1590 63DB1568 00000000 
   8
00000000 590F9168 00000000 7F296AFC 33955353 63DC606C 63DC0000 634B0000 
  16
63DC0000 634B2B58 FF007F00 634B2B70 FF7F7F00 634B2B88 FF00007F 634B2B9C 
  24
63DC0000 00000001 63DB1590 590F9170 63DB1568 00000000 00000000 63D4C550 


FPR 
(Floating Point RegistersNaN Not a Number):
   
0:              nan                1                1                1 
   4
:                1              nan              nan              nan 
   8
:              888                1                0       4.5036e+15 
  12
:       4.5036e+15                0     9.36758e-110     -3.22894e+49 
  16
:     -8.5225e-173     2.08306e-235    -5.90513e-258     -2.28164e-24 
  20
:      6.53871e-38    -1.11483e-105     1.67461e-200     3.42169e-265 
  24
:    -1.82693e-178     -5.17867e-09     1.04918e-114     2.20234e-226 
  28
:    -2.12876e-252    -3.49188e-264     2.92964e-255            0.028 

FPSCR 
(Floating Point Status and Control Register): 0xAE104100


SPRs 
(Special Purpose Registers):
           
Machine State (msr) : 0x0002F030
                Condition 
(cr) : 0x00000000
      Instruction Pointer 
(ip) : 0x590F9168
       Xtended Exception 
(xer) : 0x5D311F10
                   Count 
(ctr) : 0x00000000
                     Link 
(lr) : 0x587CEEA0
            DSI Status 
(dsisr) : 0x587CEDB0
            Data Address 
(dar) : 0x59953999



680x0 emulated registers
:
DATA83580D00 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
ADDR
6FFA4000 8280F300 00000000 00000000 00000000 00000000 00000000 63DB1070 
FPU0
:                0                0                0                0 
FPU4
:                0                0                0                0 



Symbol info
:
Instruction pointer 0x590F9168 belongs to module "" (HUNK/Kickstart)

Stack trace:
    
0x590F9168 symbol not available
    
[/amiga/SuperTuxKart-0.8.1/lib/irrlicht/source/Irrlicht/COpenGLDriver.cpp:2184supertuxkart:_ZN3irr5video13COpenGLDriver11draw2DImageEPKNS0_8ITextureERKNS_4core4rectIiEES9_PS8_PKNS0_6SColorEb()+0x78 (section 1 0x3CFB70)
    [/
amiga/SuperTuxKart-0.8.1/src/guiengine/skin.cpp:1849supertuxkart:_ZN9GUIEngine4Skin13process3DPaneEPN3irr3gui11IGUIElementERKNS1_4core4rectIiEEb()+0x4ac (section 1 0xD0B74)
    [/
amiga/SuperTuxKart-0.8.1/src/guiengine/skin.cpp:2015supertuxkart:_ZN9GUIEngine4Skin24draw3DButtonPaneStandardEPN3irr3gui11IGUIElementERKNS1_4core4rectIiEEPS8_()+0x84 (section 1 0xD183C)
    [/
amiga/SuperTuxKart-0.8.1/lib/irrlicht/source/Irrlicht/CGUIButton.cpp:244supertuxkart:_ZN3irr3gui10CGUIButton4drawEv()+0x68c (section 1 0x60BEE0)
    [/
amiga/SuperTuxKart-0.8.1/lib/irrlicht/source/Irrlicht/CGUIEnvironment.cpp:318supertuxkart:_ZN3irr3gui15CGUIEnvironment7drawAllEv()+0x1a4 (section 1 0x48DCDC)
    [/
amiga/SuperTuxKart-0.8.1/src/guiengine/engine.cpp:1164supertuxkart:_ZN9GUIEngine6renderEf()+0x43c (section 1 0xA937C)
    [/
amiga/SuperTuxKart-0.8.1/src/graphics/irr_driver.cpp:1731supertuxkart:_ZN9IrrDriver6updateEf()+0x858 (section 1 0x6F9DC)
    [/
amiga/SuperTuxKart-0.8.1/src/main_loop.cpp:164supertuxkart:_ZN8MainLoop3runEv()+0x2b4 (section 1 0x1967D0)
    [/
amiga/SuperTuxKart-0.8.1/src/main.cpp:1536supertuxkart:main()+0x8bc (section 1 0x19534C)
    
native kernel module newlib.library.kmod+0x0000257c
    native kernel module newlib
.library.kmod+0x00003294
    native kernel module newlib
.library.kmod+0x000037c8
    supertuxkart
:_start()+0x170 (section 1 0x1920)
    
native kernel module dos.library.kmod+0x0002a5d8
    native kernel module kernel
+0x0006b590
    native kernel module kernel
+0x0006b5d8

PPC disassembly
:
 
590f916000000025   .word             0x00000025
 590f9164
00000000   .word             0x00000000
*590f916800000038   .word             0x00000038
 590f916c
00000099   .word             0x00000099
 590f9170
67783088   oris              r24,r27,12424


As it some ISI crash, disassmbling not possible, that why it point on some random memory in disassembly.

The line in which we crash (Irrlicht/COpenGLDriver.cpp:2184), are from OpenGLDriver::draw2DImage() and looks like this:

const core::dimension2d<u32>& ss = texture->getOriginalSize();

But that didn't help much, as all looks correct (and it works as usuall on Pandora & Linux with gl4es).

Then, we enabled debug in gl4es's src/framebuffer.c to see what is happening in FBO creation & use, and that what we have when we crash:

glGenerateMipmap(GL_TEXTURE_2D)
glGenerateMipmap(GL_TEXTURE_2D)
glGenFramebuffers(10x58e7e738)
glBindFramebuffer(GL_FRAMEBUFFER256), list=noneglstate->fbo.current_fb=(draw=0read=0)
glFramebufferTexture2D(GL_FRAMEBUFFERGL_COLOR_ATTACHMENT0GL_TEXTURE_2D5680glstate->fbo.current_fb=256 (draw=256read=256)
found textureglname=568size=512x512(512x512), format/type=GL_BGRA/GL_UNSIGNED_BYTE
Attach Texture 568 to FBO 256 
as Attachement GL_COLOR_ATTACHMENT0
glBindFramebuffer
(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=256 (draw=256read=256)
glGenRenderbuffers(10x58e4fb04)
glBindRenderbuffer(GL_RENDERBUFFER256), binded Fbo=0
glRenderbufferStorage
(GL_RENDERBUFFER0x81A5512512)
glBindFramebuffer(GL_FRAMEBUFFER256), list=noneglstate->fbo.current_fb=(draw=0read=0)
glFramebufferRenderbuffer(GL_FRAMEBUFFERGL_DEPTH_ATTACHMENTGL_RENDERBUFFER256)
glCheckFramebufferStatus(0x8D40)=0x8CD5
glBindFramebuffer
(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=256 (draw=256read=256)
glBindFramebuffer(GL_FRAMEBUFFER256), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=256 (draw=256read=256)
glDeleteRenderbuffer(10x58e4fb04)
glDeleteFramebuffers(10x58e7e738), framebuffers[0]=256
glGenFramebuffers
(10x58e7e738)
glBindFramebuffer(GL_FRAMEBUFFER257), list=noneglstate->fbo.current_fb=(draw=0read=0)
glFramebufferTexture2D(GL_FRAMEBUFFERGL_COLOR_ATTACHMENT0GL_TEXTURE_2D5690glstate->fbo.current_fb=257 (draw=257read=257)
found textureglname=569size=512x512(512x512), format/type=GL_BGRA/GL_UNSIGNED_BYTE
Attach Texture 569 to FBO 257 
as Attachement GL_COLOR_ATTACHMENT0
glBindFramebuffer
(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=257 (draw=257read=257)
glGenRenderbuffers(10x58e4f4cc)
glBindRenderbuffer(GL_RENDERBUFFER257), binded Fbo=0
glRenderbufferStorage
(GL_RENDERBUFFER0x81A5512512)
glBindFramebuffer(GL_FRAMEBUFFER257), list=noneglstate->fbo.current_fb=(draw=0read=0)
glFramebufferRenderbuffer(GL_FRAMEBUFFERGL_DEPTH_ATTACHMENTGL_RENDERBUFFER257)
glCheckFramebufferStatus(0x8D40)=0x8CD5
glBindFramebuffer
(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=257 (draw=257read=257)
glBindFramebuffer(GL_FRAMEBUFFER257), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=257 (draw=257read=257)
glDeleteRenderbuffer(10x58e4f4cc)
glDeleteFramebuffers(10x58e7e738), framebuffers[0]=257
glGenFramebuffers
(10x58e7e738)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glFramebufferTexture2D(GL_FRAMEBUFFERGL_COLOR_ATTACHMENT0GL_TEXTURE_2D5700glstate->fbo.current_fb=258 (draw=258read=258)
found textureglname=570size=512x512(512x512), format/type=GL_BGRA/GL_UNSIGNED_BYTE
Attach Texture 570 to FBO 258 
as Attachement GL_COLOR_ATTACHMENT0
glBindFramebuffer
(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=258 (draw=258read=258)
glGenRenderbuffers(10x58e4f4cc)
glBindRenderbuffer(GL_RENDERBUFFER258), binded Fbo=0
glRenderbufferStorage
(GL_RENDERBUFFER0x81A5512512)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glFramebufferRenderbuffer(GL_FRAMEBUFFERGL_DEPTH_ATTACHMENTGL_RENDERBUFFER258)
glCheckFramebufferStatus(0x8D40)=0x8CD6
[error  IrrlichtFBO has one or several incomplete image attachments
[error  IrrlichtFBO error
glDeleteRenderbuffer
(10x58e4f4cc)
glDeleteFramebuffers(10x58e7e738), framebuffers[0]=258


And there is log, when i 1 of 5 times by some luck didn't crash:

glGenerateMipmap(GL_TEXTURE_2D)
glGenerateMipmap(GL_TEXTURE_2D)
glGenFramebuffers(10x592932a0)
glBindFramebuffer(GL_FRAMEBUFFER256), list=noneglstate->fbo.current_fb=(draw=0read=0)
glFramebufferTexture2D(GL_FRAMEBUFFERGL_COLOR_ATTACHMENT0GL_TEXTURE_2D5680glstate->fbo.current_fb=256 (draw=256read=256)
found textureglname=568size=512x512(512x512), format/type=GL_BGRA/GL_UNSIGNED_BYTE
Attach Texture 568 to FBO 256 
as Attachement GL_COLOR_ATTACHMENT0
glBindFramebuffer
(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=256 (draw=256read=256)
glGenRenderbuffers(10x592934a4)
glBindRenderbuffer(GL_RENDERBUFFER256), binded Fbo=0
glRenderbufferStorage
(GL_RENDERBUFFER0x81A5512512)
glBindFramebuffer(GL_FRAMEBUFFER256), list=noneglstate->fbo.current_fb=(draw=0read=0)
glFramebufferRenderbuffer(GL_FRAMEBUFFERGL_DEPTH_ATTACHMENTGL_RENDERBUFFER256)
glCheckFramebufferStatus(0x8D40)=0x8CD5
glBindFramebuffer
(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=256 (draw=256read=256)
glBindFramebuffer(GL_FRAMEBUFFER256), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=256 (draw=256read=256)
glDeleteRenderbuffer(10x592934a4)
glDeleteFramebuffers(10x592932a0), framebuffers[0]=256
glGenFramebuffers
(10x59292e60)
glBindFramebuffer(GL_FRAMEBUFFER257), list=noneglstate->fbo.current_fb=(draw=0read=0)
glFramebufferTexture2D(GL_FRAMEBUFFERGL_COLOR_ATTACHMENT0GL_TEXTURE_2D5690glstate->fbo.current_fb=257 (draw=257read=257)
found textureglname=569size=512x512(512x512), format/type=GL_BGRA/GL_UNSIGNED_BYTE
Attach Texture 569 to FBO 257 
as Attachement GL_COLOR_ATTACHMENT0
glBindFramebuffer
(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=257 (draw=257read=257)
glGenRenderbuffers(10x594284f4)
glBindRenderbuffer(GL_RENDERBUFFER257), binded Fbo=0
glRenderbufferStorage
(GL_RENDERBUFFER0x81A5512512)
glBindFramebuffer(GL_FRAMEBUFFER257), list=noneglstate->fbo.current_fb=(draw=0read=0)
glFramebufferRenderbuffer(GL_FRAMEBUFFERGL_DEPTH_ATTACHMENTGL_RENDERBUFFER257)
glCheckFramebufferStatus(0x8D40)=0x8CD5
glBindFramebuffer
(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=257 (draw=257read=257)
glBindFramebuffer(GL_FRAMEBUFFER257), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=257 (draw=257read=257)
glDeleteRenderbuffer(10x594284f4)
glDeleteFramebuffers(10x59292e60), framebuffers[0]=257
glGenFramebuffers
(10x59292e60)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glFramebufferTexture2D(GL_FRAMEBUFFERGL_COLOR_ATTACHMENT0GL_TEXTURE_2D5700glstate->fbo.current_fb=258 (draw=258read=258)
found textureglname=570size=512x512(512x512), format/type=GL_BGRA/GL_UNSIGNED_BYTE
Attach Texture 570 to FBO 258 
as Attachement GL_COLOR_ATTACHMENT0
glBindFramebuffer
(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=258 (draw=258read=258)
glGenRenderbuffers(10x5977652c)
glBindRenderbuffer(GL_RENDERBUFFER258), binded Fbo=0
glRenderbufferStorage
(GL_RENDERBUFFER0x81A5512512)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glFramebufferRenderbuffer(GL_FRAMEBUFFERGL_DEPTH_ATTACHMENTGL_RENDERBUFFER258)
glCheckFramebufferStatus(0x8D40)=0x8CD5
glBindFramebuffer
(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=258 (draw=258read=258)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=258 (draw=258read=258)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=258 (draw=258read=258)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=258 (draw=258read=258)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=258 (draw=258read=258)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=258 (draw=258read=258)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=258 (draw=258read=258)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=258 (draw=258read=258)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=258 (draw=258read=258)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=258 (draw=258read=258)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=258 (draw=258read=258)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=258 (draw=258read=258)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=258 (draw=258read=258)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=258 (draw=258read=258)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=258 (draw=258read=258)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=258 (draw=258read=258)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0)
glBindFramebuffer(GL_FRAMEBUFFER0), list=noneglstate->fbo.current_fb=258 (draw=258read=258)
glBindFramebuffer(GL_FRAMEBUFFER258), list=noneglstate->fbo.current_fb=(draw=0read=0
...



Having a look at logs, ptitSeb says that all looks fine: the log trace from the "crash" version looks clean. There is 3 FBO created, exactly in the same way, but the 3rd one didn't worked, for some reason I can't explain. And there isn't any more usefull log you can get from gl4es. In the current logs, the issue is when glCheckFramebufferStatus(...) is not 0x8CD5... (this one means FBO Complete).

So, he guess that on our side we need to check, if we seees an issue in bindding a GL_BRGA texture to an FBO.

And that we (me probabaly:) ) need to remind what bidding a texture to an FBO mean: that means that all the renedring that will be done don't go to the screen, but to the binded FBO, so the drawing will be done directly in the texture => so maybe GL_BGRA are fine when you read it, but maybe are wrongly handling for "writting" in an FBO.

And the last thing i do, is to create a glSnoop trace of whole game since start, till it crashes. Maybe that also will give as a clue of what wrong with FBO and that texture binding with:

http://kas1e.mikendezign.com/aos4/gl4es/BGRA/stk_crash_trace.zip

Packed 700kb, unpacked 26mb

Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project