RenderDoc - how?

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

RenderDoc - how?

imakerobots
This post was updated on .
Hey all.  I'm running jogamp 2.5.0 in my app.  Because of a visual glitch, people suggested I run RenderDoc to capture frames and analyze what's going on under the hood.

RenderDoc says it won't help me because of calls to unsupported functions glPushClientAttrib and glPopClientAttrib.  I have searched my code base and find neither call.  I also don't find anything ending in *ClientAttrib or starting with glPush* or glPop*.  Is it possible this call is in jogamp 2.5.0?  How do I make this work?

The profile being created on my system is GL4bc.

Thank you!

Screenshot_2023-10-12_081223.png
Screenshot_2023-10-12_081414.png
Reply | Threaded
Open this post in threaded view
|

Re: RenderDoc - how?

gouessej
Administrator
Which third party dependencies do you use except JogAmp?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: RenderDoc - how?

imakerobots
commons-io:commons-io:2.11.0
ch.qos.logback:logback-classic:1.4.7
com.fasterxml.jackson.core:jackson-annotations:2.15.2
com.fasterxml.jackson.core:jackson-databind:2.15.2
com.github.sarxos:webcam-capture:0.3.12
com.google.code.gson:gson:2.10.1
com.jcraft:jsch:0.1.55
com.squareup.okhttp3:okhttp:4.10.0
com.vladsch.flexmark:flexmark-all:0.64.8
io.github.classgraph:classgraph:4.8.161
io.github.java-native:jssc:2.9.4
javax.vecmath:vecmath:1.5.2
org.apache.xmlgraphics:batik-all:[1.14,)
org.assertj:assertj-swing-junit:3.17.1
org.eclipse.jgit:org.eclipse.jgit:6.5.0.202303070854-r
org.jetbrains:annotations:24.0.1
org.jogamp.gluegen:gluegen-rt-main:2.5.0
org.jogamp.jogl:jogl-all-main:2.5.0
org.joml:joml:1.10.5
org.json:json:20230227
org.junit.jupiter:junit-jupiter:5.10.0
org.ode4j:core:0.4.2
org.slf4j:slf4j-api:2.0.5
Reply | Threaded
Open this post in threaded view
|

Re: RenderDoc - how?

gouessej
Administrator
Which canvas do you use in JOGL? GLCanvas? GLJPanel? GLWindow?

The problem is that anyway you won't be able to get rid of those calls.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: RenderDoc - how?

imakerobots
Currently it's a GLJPanel.

Wait... there are ZERO ways to avoid those calls, regardless of canvas?
Reply | Threaded
Open this post in threaded view
|

Re: RenderDoc - how?

gouessej
Administrator
There's a shader used to flip the pixels more or less, maybe glPushClientAttrib and glPopClientAttrib are used to save and restore some attributes in this case. Please can you try with a GLCanvas and let me know if it changes something? We're not responsible for RenderDoc's limitations.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: RenderDoc - how?

imakerobots
I replaced GLJPanel with GLCanvas and this happened.  Google/ChatGPT have not helped me resolve the issue.
Switching the FPSAnimator to Animator did not help.
using default Profile and Capabilities did not help.
The exception happens somewhere after I start the animator and before display() is called.

09:45:29.052 [AWT-EventQueue-0] INFO  c.m.r.renderpanel.OpenGLRenderPanel - GLProfile.glAvailabilityToString() = Natives[GL4bc true [4.6 (Compat profile, arb, compat[ES2, ES3], FBO, hardware)], GL4 true [4.6 (Core profile, arb, compat[ES2, ES3], FBO, hardware)], GLES3 false, GL3bc true [4.6 (Compat profile, arb, compat[ES2, ES3], FBO, hardware)], GL3 true [4.6 (Core profile, arb, compat[ES2, ES3], FBO, hardware)], GL2 true [4.6 (Compat profile, arb, compat[ES2, ES3], FBO, hardware)], GLES2 false, GLES1 false, count 5 / 8], Common[, GL4ES3 true, GL2GL3 true, GL2ES2 true, GL2ES1 true], Mappings[GL3bc GLProfile[GL3bc/GL4bc.hw], GL2ES1 GLProfile[GL2ES1/GL4bc.hw], GL4ES3 GLProfile[GL4ES3/GL4.hw], GL2ES2 GLProfile[GL2ES2/GL4.hw], GL4bc GLProfile[GL4bc/GL4bc.hw], GL2 GLProfile[GL2/GL4bc.hw], GL4 GLProfile[GL4/GL4.hw], GL3 GLProfile[GL3/GL4.hw], GL2GL3 GLProfile[GL2GL3/GL4bc.hw], , default GLProfile[GL4bc/GL4bc.hw], count 9 / 12]

09:45:29.052 [AWT-EventQueue-0] INFO  c.m.r.renderpanel.OpenGLRenderPanel -
        GLCapabilities capabilities = new GLCapabilities(GLProfile.getMaxProgrammable(true));
        capabilities.setHardwareAccelerated(GraphicsPreferences.hardwareAccelerated.get());
        capabilities.setBackgroundOpaque(GraphicsPreferences.backgroundOpaque.get());
        capabilities.setDoubleBuffered(GraphicsPreferences.doubleBuffered.get());
        capabilities.setStencilBits(8); = rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/8/4, sample-ext default, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]

09:45:29.052 [AWT-EventQueue-0] INFO  c.m.r.renderpanel.OpenGLRenderPanel - create canvas
09:45:29.074 [AWT-EventQueue-0] DEBUG c.m.r.renderpanel.OpenGLRenderPanel - starting animation system

Exception in thread "AWT-EventQueue-0" com.jogamp.opengl.GLException: Unable to determine GraphicsConfiguration: WindowsWGLGraphicsConfiguration[DefaultGraphicsScreen[WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[obj 0x66f1395f]], idx 1], pfdID 80, ARB-Choosen true,
        requested GLCaps[rgba 8/8/8/1, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/8/4, sample-ext default, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
        chosen    GLCaps[wgl vid 80 arb: rgba 8/8/8/8, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/8/4, sample-ext default, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]]
        at jogl.all@2.5.0/jogamp.opengl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationImpl(WindowsAWTWGLGraphicsConfigurationFactory.java:182)
        at jogl.all@2.5.0/com.jogamp.nativewindow.GraphicsConfigurationFactory.chooseGraphicsConfiguration(GraphicsConfigurationFactory.java:424)
Reply | Threaded
Open this post in threaded view
|

Re: RenderDoc - how?

gouessej
Administrator
I don't want to be harsh but don't expect too much from ChatGPT.

This exception is familiar to me. Do you use the right "--add-opens" and "--add-exports" clause?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: RenderDoc - how?

Sven Gothel
Administrator
In reply to this post by gouessej
gouessej wrote
There's a shader used to flip the pixels more or less, maybe glPushClientAttrib and glPopClientAttrib are used to save and restore some attributes in this case. Please can you try with a GLCanvas and let me know if it changes something? We're not responsible for RenderDoc's limitations.
Yup!
Property "jogl.gljpanel.noglsl" can disable this performance feature.
We could also think about adding a runtime flag, i.e. a setter - if so desired.
Personally, GLJPanel is a low prio to me of course.
Reply | Threaded
Open this post in threaded view
|

Re: RenderDoc - how?

gouessej
Administrator
Yes a setter would help so that I can set this flag per panel only when it's really needed.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: RenderDoc - how?

Sven Gothel
Administrator

jogl commit d6cf89f22a5926b437c4430eb166972d90fd92be

    GLJPanel: Allow disabling GLSL vertical flip programmatically via setUseGLSLVerticalFlip(false) in addition to property 'jogl.gljpanel.noglsl'
   
    Suche setting would enable the slow path of flipping a potentially 'big' framebuffer via the CPU.
   
    The best performance path is using the GLSL shader to vertically flip the FBO,
    or - w/o using the shader - to render the GL scene vertically-flipped and set the flag 'flipVertical' to false.
    - property "jogl.gljpanel.noverticalflip"
    - setter setSkipGLOrientationVerticalFlip(boolean)
      If set to <code>true</code>, user needs to flip the OpenGL rendered scene
      if {@link #isGLOriented()} == true, e.g. via the projection matrix.<br/>
      See constraints of {@link #isGLOriented()}.
Reply | Threaded
Open this post in threaded view
|

Re: RenderDoc - how?

Sven Gothel
Administrator
Note: Not tested .. but should work.
Reply | Threaded
Open this post in threaded view
|

Re: RenderDoc - how?

imakerobots
In reply to this post by gouessej
I wasn't aware I needed special run time flags.  here's my current module-info.java

module com.marginallyclever.robotoverlord {
        requires transitive java.desktop;
        requires transitive java.prefs;
        requires transitive java.logging;
        requires org.apache.commons.io;
        requires com.fasterxml.jackson.core;
        requires com.fasterxml.jackson.annotation;
        requires com.fasterxml.jackson.databind;
        requires org.json;
        requires org.slf4j;
        requires flexmark;
        requires okhttp3;
        requires com.google.gson;
        requires org.eclipse.jgit;
        requires org.joml;
        requires jogl.all;
       
        requires vecmath;
        requires jsch;
        requires org.jetbrains.annotations;
        requires jssc;
        requires batik.all;
        requires xml.apis.ext;
        requires java.datatransfer;
        requires core;
        requires flexmark.util.ast;
        requires webcam.capture;
Reply | Threaded
Open this post in threaded view
|

Re: RenderDoc - how?

gouessej
Administrator
You should use at least " --add-opens java.desktop/sun.awt=ALL-UNNAMED --add-opens java.desktop/sun.awt.windows=ALL-UNNAMED --add-opens java.desktop/sun.java2d=ALL-UNNAMED" under Windows, replace "ALL-UNNAMED" by the module name in your case ("jogl.all"?). There are some equivalent syntaxes to put such things into module-info.java ("open module", "opens" + "to") but I don't know if you can do that in your own module.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: RenderDoc - how?

imakerobots
This post was updated on .
I have tried adding the line

--add-opens java.desktop/sun.awt=jogl.all --add-opens java.desktop/sun.awt.windows=jogl.all --add-opens java.desktop/sun.java2d=jogl.all

as a command line like so

D:\GitHub\robot-overlord-app\target>java --add-opens java.desktop/sun.awt=jogl.all --add-opens java.desktop/sun.awt.windows=jogl.all --add-opens java.desktop/sun.java2d=jogl.all -jar RobotOverlord-2.10.0-with-dependencies.jar

and the app runs.  With GLCanvas, I no longer get the "gl*ClientAttrib" problem in Renderdoc.

So "com.jogamp.opengl.GLException: Unable to determine GraphicsConfiguration" is caused by a modules permission problem?  

I can't distribute my app with mandatory command line arguments, the users will never understand.  
Reply | Threaded
Open this post in threaded view
|

Re: RenderDoc - how?

gouessej
Administrator
Thank you for your feedback. Keep in mind that I'm trying to solve your problem step by step. Your latest reply confirms the root cause and a possible (perfectible) fix.

I agree with you, those command line arguments aren't very user-friendly. By the way, distributing your software as a JAR is a bad idea anyway as it requires to install a compatible Java Runtime Environment on the operating system, which few end users do nowadays but we can try to solve your current problem before going further. Have you tried my suggestions about module-info.java? If it worked, you wouldn't need any other command line arguments.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: RenderDoc - how?

imakerobots
I was unable to find an "opens" command that would correctly fix the problem.  IntelliJ insisted that it could not open java.desktop or sun packages for jogl.all.

Yes, I have used `opens` and `exports` module commands before, but only for my packages to other apps.
Reply | Threaded
Open this post in threaded view
|

Re: RenderDoc - how?

gouessej
Administrator
JogAmp itself needs to be turned into a full module with the right "opens" and "exports" clauses as I have found no mean of opening a package of a module to another module, "opens" refers to a package belonging to the module designated by the directive.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: RenderDoc - how?

Sven Gothel
Administrator
I like to point to our discussion https://forum.jogamp.org/Exception-No-shader-code-found-tp4042834p4042883.html
with fmorat, Julien and myself.

Making our jar files a dual-use jar / module,
which shall resolve all these issues.

TODO: Adding a module-info.java into our jar files, i.e. jogamp-fat.jar
Reply | Threaded
Open this post in threaded view
|

Re: RenderDoc - how?

hharrison
In reply to this post by gouessej
I believe this is by design, why enforce reflection boundaries if loaded modules can just declare they want to open a hole for reflection. The enforced opens on the command line is explicitly in the user's face that they are weakening the encapsulation of the modules....no opinion on whether or not this is a good idea, just my understanding of the current situation and why they isn't a mechanism for modules to open up other modules in this way.

Harvey
12