ntoronto / pict3d

3-dimensional picts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pict3d Crashes DrRacket

opened this issue · comments

For whatever reason, on my system, with the details I described in older issues, DrRacket crashes. This is the Debian installation with the lastest Pict3d. This is the closest I could get to a log:

The program 'drracket' received an X Window System error.
This probably reflects a bug in the program.
The error was 'GLXBadContext'.
(Details: serial 68576 error_code 169 request_code 155 minor_code 5)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)

I have no real other information for you. This has once been acompanied by something along the lines of not having a GL 3.(3? 4?) context, which I do.

I'm not sure what causes it, and when it happens seems to be random. Merely running your example does it sometimes:
(combine (sphere origin 1/2) (light (pos 0 1 1)))

I have barely used Pict3D at this point as I have not had a chance to use it in a project until now, so I can't tell you it was a recently caused issue.

This looks like the same thing that plagued bbaeuml for a while. If it is, then fortunately, I've fixed it. Unfortunately, the fix is in Racket itself. Fortunately, Racket is due for a release soon.

In the meantime, if you have a chance, can you try using Pict3D with a snapshot build from http://pre.racket-lang.org, and run it using the following command line?

PLTSTDERR=info <bin-path>/drracket 2>&1 | grep "^pict3d:\|^gl-context:"

If it's the same issue, you'll get a bunch of "gl-context: glXCreateContextAttribsARB raised an error for version 4.5 but (contrary to standards) returned a non-NULL context; ignoring possibly corrupt context" in your terminal.

Nope. The first time I tried DrRacket froze with no new log so that I had to sigkill it, and after that I got no information whatsoever and it just crashed.

pict3d: got canvas OpenGL 44 context (legacy? = #f)
pict3d: creating draw-passes vector for 8 shapes
pict3d: creating span vector of length 1
pict3d: creating point light shell program
pict3d: creating span vector of length 8
pict3d: creating polygon material pass program
pict3d: creating polygon opaque color pass program
pict3d: creating span vector of length 64
pict3d: creating sphere material program for OpenGL >= 32
pict3d: creating sphere opaque color pass program for OpenGL >= 32
pict3d: creating 256x256 depth-buffer
pict3d: creating 256x256 tran-depth-buffer
pict3d: creating 256x256 mat-fbo
pict3d: creating 256x256 tran-mat-fbo
pict3d: creating 256x256 light-fbo
pict3d: creating 256x256 tran-fbo
pict3d: creating 256x256 draw-fbo
pict3d: creating 256x256 reduce-fbo
pict3d: creating 256x256 bloom-fbo
pict3d: creating 256x256 blur-fbo
pict3d: creating draw-params vector of length 4
pict3d: creating vao for 1 (1) vertices, 0 (0) indexes
pict3d: creating temp transform data of length 64
pict3d: creating vao for 32 (24) vertices, 0 (0) indexes
pict3d: creating temp transform data of length 2048
pict3d: creating vao for 256 (162) vertices, 0 (0) indexes
pict3d: creating temp transform data of length 8192
pict3d: creating point light program
pict3d: creating vao for 4 (4) vertices, 8 (6) indexes
pict3d: creating temp index data of length 8
pict3d: creating directional light program
pict3d: creating vao for 4 (4) vertices, 8 (6) indexes
pict3d: creating vao for 4 (4) vertices, 8 (6) indexes
pict3d: creating vao for 1 (1) vertices, 0 (0) indexes
pict3d: creating vao for 32 (24) vertices, 0 (0) indexes
pict3d: creating vao for 256 (162) vertices, 0 (0) indexes
pict3d: creating weighted transparency blend program
pict3d: creating vao for fullscreen compositing passes
pict3d: creating overbright extraction program
pict3d: creating horizontal blur program
pict3d: creating vertical blur program

Doing it a third time, I got this:
pict3d: exception querying canvas OpenGL context version (legacy? = #f): (exn:fail:contract "regexp-split: contract violation\n expected: (or/c string? bytes? path? input-port?)\n given: #f" #)

On a fourth time, I got:
...
pict3d: creating vertical blur program
pict3d: creating fullscreen program
pict3d: creating bloom compositing program
pict3d: creating temp ARGB bytes of length 262144

Before having to sigkill it again. This is all using the simple example code.

On the upside, it is happening far less often, significantly, to the point where it would be tolerable to work with, albeit somewhat annoying. Before it was crashing around 1/3rd of the time, while now it is far less often.

What happens when you put (current-pict3d-legacy? #t) at the top of your code?

It wouldn't crash. Upon removal, it did crash however.

Good clue. Can you please paste in the results of running glxinfo in a terminal?

Unfortunately, it looks like there's nothing I can do about this in Pict3D. I'm sure I can work around it in Racket somehow, but that'll have to wait for the next release.

I'm glad you've got a workaround in the meantime.

If you have time, can you please run the following program and reply with its output?

#lang racket

(require typed/opengl
         racket/gui)

(define frame (new frame% [label "Test"] [width 400] [height 400]))
(define canvas (new canvas% [parent frame] [style '(gl no-autoclear)]))
(send frame show #t)

(send (send (send canvas get-dc) get-gl-context)
      call-as-current
      (λ ()
        (list (gl-version)
              (gl-core-profile?))))

I'd like to know if a workaround I have in mind (behaving as if the legacy? flag is #t when the card is NVIDIA) would work, and whether your drivers in particular pretend to return a core profile when one isn't requested.

'(44 #f)

That may not have been the real issue and just by coincidence the fix worked, because when actually trying to develop, DrRacket crashed again. Sadly, I don't have a log as it was launched from gnome.

I am now unable to as much as install pict3d on a 6.2.0.2 Racket installation.
http://pastebin.com/9a4mnAYK

Upon running it in this state, I get
. .racket/snapshot/pkgs/pict3d/pict3d/private/engine/shape/polygon.rkt:490:21: Type Checker: type mismatch
expected: (U Nonnegative-Float False)
given: Flonum in: time
. .racket/snapshot/pkgs/pict3d/pict3d/private/engine/shape/polygon.rkt:511:19: Type Checker: type mismatch
expected: (U Nonnegative-Float False)
given: Flonum in: time
. .racket/snapshot/pkgs/pict3d/pict3d/private/engine/shape/polygon.rkt:490:21: Type Checker: Summary: 2 errors encountered in:
time
time

That appears to be the same problem as is solved here: #23

Yes, and I've finally merged Alex's pull requests.