Shader crashes JVM

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

Shader crashes JVM

cubus
hi,

this fragment shader crashes the jvm... when running the shader on GLSL Sandbox, everything works.

if either LINE C or LINE D are uncommented it crashes.
if then either
      in LINE A the "2.0 + 1.0" is changed to "2.0 + aValueThatIsNot 1.0" (eg "2.0 + 1.0001")  
or  
      LINE B is removed
then it works

btw, i know that the
                float my = resolution.y;
                if (y <= my) {
does not make sense, this is just a broken down version to have a crashing code ;)

any ideas?



#ifdef GL_ES
precision mediump float;
#endif

uniform vec2 resolution;
uniform vec2 mouse;
uniform float time;

void main(void) {
        vec2 p = 2.0 * (gl_FragCoord.xy / resolution.xy) - 1.0;
        p.x *= resolution.x / resolution.y;

        float r = 0.0;
        float g = 0.0;
        float b = 0.0;
       
        const float ni = 9.0;
        float cw = resolution.x / (ni + 1.0);
        float ch = 2.0;
       
        float x = gl_FragCoord.x;
        float y = gl_FragCoord.y;
       
        for (float i = 1.0; i <= ni; i += 1.0) {
                float cx = i * cw + cw / 2.0;
                float dx = x - cx;
                float my = resolution.y;
                if (y <= my) {
                        float dy = my / resolution.y;
                        float yy = y / resolution.y;
                        float ww = (cw / 2.0 - abs(dx)) * 0.1;
                        float wmul = abs(sin((p.y * 2.0 + 1.0) * ch));              // <<< LINE A
                        ww *= wmul;                                                           // <<< LINE B
                        float c = clamp(ww, 0.0, 1.0);
                        yy = clamp(yy, 0.0, 1.0);
// r += c * yy;                                                              // <<< LINE C
// g += c * (1.0 - yy);                                                   // <<< LINE D
                }
        }

        gl_FragColor = vec4(r, g, b, 1.0);
}



#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x61d81186, pid=2612, tid=4044
#
# JRE version: 6.0_39-b04
# Java VM: Java HotSpot(TM) Client VM (20.14-b01 mixed mode, sharing windows-x86 )
# Problematic frame:
# C  [nvoglv32.dll+0x2f1186]
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  T H R E A D  ---------------

Current thread (0x00329c00):  JavaThread "main" [_thread_in_native, id=4044, stack(0x002d0000,0x00320000)]

siginfo: ExceptionCode=0xc0000005, writing address 0x00000008

Registers:
EAX=0x0c91a9e0, EBX=0x0c9289d0, ECX=0x00000000, EDX=0x0c91a9e0
ESP=0x003168b8, EBP=0x003168b8, ESI=0x00316aa4, EDI=0x0c910868
EIP=0x61d81186, EFLAGS=0x00210212

Top of Stack: (sp=0x003168b8)
0x003168b8:   00316a00 61e466ea 0c91a9e0 0c910810
0x003168c8:   00316aa4 0c8bdd48 0c8bdd48 0c900207
0x003168d8:   00000000 00000207 00000000 00000207
0x003168e8:   00000000 00300207 00000000 00000207
0x003168f8:   00000000 00000207 00000000 00000207
0x00316908:   00000000 00300207 00000000 01e00207
0x00316918:   00000000 0c900207 00000000 00300207
0x00316928:   00000000 00300207 00000000 0c880207

Instructions: (pc=0x61d81186)
0x61d81166:   04 00 00 00 00 c7 00 00 00 00 00 c7 40 08 00 00
0x61d81176:   00 00 5f 5d c2 04 00 cc cc cc 55 8b ec 8b 45 08
0x61d81186:   ff 49 08 8b 10 56 8b 70 04 39 01 75 02 89 11 39
0x61d81196:   41 04 75 03 89 71 04 33 c9 3b d1 74 03 89 72 04


Register to memory mapping:

EAX=0x0c91a9e0 is an unknown value
EBX=0x0c9289d0 is an unknown value
ECX=0x00000000 is an unknown value
EDX=0x0c91a9e0 is an unknown value
ESP=0x003168b8 is pointing into the stack for thread: 0x00329c00
EBP=0x003168b8 is pointing into the stack for thread: 0x00329c00
ESI=0x00316aa4 is pointing into the stack for thread: 0x00329c00
EDI=0x0c910868 is an unknown value


Stack: [0x002d0000,0x00320000],  sp=0x003168b8,  free space=282k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [nvoglv32.dll+0x2f1186]
C  [nvoglv32.dll+0x3b66ea]
C  [nvoglv32.dll+0x3b8290]
C  [nvoglv32.dll+0x3b9d97]
C  [nvoglv32.dll+0x3b9fee]
C  [nvoglv32.dll+0x3ba0b8]
C  [nvoglv32.dll+0x4a8434]
C  [nvoglv32.dll+0x4f25bf]
C  [nvoglv32.dll+0x4f4649]
C  [nvoglv32.dll+0x529342]
C  [nvoglv32.dll+0x5db213]
C  [nvoglv32.dll+0x5b33f6]
C  [nvoglv32.dll+0x5bf246]
C  [nvoglv32.dll+0x8bac02]  DrvPresentBuffers+0x2b402
C  [nvoglv32.dll+0x8baf48]  DrvPresentBuffers+0x2b748
C  [nvoglv32.dll+0x986004]  DrvPresentBuffers+0xf6804
C  [nvoglv32.dll+0x987446]  DrvPresentBuffers+0xf7c46
C  [nvoglv32.dll+0x8d3f6e]  DrvPresentBuffers+0x4476e
C  [nvoglv32.dll+0x8d40b9]  DrvPresentBuffers+0x448b9
C  [nvoglv32.dll+0x8d41a0]  DrvPresentBuffers+0x449a0
C  [nvoglv32.dll+0x9876c7]  DrvPresentBuffers+0xf7ec7
C  [nvoglv32.dll+0x98f35e]  DrvPresentBuffers+0xffb5e
C  [nvoglv32.dll+0x1c68]
C  [nvoglv32.dll+0x16fb]
C  [nvoglv32.dll+0x14a7af]
C  [nvoglv32.dll+0x992d65]  DrvPresentBuffers+0x103565
C  [nvoglv32.dll+0x1cb7bf]
C  [jogl_desktop.dll+0x3543]  Java_jogamp_opengl_gl4_GL4bcImpl_dispatch_1glBegin1__IJ+0xf
J  jogamp.opengl.gl4.GL4bcImpl.dispatch_glBegin1(IJ)V
J  jogamp.opengl.gl4.GL4bcImpl.glBegin(I)V
J  main.Main.display(Ljavax/media/opengl/GLAutoDrawable;)V
j  jogamp.opengl.GLDrawableHelper.invokeGL(Ljavax/media/opengl/GLDrawable;Ljavax/media/opengl/GLContext;Ljava/lang/Runnable;Ljava/lang/Runnable;)V+83
J  com.jogamp.newt.opengl.GLWindow.display()V
j  main.Main.main([Ljava/lang/String;)V+3
v  ~StubRoutines::call_stub
V  [jvm.dll+0xfb88b]
V  [jvm.dll+0x18d551]
V  [jvm.dll+0xfb90d]
V  [jvm.dll+0x960f6]
V  [jvm.dll+0x9df33]
C  [javaw.exe+0x2155]
C  [javaw.exe+0x8624]
C  [kernel32.dll+0x4d2e9]  BaseThreadInitThunk+0x12
C  [ntdll.dll+0x41603]  RtlInitializeExceptionChain+0x63
C  [ntdll.dll+0x415d6]  RtlInitializeExceptionChain+0x36

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J  jogamp.opengl.gl4.GL4bcImpl.dispatch_glBegin1(IJ)V
J  jogamp.opengl.gl4.GL4bcImpl.glBegin(I)V
j  gl.GLScreenQuad.draw(Ljavax/media/opengl/GL2;FFFF)V+8
J  main.Main.display(Ljavax/media/opengl/GLAutoDrawable;)V
J  jogamp.opengl.GLDrawableHelper.displayImpl(Ljavax/media/opengl/GLAutoDrawable;)V
J  jogamp.opengl.GLAutoDrawableBase$2.run()V
j  jogamp.opengl.GLDrawableHelper.invokeGLImpl(Ljavax/media/opengl/GLDrawable;Ljavax/media/opengl/GLContext;Ljava/lang/Runnable;Ljava/lang/Runnable;)V+206
j  jogamp.opengl.GLDrawableHelper.invokeGL(Ljavax/media/opengl/GLDrawable;Ljavax/media/opengl/GLContext;Ljava/lang/Runnable;Ljava/lang/Runnable;)V+83
J  com.jogamp.newt.opengl.GLWindow.display()V
j  main.Main.<init>()V+463
j  main.Main.main([Ljava/lang/String;)V+3
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x045bb400 JavaThread "Thread-6" [_thread_blocked, id=3564, stack(0x0afe0000,0x0b030000)]
  0x045b8800 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=2236, stack(0x0a4c0000,0x0a510000)]
  0x045adc00 JavaThread "main-Display-.windows_nil-1-EDT-1" daemon [_thread_blocked, id=276, stack(0x09580000,0x095d0000)]
  0x04585800 JavaThread "main-SharedResourceRunner" daemon [_thread_blocked, id=3296, stack(0x04fb0000,0x05000000)]
  0x04533400 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3576, stack(0x05040000,0x05090000)]
  0x044fec00 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=2592, stack(0x04ec0000,0x04f10000)]
  0x01ab9800 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=572, stack(0x02390000,0x023e0000)]
  0x01aaa400 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=2736, stack(0x02340000,0x02390000)]
  0x01aa9400 JavaThread "Attach Listener" daemon [_thread_blocked, id=3524, stack(0x022f0000,0x02340000)]
  0x01aa8400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1968, stack(0x022a0000,0x022f0000)]
  0x01aa1400 JavaThread "Finalizer" daemon [_thread_blocked, id=3956, stack(0x02250000,0x022a0000)]
  0x01a9c800 JavaThread "Reference Handler" daemon [_thread_blocked, id=3320, stack(0x02200000,0x02250000)]
=>0x00329c00 JavaThread "main" [_thread_in_native, id=4044, stack(0x002d0000,0x00320000)]

Other Threads:
  0x01a60000 VMThread [stack: 0x01b90000,0x01be0000] [id=1164]
  0x01abac00 WatcherThread [stack: 0x043f0000,0x04440000] [id=12]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 def new generation   total 4928K, used 3419K [0x24100000, 0x24650000, 0x29650000)
  eden space 4416K,  77% used [0x24100000, 0x24455d98, 0x24550000)
  from space 512K,   0% used [0x24550000, 0x24551148, 0x245d0000)
  to   space 512K,   0% used [0x245d0000, 0x245d0000, 0x24650000)
 tenured generation   total 10944K, used 2310K [0x29650000, 0x2a100000, 0x34100000)
   the space 10944K,  21% used [0x29650000, 0x29891ad8, 0x29891c00, 0x2a100000)
 compacting perm gen  total 12288K, used 6058K [0x34100000, 0x34d00000, 0x38100000)
   the space 12288K,  49% used [0x34100000, 0x346ea9c0, 0x346eaa00, 0x34d00000)
    ro space 10240K,  51% used [0x38100000, 0x38632418, 0x38632600, 0x38b00000)
    rw space 12288K,  55% used [0x38b00000, 0x3919d7b0, 0x3919d800, 0x39700000)

Code Cache  [0x023f0000, 0x02538000, 0x043f0000)
 total_blobs=934 nmethods=553 adapters=317 free_code_cache=32224320 largest_free_block=0

Dynamic libraries:
0x00400000 - 0x00425000 C:\Program Files\Java\jre6\bin\javaw.exe
0x77bc0000 - 0x77ce8000 C:\Windows\system32\ntdll.dll
0x77220000 - 0x772fc000 C:\Windows\system32\kernel32.dll
0x76280000 - 0x76346000 C:\Windows\system32\ADVAPI32.dll
0x76380000 - 0x76443000 C:\Windows\system32\RPCRT4.dll
0x77350000 - 0x773ed000 C:\Windows\system32\USER32.dll
0x776d0000 - 0x7771b000 C:\Windows\system32\GDI32.dll
0x778b0000 - 0x778ce000 C:\Windows\system32\IMM32.DLL
0x76450000 - 0x76518000 C:\Windows\system32\MSCTF.dll
0x76550000 - 0x765fa000 C:\Windows\system32\msvcrt.dll
0x77210000 - 0x77219000 C:\Windows\system32\LPK.DLL
0x77190000 - 0x7720d000 C:\Windows\system32\USP10.dll
0x7c340000 - 0x7c396000 C:\Program Files\Java\jre6\bin\msvcr71.dll
0x6d7f0000 - 0x6daa0000 C:\Program Files\Java\jre6\bin\client\jvm.dll
0x74510000 - 0x74542000 C:\Windows\system32\WINMM.dll
0x77a70000 - 0x77bb5000 C:\Windows\system32\ole32.dll
0x77640000 - 0x776cd000 C:\Windows\system32\OLEAUT32.dll
0x744d0000 - 0x7450e000 C:\Windows\system32\OLEACC.dll
0x760b0000 - 0x760dc000 C:\Windows\system32\apphelp.dll
0x6d7a0000 - 0x6d7ac000 C:\Program Files\Java\jre6\bin\verify.dll
0x6d320000 - 0x6d33f000 C:\Program Files\Java\jre6\bin\java.dll
0x6d7e0000 - 0x6d7ef000 C:\Program Files\Java\jre6\bin\zip.dll
0x75910000 - 0x7594b000 C:\Windows\system32\rsaenh.dll
0x76130000 - 0x7614e000 C:\Windows\system32\USERENV.dll
0x76110000 - 0x76124000 C:\Windows\system32\Secur32.dll
0x6d600000 - 0x6d613000 C:\Program Files\Java\jre6\bin\net.dll
0x76350000 - 0x7637d000 C:\Windows\system32\WS2_32.dll
0x77cf0000 - 0x77cf6000 C:\Windows\system32\NSI.dll
0x75730000 - 0x7576b000 C:\Windows\system32\mswsock.dll
0x75ef0000 - 0x75ef5000 C:\Windows\System32\wship6.dll
0x75540000 - 0x7554f000 C:\Windows\system32\NLAapi.dll
0x75ab0000 - 0x75ac9000 C:\Windows\system32\IPHLPAPI.DLL
0x75a70000 - 0x75aa5000 C:\Windows\system32\dhcpcsvc.DLL
0x75f20000 - 0x75f4c000 C:\Windows\system32\DNSAPI.dll
0x75f10000 - 0x75f17000 C:\Windows\system32\WINNSI.DLL
0x75a40000 - 0x75a62000 C:\Windows\system32\dhcpcsvc6.DLL
0x73ac0000 - 0x73acf000 C:\Windows\system32\napinsp.dll
0x739a0000 - 0x739b2000 C:\Windows\system32\pnrpnsp.dll
0x73ab0000 - 0x73ab8000 C:\Windows\System32\winrnr.dll
0x77300000 - 0x77349000 C:\Windows\system32\WLDAP32.dll
0x76270000 - 0x76277000 C:\Windows\system32\PSAPI.DLL
0x757a0000 - 0x757a5000 C:\Windows\System32\wshtcpip.dll
0x740b0000 - 0x740b6000 C:\Windows\system32\rasadhlp.dll
0x6d620000 - 0x6d629000 C:\Program Files\Java\jre6\bin\nio.dll
0x637c0000 - 0x637ca000 C:\Users\mike\AppData\Local\Temp\jogamp_0000\file_cache\jln7770878840938610785\jln8588487665599326119\gluegen-rt.dll
0x6d000000 - 0x6d14c000 C:\Program Files\Java\jre6\bin\awt.dll
0x73f20000 - 0x73f62000 C:\Windows\system32\WINSPOOL.DRV
0x74dd0000 - 0x74f6e000 C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6002.18305_none_5cb72f2a088b0ed3\COMCTL32.dll
0x77130000 - 0x77189000 C:\Windows\system32\SHLWAPI.dll
0x739d0000 - 0x739dc000 C:\Windows\system32\DWMAPI.DLL
0x748b0000 - 0x748ef000 C:\Windows\system32\uxtheme.dll
0x6d350000 - 0x6d356000 C:\Program Files\Java\jre6\bin\jawt.dll
0x6a440000 - 0x6a44a000 C:\Users\mike\AppData\Local\Temp\jogamp_0000\file_cache\jln7770878840938610785\jln8588487665599326119\nativewindow_awt.dll
0x6d230000 - 0x6d27f000 C:\Program Files\Java\jre6\bin\fontmanager.dll
0x733c0000 - 0x7357a000 C:\Windows\system32\d3d9.dll
0x75f00000 - 0x75f08000 C:\Windows\system32\VERSION.dll
0x73c40000 - 0x73c46000 C:\Windows\system32\d3d8thk.dll
0x051d0000 - 0x06029000 C:\Windows\system32\nvd3dum.dll
0x75840000 - 0x7585a000 C:\Windows\system32\powrprof.dll
0x76600000 - 0x77111000 C:\Windows\system32\shell32.dll
0x6c100000 - 0x6c110000 C:\Users\mike\AppData\Local\Temp\jogamp_0000\file_cache\jln7770878840938610785\jln8588487665599326119\nativewindow_win32.dll
0x69430000 - 0x694fb000 C:\Windows\system32\OpenGL32.dll
0x6e4d0000 - 0x6e4f3000 C:\Windows\system32\GLU32.dll
0x6c8f0000 - 0x6c9d5000 C:\Windows\system32\DDRAW.dll
0x74850000 - 0x74856000 C:\Windows\system32\DCIMAN32.dll
0x77720000 - 0x778aa000 C:\Windows\system32\SETUPAPI.dll
0x64500000 - 0x6456a000 C:\Users\mike\AppData\Local\Temp\jogamp_0000\file_cache\jln7770878840938610785\jln8588487665599326119\jogl_desktop.dll
0x61a90000 - 0x62e4d000 C:\Windows\system32\nvoglv32.dll
0x75460000 - 0x7548d000 C:\Windows\system32\WINTRUST.dll
0x75b50000 - 0x75c43000 C:\Windows\system32\CRYPT32.dll
0x75cb0000 - 0x75cc2000 C:\Windows\system32\MSASN1.dll
0x76520000 - 0x7654a000 C:\Windows\system32\imagehlp.dll
0x75860000 - 0x75881000 C:\Windows\system32\NTMARTA.DLL
0x75cd0000 - 0x75ce1000 C:\Windows\system32\SAMLIB.dll
0x6cbc0000 - 0x6cbd1000 C:\Users\mike\AppData\Local\Temp\jogamp_0000\file_cache\jln7770878840938610785\jln8588487665599326119\newt.dll
0x6d510000 - 0x6d535000 C:\Program Files\Java\jre6\bin\jsound.dll
0x6d540000 - 0x6d548000 C:\Program Files\Java\jre6\bin\jsoundds.dll
0x6d370000 - 0x6d3e0000 C:\Windows\system32\DSOUND.dll
0x6e680000 - 0x6e6af000 C:\Windows\system32\wdmaud.drv
0x730d0000 - 0x730d4000 C:\Windows\system32\ksuser.dll
0x75770000 - 0x75798000 C:\Windows\system32\MMDevAPI.DLL
0x75550000 - 0x75557000 C:\Windows\system32\AVRT.dll
0x70030000 - 0x70051000 C:\Windows\system32\AUDIOSES.DLL
0x6fc50000 - 0x6fcb6000 C:\Windows\system32\audioeng.dll
0x730e0000 - 0x730e9000 C:\Windows\system32\msacm32.drv
0x6ed70000 - 0x6ed84000 C:\Windows\system32\MSACM32.dll
0x71080000 - 0x71087000 C:\Windows\system32\midimap.dll
0x775b0000 - 0x77634000 C:\Windows\system32\CLBCatQ.DLL

VM Arguments:
jvm_args: -Dfile.encoding=Cp1252
java_command: main.Main
Launcher Type: SUN_STANDARD

Environment Variables:
JAVA_HOME=g:\jdk6
CLASSPATH=.;C:\Program Files\Java\jre6\lib\ext\QTJava.zip
PATH=C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/i386;C:\Program Files\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;D:\DicomUtils;E:\JavaProjects\_Utils;G:\jogl\lib;C:\Program Files\Common Files\Ulead Systems\MPEG;I:\OpenOffice.org 3\URE\bin;I:\OpenOffice.org 3\program;C:\Program Files\QuickTime\QTSystem\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\SlikSvn\bin;I:\VisualStudio6\common\Tools\WinNT;I:\VisualStudio6\common\MSDev98\Bin;I:\VisualStudio6\common\Tools;I:\VisualStudio6\VC98\bin;C:\Program Files\OpenVPN\bin;E:\JavaProjects\DDKBUILD;G:\eclipse;
USERNAME=mike
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 6, GenuineIntel



---------------  S Y S T E M  ---------------

OS: Windows Vista Build 6002 Service Pack 2

CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 15 stepping 6, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3

Memory: 4k page, physical 2095420k(651848k free), swap 4441728k(2090200k free)

vm_info: Java HotSpot(TM) Client VM (20.14-b01) for windows-x86 JRE (1.6.0_39-b04), built on Jan 15 2013 14:00:47 by "java_re" with MS VC++ 7.1 (VS2003)

time: Tue Mar 19 01:06:50 2013
elapsed time: 30 seconds




Reply | Threaded
Open this post in threaded view
|

Re: Shader crashes JVM

gouessej
Administrator
Hi

Mixing immediate mode (glBegin()/glEnd()/...) with shaders is a very bad idea, I already said that several times here. It causes huge slowdowns with some drivers and now you even get a crash. Your GLSL sandbox probably doesn't do that. Switch to VBOs, use at least ImmModeSink if you're in a hurry.

Edit.: it might not be enough to solve your problem. Please look at shader logs.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Shader crashes JVM

Xerxes Rånby
In reply to this post by cubus
2013-03-19 01:23, cubus [via jogamp] skrev:

>
>
> this fragment shader crashes the jvm... when running the shader on GLSL Sandbox, everything works.
>
> if either LINE C or LINE D are uncommented it crashes.
> if then either
>       in LINE A the "2.0 + 1.0" is changed to "2.0 + aValueThatIsNot 1.0" (eg "2.0 + 1.0001")  
> or  
>       LINE B is removed
> then it works
>
> btw, i know that the
>                 float my = resolution.y;
>                 if (y <= my) {
> does not make sense, this is just a broken down version to have a crashing code ;)
>
> any ideas?

Yes you may report this shader and example code to Nvidia in combination with the GPU driver version used and they may fix the crash inside their GPU Shader compiler.
Bugs like this one are fixed by installing the latest stable driver from your GPU vendor.

