Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INTEL gpu black screen when running Shadertone #22

Closed
josephwilk opened this issue Jan 9, 2014 · 25 comments
Closed

INTEL gpu black screen when running Shadertone #22

josephwilk opened this issue Jan 9, 2014 · 25 comments
Labels

Comments

@josephwilk
Copy link
Contributor

Hi,

I'm using OS X maverick. I cloned the project and ran a repl (Clojure 1.5.1). Also ran lein run

I could not get any of the examples to work.
It launches a main window but it is always black. I think I've been through ever example with the sample result.

Am I doing something wrong?

I also tried the https://github.com/rogerallen/sot project and had the same black window.

Java info:
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

Thanks,
Joseph Wilk

@rogerallen
Copy link
Member

Thanks for the report, Joseph.

Are there any warnings or errors reported? I would expect some sort of errors when creating the GL context.

Do you hear sounds? Does the overtone part work?

I'm not running Mavericks yet, I'm still on Lion so I can't repro.

@josephwilk
Copy link
Contributor Author

Yes I hear sound, the Overtone part seems to work fine.

I cannot see any errors reported, unless they are logging to somewhere I don't know about...

I clone and ran "lein alpha" for https://github.com/rogerallen/hello_lwjgl
This rendered the dialog and showed the diamond/cube.

@rogerallen
Copy link
Member

Thanks for checking with hello_lwjgl. That gives hope that this can work. I just need more of an idea as to where things might be going wrong.

Could you look in the output of "Console" to see if anything went there?
Could you tell me what hardware you are running on?
Can you go to www.shadertoy.com and see shaders running in your browser?

I guess I'll have to try adding more error checking.

@josephwilk
Copy link
Contributor Author

www.shadertoy.com works fine in chrome for me with various shaders.

Full specs of my macbook air:

Full output of lein run in shadertoy:

狒々➜  shadertone git:(master) ✗ lein run
--> Loading Overtone...
--> Booting internal SuperCollider server...
Found 0 LADSPA plugins
Number of Devices: 5
   0 : "AirPlay"
   1 : "Built-in Microph"
   2 : "Built-in Output"
   3 : "Soundflower (2ch)"
   4 : "Soundflower (16ch)"

"Built-in Microph" Input Device
   Streams: 1
      0  channels 2

"Built-in Output" Output Device
   Streams: 1
      0  channels 2

SC_AudioDriver: sample rate = 44100.000000, driver's block size = 512
--> Connecting to internal SuperCollider server...
--> Connection established

    _____                 __
   / __  /_  _____  _____/ /_____  ____  ___
  / / / / | / / _ \/ ___/ __/ __ \/ __ \/ _ \
 / /_/ /| |/ /  __/ /  / /_/ /_/ / / / /  __/
 \____/ |___/\___/_/   \__/\____/_/ /_/\___/

   Collaborative Programmable Music. v0.9.1


Hello Josephwilk, may this be the start of a beautiful music hacking session...

Playing a 60 second demo inspired by
https://twitter.com/redFrik/status/329311535723839489
Enjoy...
Loading shader from file: examples/redFrik.glsl
Done.

@rogerallen
Copy link
Member

Thank you, that's helpful. I'll try to write up some tests for this ASAP. If you're not too sick of this, could you try "lein test" and see if that works at all?

@josephwilk
Copy link
Contributor Author

lein test launches the black screens, fullscreen also but just no pulses. No error messages bar the failing tests.

Now i've done my live performance I'm a bit freer and can also take a deeper look.

@rogerallen
Copy link
Member

If you're going to try looking closer, start by littering the src/shadertone/shader.clj routines

(init-buffers)
(init-textures)
(init-shaders)

with

(println "error?" (GL11/glGetError))

to see which GL call is causing the trouble. I was hoping to try this out on my wife's older intel GPU, but it won't even load Overtone at all (older OS, older Java, not going to bother further). I'll try adding these error checks to the code.

p.s. sorry shadertone wasn't available for your live performance.

rogerallen added a commit that referenced this issue Jan 10, 2014
Used this to find an error where
(GL20/glGetShaderi new-pgm-id GL20/GL_LINK_STATUS)
should have been
(GL20/glGetProgrami new-pgm-id GL20/GL_LINK_STATUS).
So, I think this should solve issue #22
@rogerallen
Copy link
Member

