glmax2D DeleteTex error

Started by meems, March 18, 2018, 14:11:52

Previous topic - Next topic

meems

ok i've dl loaded the latested version. Now I've got to go thru the manual steps to setup with glew etc and get it to do the 5 minute compile-unpack. Any plans to make it work out the box?

@col. Will do your fix, but curious to see if latest version fixes it 1st

col

Don't apply my fix as it wasn't correct. I've removed it from the forum.

Yes, I would update first as the garbage collector has been updated to the latest version in a recent update.
https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."

meems

ok i won't apply it.
I've got the latest ng, but I'm stuck with compiling print "hello world" now. It gets to 24% then gives up.

I know there's a secret method of 1st time compile that I used b4 but I've forgotten it, and it's not posted anywhere obvious on this forum or on github. The instructions should be clear and on the 1st post in the ng download sticky on this board. Otherwise, members will have to create a new thread everytime someone dl and tries to get ng working.

I can dig around this board cos I know the instructions are posted here somewhere.


col

I still get the error with v0.93.
I didn't need to do anything to get this version working. Unpacked... and built your example. It automatically rebuilt the modules as needed and ran.
https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."

Henri

It does work out of the box as you don't necessarily have to do rebuild modules (as I have been reminded), bmk compiles them on need basis by itself (although I prefer to precompile them).  Also the compile times should be faster on new version.

-Henri
- Got 01100011 problems, but the bit ain't 00000001

Henri

#20
@col

I didn't get any error and only thing I changed was this line (unless the error relates to bmp images ?):
Code (blitzmax) Select

blockart=LoadImage("C:\BlitzMaxNG\samples\breakout\media\back2.png") '"blocks2\blockart"+ch+".bmp")


Samples folder was taken from regular bmx installation, but any png will do.

-Henri
- Got 01100011 problems, but the bit ain't 00000001

meems

the new ng doesn't work out the box for me, I get a big splerg error at compile time
[100%] Linking:untitled1.debug.exe
C:/blitzmax_ng2/BlitzMax/tmp/.bmx/untitled1.bmx.gui.debug.win32.x86.o: In function `bb_main':
C:/blitzmax_ng2/BlitzMax/tmp/.bmx/untitled1.bmx.gui.debug.win32.x86.c:33: undefined reference to `__bb_brl_glgraphics_glgraphics'
C:/blitzmax_ng2/BlitzMax/tmp/.bmx/untitled1.bmx.gui.debug.win32.x86.c:48: undefined reference to `__bb_brl_timerdefault_timerdefault'
C:/blitzmax_ng2/BlitzMax/mod/brl.mod/glmax2d.mod/glmax2d.debug.win32.x86.a(glmax2d.bmx.debug.win32.x86.o): In function `brl_glmax2d_TGLMax2DDriver_Create':
C:/blitzmax_ng2/BlitzMax/mod/brl.mod/glmax2d.mod/.bmx/glmax2d.bmx.debug.win32.x86.c:92: undefined reference to `brl_glgraphics_source_GLGraphicsDriver'
C:/blitzmax_ng2/BlitzMax/mod/brl.mod/glmax2d.mod/glmax2d.debug.win32.x86.a(glmax2d.bmx.debug.win32.x86.o): In function `brl_glmax2d_TGLMax2DDriver_GraphicsModes':
C:/blitzmax_ng2/BlitzMax/mod/brl.mod/glmax2d.mod/.bmx/glmax2d.bmx.debug.win32.x86.c:132: undefined reference to `brl_glgraphics_source_GLGraphicsDriver'
C:/blitzmax_ng2/BlitzMax/mod/brl.mod/glmax2d.mod/glmax2d.debug.win32.x86.a(glmax2d.bmx.debug.win32.x86.o): In function `brl_glmax2d_TGLMax2DDriver_Flip_i':
C:/blitzmax_ng2/BlitzMax/mod/brl.mod/glmax2d.mod/.bmx/glmax2d.bmx.debug.win32.x86.c:478: undefined reference to `brl_glgraphics_source_GLGraphicsDriver'
C:/blitzmax_ng2/BlitzMax/mod/brl.mod/glmax2d.mod/glmax2d.debug.win32.x86.a(glmax2d.bmx.debug.win32.x86.o): In function `brl_glmax2d_TGLMax2DDriver_AttachGraphics_pbi':
C:/blitzmax_ng2/BlitzMax/mod/brl.mod/glmax2d.mod/.bmx/glmax2d.bmx.debug.win32.x86.c:172: undefined reference to `brl_glgraphics_source_GLGraphicsDriver'
C:/blitzmax_ng2/BlitzMax/mod/brl.mod/glmax2d.mod/glmax2d.debug.win32.x86.a(glmax2d.bmx.debug.win32.x86.o): In function `brl_glmax2d_TGLMax2DDriver_CreateGraphics_iiiii':
C:/blitzmax_ng2/BlitzMax/mod/brl.mod/glmax2d.mod/.bmx/glmax2d.bmx.debug.win32.x86.c:249: undefined reference to `brl_glgraphics_source_GLGraphicsDriver'
C:/blitzmax_ng2/BlitzMax/mod/brl.mod/glmax2d.mod/glmax2d.debug.win32.x86.a(glmax2d.bmx.debug.win32.x86.o): In function `brl_glmax2d_TGLMax2DDriver_SetGraphics_TTGraphics':
C:/blitzmax_ng2/BlitzMax/mod/brl.mod/glmax2d.mod/.bmx/glmax2d.bmx.debug.win32.x86.c:328: undefined reference to `brl_glgraphics_source_TGLGraphics'
C:/blitzmax_ng2/BlitzMax/mod/brl.mod/glmax2d.mod/.bmx/glmax2d.bmx.debug.win32.x86.c:334: undefined reference to `brl_glgraphics_source_GLGraphicsDriver'
C:/blitzmax_ng2/BlitzMax/mod/brl.mod/glmax2d.mod/.bmx/glmax2d.bmx.debug.win32.x86.c:316: undefined reference to `brl_glgraphics_source_GLGraphicsDriver'
C:/blitzmax_ng2/BlitzMax/mod/brl.mod/glmax2d.mod/glmax2d.debug.win32.x86.a(glmax2d.bmx.debug.win32.x86.o): In function `_bb_brl_glmax2d_glmax2d':
C:/blitzmax_ng2/BlitzMax/mod/brl.mod/glmax2d.mod/.bmx/glmax2d.bmx.debug.win32.x86.c:3383: undefined reference to `__bb_brl_glgraphics_glgraphics'
collect2.exe: error: ld returned 1 exit status
Build Error: Failed to link C:/blitzmax_ng2/BlitzMax/tmp/untitled1.debug.exe
Process complete

col

Funny ole world as it errors out at the gl driver, lol.
I'd rename any existing C:\MinGW folders just to be 100% sure that its not trying to use any default MinGW installations - I wouldn't expect this to be the issue but you never know. Then I'd rebuild them all again and see if it that helps.
https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."

Henri

Also make sure that you downloaded NG version with both 32bit and 64bit versions from here https://github.com/bmx-ng/bmx-ng/releases/download/v0.93.3.21.win32/BlitzMax_win32_0.93.3.21.7z

Col,

I got and index error too when compiling in 64bit, curious...

-Henri
- Got 01100011 problems, but the bit ain't 00000001

meems

I downloaded henry's suggested version.
compiling print "hello world"
worked

ran the bug code, compiled and ran with no errors. I'd cautiously say it looks fixed to me.
in which case well done bailing me out, and thx for the help. although stay at defcon 3 for a bit
:)

meems

nope its back. but its shifted to an even stranger place now. will take me a while to strip the code down to give minimal bug code.

col

#26
There's a problem in the GC somewhere.
meems code is producing many textures for a very short life span - the runtime should still be able to handle this perfectly ok.
Eventually the GC kicks in and DeleteTex gets called a couple of times. Occasionally the GC enters the DeleteTex function and doesn't leave. More textures are created and freed so the GC kicks in again. Many textures are freed this time. Later the GC kicks in again and carries on from the previous 'unfinished' work that is was doing earlier. If the array changes size significantly enough during these 'phases' the error occurs.

Modifying the DeleteTex function to:

Function DeleteTex( name,seq )
If seq<>dead_tex_seq Return

WriteStdout "before:  dead_texs.length = " + dead_texs.length + " n_dead_texs = " + n_dead_texs + "~n"

'add tex to queue
If dead_texs.length = n_dead_texs
dead_texs=dead_texs[..n_dead_texs+10]
EndIf

WriteStdout "after:  dead_texs.length = " + dead_texs.length + " n_dead_texs = " + n_dead_texs + "~n"

dead_texs[n_dead_texs]=name
n_dead_texs:+1
'
End Function


gives me

before:  dead_texs.length = 0 n_dead_texs = 0
after:  dead_texs.length = 10 n_dead_texs = 0
before:  dead_texs.length = 10 n_dead_texs = 1
after:  dead_texs.length = 10 n_dead_texs = 1
before:  dead_texs.length = 10 n_dead_texs = 2
after:  dead_texs.length = 10 n_dead_texs = 2
before:  dead_texs.length = 10 n_dead_texs = 3
after:  dead_texs.length = 10 n_dead_texs = 3
before:  dead_texs.length = 10 n_dead_texs = 4
after:  dead_texs.length = 10 n_dead_texs = 4
before:  dead_texs.length = 10 n_dead_texs = 5
after:  dead_texs.length = 10 n_dead_texs = 5
before:  dead_texs.length = 10 n_dead_texs = 6
after:  dead_texs.length = 10 n_dead_texs = 6
before:  dead_texs.length = 10 n_dead_texs = 7
after:  dead_texs.length = 10 n_dead_texs = 7
before:  dead_texs.length = 10 n_dead_texs = 8
after:  dead_texs.length = 10 n_dead_texs = 8
before:  dead_texs.length = 10 n_dead_texs = 9
after:  dead_texs.length = 10 n_dead_texs = 9
before:  dead_texs.length = 10 n_dead_texs = 10
after:  dead_texs.length = 20 n_dead_texs = 10
before:  dead_texs.length = 20 n_dead_texs = 11
after:  dead_texs.length = 20 n_dead_texs = 11
before:  dead_texs.length = 20 n_dead_texs = 12
after:  dead_texs.length = 20 n_dead_texs = 12
before:  dead_texs.length = 20 n_dead_texs = 13
after:  dead_texs.length = 20 n_dead_texs = 13
before:  dead_texs.length = 20 n_dead_texs = 14
after:  dead_texs.length = 20 n_dead_texs = 14
before:  dead_texs.length = 20 n_dead_texs = 15
after:  dead_texs.length = 20 n_dead_texs = 15
before:  dead_texs.length = 20 n_dead_texs = 16
after:  dead_texs.length = 20 n_dead_texs = 16
before:  dead_texs.length = 20 n_dead_texs = 17
after:  dead_texs.length = 20 n_dead_texs = 17
before:  dead_texs.length = 20 n_dead_texs = 18
after:  dead_texs.length = 20 n_dead_texs = 18
before:  dead_texs.length = 20 n_dead_texs = 19
after:  dead_texs.length = 20 n_dead_texs = 19
before:  dead_texs.length = 20 n_dead_texs = 20
after:  dead_texs.length = 30 n_dead_texs = 20
before:  dead_texs.length = 30 n_dead_texs = 21
after:  dead_texs.length = 30 n_dead_texs = 21
before:  dead_texs.length = 30 n_dead_texs = 22
after:  dead_texs.length = 30 n_dead_texs = 22
before:  dead_texs.length = 30 n_dead_texs = 23
after:  dead_texs.length = 30 n_dead_texs = 23
before:  dead_texs.length = 30 n_dead_texs = 24
after:  dead_texs.length = 30 n_dead_texs = 24
before:  dead_texs.length = 30 n_dead_texs = 25
after:  dead_texs.length = 30 n_dead_texs = 25
before:  dead_texs.length = 30 n_dead_texs = 26
after:  dead_texs.length = 30 n_dead_texs = 26
before:  dead_texs.length = 30 n_dead_texs = 27
after:  dead_texs.length = 30 n_dead_texs = 27
before:  dead_texs.length = 30 n_dead_texs = 28
after:  dead_texs.length = 30 n_dead_texs = 28
before:  dead_texs.length = 30 n_dead_texs = 29
after:  dead_texs.length = 30 n_dead_texs = 29
before:  dead_texs.length = 30 n_dead_texs = 30
after:  dead_texs.length = 40 n_dead_texs = 30
before:  dead_texs.length = 40 n_dead_texs = 31
after:  dead_texs.length = 40 n_dead_texs = 31
before:  dead_texs.length = 40 n_dead_texs = 32
after:  dead_texs.length = 40 n_dead_texs = 32
before:  dead_texs.length = 40 n_dead_texs = 33
after:  dead_texs.length = 40 n_dead_texs = 33
before:  dead_texs.length = 40 n_dead_texs = 34
after:  dead_texs.length = 40 n_dead_texs = 34
before:  dead_texs.length = 40 n_dead_texs = 35
after:  dead_texs.length = 40 n_dead_texs = 35
before:  dead_texs.length = 40 n_dead_texs = 31                ' Do things start to go weird here?
after:  dead_texs.length = 40 n_dead_texs = 36
before:  dead_texs.length = 10 n_dead_texs = 8                  ' And continue the weirdness here?
after:  dead_texs.length = 40 n_dead_texs = 37
before:  dead_texs.length = 0 n_dead_texs = 0                     ' And here? Or is that normal being as textures have been freed by now?
after:  dead_texs.length = 40 n_dead_texs = 38
before:  dead_texs.length = 40 n_dead_texs = 0
before:  dead_texs.length = 40 n_dead_texs = 0                    ' NOTICE that the GC hasn't left the function before being called again!
after:  dead_texs.length = 40 n_dead_texs = 0
before:  dead_texs.length = 40 n_dead_texs = 1
after:  dead_texs.length = 40 n_dead_texs = 1
before:  dead_texs.length = 40 n_dead_texs = 2
after:  dead_texs.length = 40 n_dead_texs = 2
before:  dead_texs.length = 40 n_dead_texs = 3
after:  dead_texs.length = 40 n_dead_texs = 3
before:  dead_texs.length = 40 n_dead_texs = 4
after:  dead_texs.length = 40 n_dead_texs = 4
before:  dead_texs.length = 40 n_dead_texs = 5
after:  dead_texs.length = 40 n_dead_texs = 5
before:  dead_texs.length = 40 n_dead_texs = 6
after:  dead_texs.length = 40 n_dead_texs = 6
before:  dead_texs.length = 40 n_dead_texs = 7
after:  dead_texs.length = 40 n_dead_texs = 7
before:  dead_texs.length = 40 n_dead_texs = 8
after:  dead_texs.length = 40 n_dead_texs = 8
before:  dead_texs.length = 40 n_dead_texs = 9
after:  dead_texs.length = 40 n_dead_texs = 9
after:  dead_texs.length = 40 n_dead_texs = 0                         ' NOTICE: now the original GC has kicked back in!
before:  dead_texs.length = 40 n_dead_texs = 0
after:  dead_texs.length = 40 n_dead_texs = 11


In the run above its just by chance that the array is within the size needed to be valid ( size increments of 10 ) when the GC recovers. What on earth is going on there?? It looks to me that it's called from 2 different threads but I don't know - I'm not familiar with the Boehm GC.

Ultimately it looks like there's a bug in NGs GC.
https://github.com/davecamp

"When you observe the world through social media, you lose your faith in it."

meems

#27
I might have figured out what's causing it. It's pretty much what col suggested earlier.

col noticed in the bug code that I'd got a function calling a global b4 the global had been declared. In fact I've done that several times in my code. My code's a mess in that respect.

With the latest ng the bug repeated, but this time the function path wasn't loadimage -> load -> create, it was just straight deletetex->delete->deletetex from the main loop.
So i knew then the bug wasn't to do with images, at least not loadimages

When I got all my globals declared b4 I called them, the bug went away. It may be that calling a global b4 declared causes a strange persistant deep bug because when I 1st fixed it, the bug didn't go away.

If you want I'll put the bug back in and strip the code to minimal bug code so u can study it? I'll keep a copy of the bugged code, but for now I'll try get back to my project

meems

#28
hmm, seems col is already more tuned into the bug. So I don't know if this'll help, but I've stripped a newer version of my code which yields the same bug but it occurs in a different place.
I'm too tired to start on my project, my mind is stuck on this bug, so might as well play with it more.

Code (blitzmax) Select
Graphics 1024,768

Global imagelist:TImage[200]
Global wall1:TImage=LoadImage("coldwall.png")
Global wall2:TImage=loadimage2("wall2.png")
Global blockart:TImage[10]
Global blocko:TImage=LoadImage2("blocks2\blocko.bmp")
Global blockc:TImage=LoadImage2("blocks2\blockc.bmp")
Global blocks:TImage=LoadImage2("blocks2\blocks.bmp")
Global blockq:TImage=LoadImage2("blocks2\blockq.bmp")
Global blockx:TImage=LoadImage2("blocks2\blockx.bmp")
Global blockd:TImage=LoadImage2("blocks2\blockd.bmp")
Global blockb:TImage=loadimage2("blocks2\blockb.bmp")

Global btarray:btemplate[24]
create_block_mix() ' <<<----------- function called b4 globals declared !!! declare globals 1st to fix bug!
Global noi ' number of images

Function loadimage2:TImage(fn$)

imagelist[noi]=LoadImage(fn$)
noi=noi+1
Return imagelist[noi-1]

End Function


Global barray:blockarray=New blockarray ' <---- runtime  crash here!!!!    ************

Type block
Field image:TImage
End Type

Type blockarray
Field ba:block[3000000]
Field le:Int
End Type

Type btemplate

Method create_block_image()

Local blockart:TImage
blockart=LoadImage("blocks2\blockart"+4+".bmp")
DrawImage blockart,0,0
GrabImage blockart,0,0
imagelist[noi]=CreateImage(30,30,1,dynamicimage=1)
GrabImage imagelist[noi],0,0
noi=noi+1

End Method

End Type


Function create_block_mix()
' this function is then sent to create block image, to make a random mix of blocks for this game
Local i
Local bt:btemplate

For i=2 To 9
bt=New btemplate
btarray[3*(i-2)]=bt
bt.Create_block_image()

bt=New btemplate
btarray[3*(i-2)+1]=bt
bt.Create_block_image()

bt=New btemplate
btarray[3*(i-2)+2]=bt
bt.Create_block_image()
Next

End Function

meems

my project code runs but the textures are corrupted. i'll keep a copy of the code that causes the textures to corrupt, so that i can strip the code to its minimum to reproduce the bug.
but hopefully this is another effect of the deleteTex bug