>
>
>
> #ifdef GL_ES
> precision mediump float;
> #endif
>
> uniform vec2 resolution;
> uniform vec2 mouse;
> uniform float time;
>
> void main(void) {
>         vec2 p = 2.0 * (gl_FragCoord.xy / resolution.xy) - 1.0;
>         p.x *= resolution.x / resolution.y;
>
>         float r = 0.0;
>         float g = 0.0;
>         float b = 0.0;
>        
>         const float ni = 9.0;
>         float cw = resolution.x / (ni + 1.0);
>         float ch = 2.0;
>        
>         float x = gl_FragCoord.x;
>         float y = gl_FragCoord.y;
>        
>         for (float i = 1.0; i <= ni; i += 1.0) {
>                 float cx = i * cw + cw / 2.0;
>                 float dx = x - cx;
>                 float my = resolution.y;
>                 if (y <= my) {
>                         float dy = my / resolution.y;
>                         float yy = y / resolution.y;
>                         float ww = (cw / 2.0 - abs(dx)) * 0.1;
>                         float wmul = abs(sin((p.y * 2.0 + 1.0) * ch));              // <<< LINE A
>                         ww *= wmul;                                                           // <<< LINE B
>                         float c = clamp(ww, 0.0, 1.0);
>                         yy = clamp(yy, 0.0, 1.0);
> // r += c * yy;                                                              // <<< LINE C
> // g += c * (1.0 - yy);                                                   // <<< LINE D
>                 }
>         }
>
>         gl_FragColor = vec4(r, g, b, 1.0);
> }
>
>
>
>
> #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x61d81186, pid=2612, tid=4044
> ...
> # C  [nvoglv32.dll+0x2f1186]

The shaders is compiled and in use by your graphicscard driver, if you observe the stack trace you can see that its not the JVM that crash, the crash is from inside your nvidia nvoglv32.dll GPU driver when you driver is exposed to your use case:

All the top C stack frames are from inside your nvoglv32.dll GPU driver.

> Stack: [0x002d0000,0x00320000],  sp=0x003168b8,  free space=282k
> Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
> C  [nvoglv32.dll+0x2f1186]
> C  [nvoglv32.dll+0x3b66ea]
> C  [nvoglv32.dll+0x3b8290]
> C  [nvoglv32.dll+0x3b9d97]
> C  [nvoglv32.dll+0x3b9fee]
> C  [nvoglv32.dll+0x3ba0b8]
> C  [nvoglv32.dll+0x4a8434]
> C  [nvoglv32.dll+0x4f25bf]
> C  [nvoglv32.dll+0x4f4649]
> C  [nvoglv32.dll+0x529342]
> C  [nvoglv32.dll+0x5db213]
> C  [nvoglv32.dll+0x5b33f6]
> C  [nvoglv32.dll+0x5bf246]
> C  [nvoglv32.dll+0x8bac02]  DrvPresentBuffers+0x2b402
> C  [nvoglv32.dll+0x8baf48]  DrvPresentBuffers+0x2b748
> C  [nvoglv32.dll+0x986004]  DrvPresentBuffers+0xf6804
> C  [nvoglv32.dll+0x987446]  DrvPresentBuffers+0xf7c46
> C  [nvoglv32.dll+0x8d3f6e]  DrvPresentBuffers+0x4476e
> C  [nvoglv32.dll+0x8d40b9]  DrvPresentBuffers+0x448b9
> C  [nvoglv32.dll+0x8d41a0]  DrvPresentBuffers+0x449a0
> C  [nvoglv32.dll+0x9876c7]  DrvPresentBuffers+0xf7ec7
> C  [nvoglv32.dll+0x98f35e]  DrvPresentBuffers+0xffb5e
> C  [nvoglv32.dll+0x1c68]
> C  [nvoglv32.dll+0x16fb]
> C  [nvoglv32.dll+0x14a7af]
> C  [nvoglv32.dll+0x992d65]  DrvPresentBuffers+0x103565
> C  [nvoglv32.dll+0x1cb7bf]
> C  [jogl_desktop.dll+0x3543]  Java_jogamp_opengl_gl4_GL4bcImpl_dispatch_1glBegin1__IJ+0xf
> J  jogamp.opengl.gl4.GL4bcImpl.dispatch_glBegin1(IJ)V
> J  jogamp.opengl.gl4.GL4bcImpl.glBegin(I)V
> J  main.Main.display(Ljavax/media/opengl/GLAutoDrawable;)V
> j  jogamp.opengl.GLDrawableHelper.invokeGL(Ljavax/media/opengl/GLDrawable;Ljavax/media/opengl/GLContext;Ljava/lang/Runnable;Ljava/lang/Runnable;)V+83
> J  com.jogamp.newt.opengl.GLWindow.display()V
> j  main.Main.main([Ljava/lang/String;)V+3

Reply | Threaded
Open this post in threaded view
|

Re: Shader crashes JVM

cubus
hi,

changing to VBOs did not solve this problem.
gouessej, where do i find/enable the shader logs, or do you mean the results of glGetShaderInfoLog() / glGetProgramInfoLog()?
both return no error and are empty.

the driver is up to date.
what i don't understand: when running the shader in GLSL Sandbox (http://glsl.heroku.com/) then the same driver is used, isn't it? so why does the same code work there? i'd just like to understand...

anyway, i will report this to nvidia.

Reply | Threaded
Open this post in threaded view
|

Re: Shader crashes JVM

gouessej
Administrator
I meant glGetShaderInfoLog() and glGetProgramInfoLog().

The GLSL sandbox probably uses a different code path, in no way the fact that it crashes in your program proves that there is a bug in JOGL itself.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Shader crashes JVM

Sven Gothel
Administrator
On 03/20/2013 10:37 AM, gouessej [via jogamp] wrote:
> I meant glGetShaderInfoLog() and glGetProgramInfoLog().
>
> The GLSL sandbox probably uses a different code path, in no way the fact that
> it crashes in your program proves that there is a bug in JOGL itself.
Agreed, a shader program shall not crash the process
regardless of erroneous GL commands ..

You can try setting the debug properties:

-Djogl.debug.TraceGL
  trace all GL commands

-Djogl.debug.DebugGL
  exception if GL command fails, also enables the debug extension if available

-Djogl.debug.GLSLCode
  if using our com.jogamp.opengl.util.glsl.ShaderCode,
  this will dump the shader _and_ any compile/linkage problems.
  see our GL2ES2 demos / unit-tests

~Sven



signature.asc (911 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Shader crashes JVM

cubus
This post was updated on .
hi,

On 03/20/2013 10:37 AM, gouessej [via jogamp] wrote:
> I meant glGetShaderInfoLog() and glGetProgramInfoLog().
>
> The GLSL sandbox probably uses a different code path, in no way the fact that
> it crashes in your program proves that there is a bug in JOGL itself.

no, it's not a bug in JOGL, i know ;)
i tried to run the shader in a native (non-JOGL) live coder and it crashes too.

i did run the app in gl-debug mode, and there are no errors.
also the shader compiles without errors/warnings.

the app i am working on is a GL live coder, and i now uploaded it so maybe if you find time, you could try it and see if it works on your systems. that would be great :)

you can download it here

ESCAPE opens the menu
F1 loads the crashing shader
CTRL+ENTER and ALT+ENTER compile

thanks!

EDIT: tested on a friend's machine and it worked without any problems. so it's definitely a problem auf my gfxcard/driver...
Reply | Threaded
Open this post in threaded view
|

Re: Shader crashes JVM

gouessej
Administrator
Thank you for the feedback.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Shader crashes JVM

Xerxes Rånby
This post was updated on .
In reply to this post by cubus
Nice live coder!

You may want to add
Class-Path: gluegen-rt.jar jogl-all.jar vecmath.jar
to the META-INF/MANIFEST.MF
it makes it a bit easier to start the live coder using
java -jar gllivecoder.jar

the "crash.frag" runs fine on my i915 intel desktop here using Ubuntu.

It looks like your code may need some tweaks to be fully mobile OpenGL ES 2 compatible. Post the code on github using a free software license if you want portability improvements.
I first run into a Not a GL2 implementation GLException.
I then later run into an null pointer exception using the AC100 Nvidia tegra2 OpenGL ES 2 driver  at startup
gl.app.GLNEWTApp.reshape(GLNEWTApp.java:197)
try switch all getGL2 in your code to getGL2ES2 to stay OpenGL ES 2 compatible
Reply | Threaded
Open this post in threaded view
|

Re: Shader crashes JVM

cubus
This post was updated on .
thanks a lot for your feedback!

Nice live coder!
thanks :)

You may want to add
Class-Path: gluegen-rt.jar jogl-all.jar vecmath.jar
to the META-INF/MANIFEST.MF
it makes it a bit easier to start the live coder using
java -jar gllivecoder.jar
yes, sorry, i forgot that in an attack of hastiness.

the "crash.frag" runs fine on my i915 intel desktop here using Ubuntu.
ok, so there is no doubt anymore that this is a driver issue.

I first run into a Not a GL2 implementation GLException.
do you have any idea what could have caused this / what it means?

I then later run into an null pointer exception using the AC100 Nvidia tegra2 OpenGL ES 2 driver  at startup
gl.app.GLNEWTApp.reshape(GLNEWTApp.java:197)
this is kinda strange. the only reason for this would be that GLEventListener.reshape() gets called before .init().
i will check for that in the next version.

It looks like your code may need some tweaks to be fully mobile OpenGL ES 2 compatible. Post the code on github using a free software license if you want portability improvements.
try switch all getGL2 in your code to getGL2ES2 to stay OpenGL ES 2 compatible
first i did not plan to make it compatible with ES, but since your post i am trying to do so :)
but there are 2 problems i ran into.

1) when i use getGL2ES2(), how can i use glRotatef() for example?
or should i use getGL2ES2().getGL2().glRotatef()?
EDIT: i had a look into the RawGL2ES2demo and this answers this question.

2) i am using com.jogamp.opengl.util.awt.TextRenderer which does
GL2 gl = GLContext.getCurrentGL().getGL2();
in beginRendering()
would that break the ES compatibility again or am i missunderstanding this completely?

sorry, but i am a little bit clueless about that...

thanks again for your feedback!
Reply | Threaded
Open this post in threaded view
|

Re: Shader crashes JVM

Sven Gothel
Administrator
On 03/21/2013 07:59 PM, cubus [via jogamp] wrote:
> thanks a lot for your feedback!
>
>     Nice live coder!
>
> thanks :)

What is it ? Where is the source code and what is it's license ?

~Sven



signature.asc (911 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Shader crashes JVM

cubus
Sven Gothel wrote
On 03/21/2013 07:59 PM, cubus [via jogamp] wrote:
> thanks a lot for your feedback!
>
>     Nice live coder!
>
> thanks :)

What is it ? Where is the source code and what is it's license ?

~Sven
it's a shader live coding tool with audio and mouse input. something like shadertoy.
i did not think about releasing the source and license yet, but it will be free and it's just a fun project...

i will clean it up a little, fix the classpath issues, and post a link later. for now you can download it here.


Reply | Threaded
Open this post in threaded view
|

Re: Shader crashes JVM

Xerxes Rånby
If you have a nice live-coder you can create live audio-visual programming like this:
http://vimeo.com/51993089

I would be happy to be able to run this live coder on the Rasberry Pi that is an OpenGL ES 2 device.
Reply | Threaded
Open this post in threaded view
|

Re: Shader crashes JVM

cubus
Xerxes Rånby wrote
If you have a nice live-coder you can create live audio-visual programming like this:
http://vimeo.com/51993089
this is already possible with the current version ;)
just enable your soundcard to forward it's output to it's input and use

audio.lo
audio.hi

or

audiospec (experimental)

in the shader.

I would be happy to be able to run this live coder on the Rasberry Pi that is an OpenGL ES 2 device.
soon ;)
Reply | Threaded
Open this post in threaded view
|

Re: Shader crashes JVM

cubus
updated version can be downloaded here

enjoy ;)


Reply | Threaded
Open this post in threaded view
|

Re: Shader crashes JVM

Sven Gothel
Administrator
In reply to this post by cubus
On 03/21/2013 08:23 PM, cubus [via jogamp] wrote:

>     Sven Gothel wrote
>     On 03/21/2013 07:59 PM, cubus [via jogamp] wrote:
>     > thanks a lot for your feedback!
>     >
>     >     Nice live coder!
>     >
>     > thanks :)
>
>     What is it ? Where is the source code and what is it's license ?
>
>     ~Sven
>
> it's a shader live coding tool with audio and mouse input. something like
> shadertoy.
> i did not think about releasing the source and license yet, but it will be
> free and it's just a fun project...
Thank you and sorry for being anal here, since I don't like
to test/discuss software for free - if it's not free software.

If your software becomes free, i.e. one of the many free licenses (FSF),
I would love to test it.

Regardless, if you have a [little] website representing your software,
I like to add your link on JOGL.

Note: If your software if free, and you cannot host, you can host
on jogamp.org.

I think the live editing/coding feature, when done nice,
is something which takes away some 'resistance' for some folks,
even if they can crash their JVM :)

Looking forward to your [more] comprehensive presentation.

~Sven


signature.asc (911 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Shader crashes JVM

xinaesthete
In reply to this post by gouessej
The code path for WebGL is more different than you might imagine, depending on the platform... for example, by default on Windows Chrome, AFAIK Angleproject is used to translate the calls to DX9 https://code.google.com/p/angleproject/

Note that Google will not just send your programs straight to the GPU driver even when not using Angle, in order to try to alleviate the security concerns of web pages being able to do such arbitrary low level things... the risk of something like this happening is the excuse MS use for not implementing WebGL, and it's not totally spurious.

I've also seen a fair few JVM crashes in JOGL programmes but don't recall anything I'd attribute directly to the JOGL library.

Live coding tools are relevant to my interests, I'll check it out. FWIW, we monitor our shader source code folder for changes at runtime and recompile when appropriate in order to facilitate rapid prototyping without building a live coding tool per-se.