I think I found the error Joseph. Could you pull the latest & retry?

@josephwilk
Copy link
Contributor Author

Thanks for looking into this!
I pulled the latest changes but unfortunately I still just see the black screen.
Via lein run

With no errors in the console either.

@rogerallen
Copy link
Member

Oh, no! No errors? So OpenGL has nothing to complain about, but it just doesn't display anything? This is proving difficult!

Please try a "lein clean", "lein test", Joseph. The shaders in "lein test" are much simpler than the one that runs via "lein run".

@josephwilk
Copy link
Contributor Author

Same result with lein clean and lein test :(

While it relates to an older version of lwjgl there where some reports from Minecraft users of only getting a black screen. Thats all I've found digging through google for similar issues with Maverick. https://timashley.me/node/596

Also info on my OPENGL version:

OpenGL version: 2.1 INTEL-8.18.29

@rogerallen
Copy link
Member

Without some more hints as to what might be going wrong, I'm a bit at a loss for how to move forward.

Some ideas:

  • see if the other hello_lwjgl programs (beta and gamma) work for you.
  • if earlier versions of shadertone work.
  • pedantically add (except-gl-errors) after every single gl call.

any other thoughts, Joseph?

@josephwilk
Copy link
Contributor Author

Ill have another play on my flight, no luck so far sprinkling error
reporting everywhere.
I've tried older versions of shadertone without any luck.
I also tried alpha, beta and gamma of hello_lwjgl all of which worked fine.
I'll also see if anyone on the Irc channel of lwjgl has any ideas.

Starting to run out of ideas myself!

Would be good to confirm with another maverick user, when I get back
home ill test on some different machines just to check this is no blip.

There is a lot of depth in the java gl classes which makes it quite a
challenge to parse through.

On Saturday, January 11, 2014, Roger Allen wrote:

Without some more hints as to what might be going wrong, I'm a bit at a
loss for how to move forward.

Some ideas:

  • see if the other hello_lwjgl programs (beta and gamma) work for you.
    • if earlier versions of shadertone work.
    • pedantically add (except-gl-errors) after every single gl call.

any other thoughts, Joseph?


Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-32099609
.

Joseph Wilk
https://blog.josephwilk.net
@josephwilk

@rogerallen
Copy link
Member

Okay, the fact that you can run hello-lwjgl beta is good as that is basically where shadertone started. I think I'd like to start with something that works and keep adding more shadertone-like code until it breaks.

rogerallen added a commit to rogerallen/hello_lwjgl that referenced this issue Jan 11, 2014
@rogerallen
Copy link
Member

Joseph, can you please pull the latest hello_lwjgl and try "lein run delta". You should see a spinning yellow triangle. The delta test uses beta as a base & changes the minimal things to make it look like shadertone. OpenGL 2.1 is the main change...I'm wondering if perhaps the 2.1 driver is not as well-tested as later drivers?

@josephwilk
Copy link
Contributor Author

Lein run delta gives the black screen with nothing on it!
Great we have a smaller example of the failure.

Joe

On Saturday, January 11, 2014, Roger Allen wrote:

Joseph, can you please pull the latest hello_lwjgl and try "lein run
delta". The delta test takes beta as a base & changes the minimal things to
make it look like shadertone. OpenGL 2.1 is the main change...I'm wondering
if perhaps the 2.1 driver is not as well-tested as later drivers?


Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-32105858
.

Joseph Wilk
https://blog.josephwilk.net
@josephwilk

@rogerallen
Copy link
Member

Alright, this helps! Try changing line 14 to use OpenGL 3.2

context-attributes (-> (ContextAttribs. 3 2))

just in case if that doesn't help, try commenting out lines 31,32

;;(Display/setVSyncEnabled true)
;;(Display/setLocation 0 0)

@josephwilk
Copy link
Contributor Author

I tried:

  • 3 0
  • 3 1
  • 3 2
  • 4 1
  • 4 4

None of those changes had any effect.

Despite that setting I was still seeing in the console output:

Hello, Lightweight Java Game Library! V 2.9.1
Run example Delta
OpenGL version: 2.1 INTEL-8.18.29
init-shaders glShaderSource errors? 0
init-shaders glCompileShader errors? 0
init-shaders glShaderSource errors? 0
init-shaders glCompileShader errors? 0

Would that println always miss the opengl version if we change it as above?

lein run beta prints a different opengl version:

Hello, Lightweight Java Game Library! V 2.9.1
Run example Beta
OpenGL version: 4.1 INTEL-8.18.29
2014-01-11 16:53:19.885 java[19512:240b] Unknown modifier with keycode: 0

@josephwilk
Copy link
Contributor Author

if i try and copy the beta.clj versions setup of the context-attributes:

  context-attributes (-> (ContextAttribs. 3 2)
                         (.withForwardCompatible true)
                         (.withProfileCore true))

I got lots of errors.

Hello, Lightweight Java Game Library! V 2.9.1
Run example Delta
OpenGL version: 4.1 INTEL-8.18.29
ERROR: Loading a Shader:
ERROR: 0:1: '' :  version '120' is not supported
ERROR: 0:2: '' :  #version required and missing.
ERROR: 0:3: 'attribute' : syntax error syntax error

ERROR: Loading a Shader:
ERROR: 0:1: '' :  version '120' is not supported
ERROR: 0:2: '' :  #version required and missing.

ERROR: Linking Shaders:
ERROR: One or more attached shaders not successfully compiled

Exception in thread "Thread-2" java.lang.IllegalStateException: Function is not supported
    at org.lwjgl.BufferChecks.checkFunctionAddress(BufferChecks.java:58)
    at org.lwjgl.opengl.GL11.glEnableClientState(GL11.java:998)
    at hello_lwjgl.delta$draw.invoke(delta.clj:144)
    at hello_lwjgl.delta$update.invoke(delta.clj:169)
    at hello_lwjgl.delta$run.invoke(delta.clj:193)
    at clojure.lang.AFn.run(AFn.java:24)
    at java.lang.Thread.run(Thread.java:724)

@rogerallen
Copy link
Member

It seems like LWJGL cannot deal with compatibility profile on the mac as https://lwjgl.org/javadoc/org/lwjgl/opengl/ContextAttribs.html says

This extension is not supported on MacOS X. However, in order to enable the GL 3.2 context on MacOS X 10.7
or newer, an instance of this class must be passed to LWJGL. The only valid configuration is new
ContextAttribs(3, 2).withProfileCore(), anything else will be ignored.

So, in order to get this working on your Air we would have to make some incompatible OpenGL changes that basically change the delta code back to the beta code.

This seems to be a Catch-22, since one of the main features of shadertone is to run www.shadertoy.com WebGL shaders (which require version 120 GLSL which is supported by OpenGL 2.1, not 3.2-core).

At least that's how I see it at the moment. I'm not sure which way to move at the moment... It might help if we can figure out if this is an LWJGL or a MacOS issue...

@rogerallen
Copy link
Member

Resummarizing the situation as I see it...

I believe there is either a bug in LWJGL, MacOS Mavericks or the INTEL GL driver since there is no report of glErrors and the code seems to work for other platforms. Following up on this error is going to be some work. Basically, I think we'd need to write a variant of the hello_jwjgl delta program in Objective-C and perhaps Java to narrow it down further.

I'm torn between trying to figure out this bug and making a variant of shader.clj that creates a more modern GL context (GL3 or GL4) and figures out how to make shadertoy GLSL work.

@rogerallen
Copy link
Member

Hey, I only just remembered that I can force the use of my MacBooks Intel HD 4000 via gfxCardStatus. Now I'm able to repro the issue--a black screen and no GL errors. (hello_lwjgl alpha & beta work + delta fails so this matches your report)

So, it isn't a new Mavericks issue at least since I'm running Lion + OpenGL version: 2.1 INTEL-8.16.74. Seems like an INTEL driver issue.

rogerallen added a commit that referenced this issue Jan 13, 2014
@rogerallen
Copy link
Member

Okay...I think I got it. Joseph, please pull the latest and retry.

@josephwilk
Copy link
Contributor Author

Lots of flashing lights and pretty shapes with lein run Working perfectly!
Thanks very much for looking into this Roger, I was stumped.

Look forward to using shadertone in my next live performance.

@rogerallen
Copy link
Member

Oh, thank goodness! It turned out to be something very simple, but debugging OpenGL is not straightforward.

Closing as fixed. YAY!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants