aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/x11
Commit message (Collapse)AuthorAgeFilesLines
* X11GLXContext: Remove redundant manual aliasing of ext. names in ↵Sven Gothel2013-07-171-10/+0
| | | | isExtensionAvailable() - impl. uses a mapping.
* Fix OSX GL-core lack of pbuffer: GLDrawableFactory.canCreateGLPbuffer(..) ↵Sven Gothel2013-07-171-2/+2
| | | | | | add GLProfile argument, similar to canCreateFBO(..) In case a compatible non-core profile is requests, canCreateGLPbuffer(..) returns false on OSX.
* Add Support for GL 4.3 (Bug 716) and ES 3.0 (Bug 717)Sven Gothel2013-07-151-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ES3 / GL4.3: - Update all EGL, GLX, WGL and GL (desktop and mobile) khronos headers to latest version. - GL3/gl3* -> GL/glcorearb* - Explicitly preserve ES2_compatibility and ES3_compatibility in header, most extension grouping was removed in new headers. - Always load all GLHeader to ensure proper extension association across all profiles. - Unified method signatures - Added GL_EXT_map_buffer_range to core - Using common 'glMapBufferImpl(..)' for all glMapBuffer(..) and glMapBufferRange(..) impl. - Init necessary fields of GL instances via 'finalizeInit()' called by reflection, if exist. This allows removing initialization checks, i.e. for all buffer validations. - BuildStaticGLInfo: Can handle new GL header structure, i.e. one CPP extenstion block incl. define + funcs. - GLJavaMethodBindingEmitter: Simply print the - No GL duplication due to new intermediate interfaces, see below - OO lineare inheritance (Added GL2ES3, GL3ES3 and GL4ES3 intemediates): GLBase - GL - GL2ES2 - GLES2 GLBase - GL - GL2ES2 - GL2GL3 - [ GL2, GL3 ] GLBase - GL - GL2ES2 - GL2ES3 - GL3ES3 - [ GL3 ] GLBase - GL - GL2ES2 - GL2ES3 - GL3ES3 - GL4ES3 - [ GLES3, GL4, .. ] - Expose 'usable' intermediate interfaces GL3ES3 and GL4ES3 in GLBase/GLProfile/GLContext via is*() and get*(). - GLContext*: - isGL3core() is true if [ GL4, GL3, GLES3 ] (added GLES3) - Added ctxProfile argument to allow handling ES versions: - getMaxMajor(..), getMaxMinor(..), isValidGLVersion(..) and decrementGLVersion(..) - mapGLVersions(..) prepared for ES ARB/KHR validation - EGLContext checks ES3 (via old ctx's GL_VERSION) - ExtensionAvailabilityCache adds GL_ES_Version_X_Y for ES. - Prelim tests w/ Mesa 9.1.3 GL Version 3.0 (ES profile, ES2 compat, ES3 compat, FBO, hardware) - OpenGL ES 3.0 Mesa 9.1.3 [GL 3.0.0, vendor 9.1.3 (Mesa 9.1.3)] - TODO: - Use KHR_create_context in EGLContext.createContextARBImpl(..) - More tests (Mobile, ..) +++ Misc: - GLContext*: - Complete glAllocateMemoryNV w/ glFreeMemoryNV.
* Security: Apply security changes from GlueGenSven Gothel2013-06-212-14/+21
| | | | | | | | | GlueGen related commits - 23341a2df2d2ea36784a16fa1db8bc7385351a12 - 2d8e25398e929f553c4524e9c57f083d90ba4e08 - 8cabcd2de8b46c42dffcaaf46ccc2dc4d092ebba - f69831574d4927d03d40c330d0b047d8c89622a4 - eb842815498f5926828b49c48fffce22fc9586a2
* GLDynamicLibraryBundleInfo.shallLinkGlobal(): Defaults to 'true' now, ↵Sven Gothel2013-06-181-9/+0
| | | | | | | | allowing to remove specialized values. - Windows always used global - The OpenGL library is always available by all processes system wide. - Tested on OSX (was using local, previously).
* Fix GLX: X11GLXContext used wrong FBConfig n/a query; X11GLX*: If FBConfig ↵Sven Gothel2013-05-063-5/+22
| | | | is n/a force GLX (server) version down to 1.1 to avoid crashes w/ old GLX server (i.e. Mesa 4.*).
* Simplify GLDrawableFactory's SharedResource Query Methods; Move ↵Sven Gothel2013-04-263-38/+13
| | | | | | | | | | | | | | | | | | | | | | | | WindowsWGLDrawableFactory Quirks to GLRendererQuirks (NeedCurrCtx4ARBPixFmtQueries, NeedCurrCtx4ARBCreateContext); Bug 706: Confine NeedCurrCtx4ARBCreateContext to [Windows, ATI, driver < 12.102.3); Avoid possible NPE @ GLContext.getGLVendorVersionNumber() - Simplify GLDrawableFactory's SharedResource Query Methods - Moving common methods to GLDrawableFactory/GLDrawableFactoryImpl while reusing common methods to SharedResourceRunner.Resource. - All factories SharedResources impl. SharedResourceRunner.Resource. - Move WindowsWGLDrawableFactory Quirks to GLRendererQuirks (NeedCurrCtx4ARBPixFmtQueries, NeedCurrCtx4ARBCreateContext) - For better maintenance, move the mentioned quirks from the windows factory to our common place, being detected within GLContextImpl after each context creation. - Bug 706: Confine NeedCurrCtx4ARBCreateContext to [Windows, ATI, driver < 12.102.3) - Before we added this quirk if [Windows, ATI], however, we have hopes that the new drivers will suffice for all as tested successful on my test machine (AMD Radeon HD 6300M Series, amd_catalyst_13.5_mobility_beta2). - Avoid possible NPE @ GLContext.getGLVendorVersionNumber() - GLContext.getGLVendorVersionNumber() never returns 'null' but a zero version instance instead! - Add API doc. - Use mixed case names in GLContextImpl.setRendererQuirks(..).
* Fix Bug 706 and Bug 520: Certain ATI GPU/driver require a current context ↵Sven Gothel2013-04-251-7/+7
| | | | | | | | when calling wglCreateContextAttribsARB (Windows) See discussion at https://jogamp.org/bugzilla/show_bug.cgi?id=520 https://jogamp.org/bugzilla/show_bug.cgi?id=706
* X11GLXContext: Issue XSync(..) after forcing X11ErrorHandle and before ↵Sven Gothel2013-04-231-0/+2
| | | | | | | glXCreateContextAttribsARB(..) - Mitigate driver bugs Ensures the error handler is in place and previous X11 cmds are being executed before the 'critical' glXCreateContextAttribsARB(..) call which might lead to erroneous behavior w/ buggy drivers.
* Bug 718: WindowsBitmapWGLDrawable: Requires GLProfile.GL2, fix BITMAP GLCaps ↵Sven Gothel2013-04-181-24/+28
| | | | | | | | | ASAP at Ctor instead of setRealized(true); WindowsWGLContext: Exclude ARB creation for BITMAP Unit Test TestGLAutoDrawableFactoryGLnBitmapCapsNEWT added using BITMAP on GLProfile.getDefault() Also: X11GLXContext, WindowsWGLContext: Cleanup formatting in createImpl(..)
* Fix Bug 720: Unify all platform specific GLContextImpl specializations; Fix ↵Sven Gothel2013-04-189-231/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 719 - Windows BITMAP Offscreen Orientation is not propagated through API Fix Bug 719 - Windows BITMAP Offscreen Orientation is not propagated through API Depends on Bug 720, since cleaning up GLContextImpl* is required to move property 'GLContext.isGLOrientationFlippedVertical()' to 'GLDrawable.isGLOriented()' where it belongs! Windows BITMAP GLDrawable impl. isGLOriented() shall return false, while we keep the BITMAPINFOHEADER's height field negative to remove the need for vertical flip when used w/ AWT or Windows, .. Then property 'GLDrawable.isGLOriented()' has to be recognized throughout the utility functions, i.e. TextureData's mustFlipVertically and hence TextureIO writer. Fix Bug 720: Unify all platform specific GLContextImpl specializations GLContextImpl shall have only _one_ unique platform derivative to allow proper swapping of GLDrawables of any type via: - 'GLAutoDrawable.setContext(GLContext newCtx, boolean destroyPrevCtx)', which calls - 'GLContext.setGLDrawable(GLDrawable readWrite, boolean setWriteOnly)' Exception: External context may be specialized. All drawable specific property handling shall be provided and implemented (if possible) via GLDrawable specializations. - GLContext.isGLOrientationFlippedVertical() -> GLDrawable.isGLOriented() - PNGImage.createFromData() takes 'isGLOriented' to properly handle vertical flipping simply by line ordering - TextureIO's PNG writer passes TextureData's getMustFlipVertically() as isGLOriented to PNGImage.createFromData() - GLReadBufferUtil respects GLDrawable's isGLOriented() when creating TextureData instance. - Screenshot respects GLDrawable's isGLOriented() - Screenshot is deprecated, use GLReadBufferUtil. - Removed all PBuffer attributes, i.e. floatingPoint, RenderToTexture and RenderToTextureRectangle. - Allows removal of special pbuffer handling in GLContext* implementations. - Removed also from GLCapabilities* - Removed from deprecated GLPbuffer Impact: - Low, users who desire to render into a texture shall use our FBO GLOffscreenDrawable. - Only use case was the deprecated GLPbuffer - floating point framebuffer technology is still patented anyways :) - Removed Java2DGLContext, which was only used for OSX's GLJPanel Java2D bridge, which is no more supported anyways.
* Fix Bug 705 - Cleanup & Generalize Commit ↵Sven Gothel2013-04-161-0/+5
| | | | | | | | | | | | | | | | | | | | | | | 5b47372590ec715647ebbd75d70c41ec7a64485a ; Close X11 Display in isDeviceSupported() - Moved GL vendor version parsing to GLVersionNumber - Moved X11Util.markAllDisplaysUnclosable() trigger into SharedResource creation of - X11GLXDrawableFactory - EGLDrawableFactory - GLProfile is back to pre 5b47372590ec715647ebbd75d70c41ec7a64485a, i.e. contains no quirk artifact (clean) - Close X11 Display in X11GLXDrawableFactory.isDeviceSupported() Regression of 9a4fcc7ea4ec61e4ceed791acced734ac04ea270 - TODO: Remove X11Util markAllDisplaysUnclosable detection code ? Notes to Martin: - Use TAB == 4 SPACES - No author names into source code, git commit log is enough. - No need to tag your edits, the diff is enough.
* GLDrawable: Refine API doc; GLDrawableImpl: Balance ↵Sven Gothel2013-04-101-2/+2
| | | | | | | | | | | | | | | | | | createHandle()/destroyHandle(); Handle LOCK_SURFACE_CHANGED in lockSurface() ; GLContextImpl.makeCurrent(): Fix drawable handle validation. GLDrawable: Refine API doc (realized/handle) - Lifecycle of the drawable handle was not clear - Ephasizing handle's dependency on NativeSurface's lock state and drawable's realization GLDrawableImpl: Balance createHandle()/destroyHandle() - updateHandle() -> createHandle() - ensure both are balance, see below GLDrawableImpl: Handle LOCK_SURFACE_CHANGED in GLDrawableImpl's lockSurface() - call destroyHandle() and createHandle() GLContextImpl.makeCurrent(): Validate drawable handle if realized only. - it is valid to have an invalid drawable handle if not realized (see above)
* Debug Messages: Unify getThreadName() usage and 'Catched Exception' messagesSven Gothel2013-04-101-1/+1
|
* Complete 9a4fcc7ea4ec61e4ceed791acced734ac04ea270: ↵Sven Gothel2013-03-271-3/+0
| | | | SharedResourceRunner.Impl.createSharedResource(..): isGLXAvailableOnServer(..) call redundant since checked upfront at isDeviceSupported(..)
* SharedRessourceRunner: Add isDeviceSupported(..) query before spawn off ↵Sven Gothel2013-03-271-0/+16
| | | | thread, allowing a more gracefull detection of n/a GLX on X11
* *External*Context Impl: Remove unused 'lastContext' field, incl. their ↵Sven Gothel2013-03-131-20/+0
| | | | | | | makeCurrent() and release() override. Semantics of 'lastContext' are plain wrong, since release() override does claim the previous 'lastContext' is current at the end - however, it wasn't technically made current.
* X11/WGL: Better Exception Message for failed ARB context creation if profile ↵Sven Gothel2013-02-161-1/+1
| | | | > GL2 (OpenGL >= 3.0.1) was requested.
* GLContext: *TRACE_SWITCH spacingSven Gothel2013-02-111-1/+1
|
* [EGL/X11]Context: Enhance DEBUG output for failed makeCurrentImpl(..)Sven Gothel2013-01-261-2/+7
|
* Fix Bug 669: Recursive GLContext makeCurrent()/release()Sven Gothel2013-01-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | Culprit: GLContext's makeCurrent() didn't clear the boolean flag 'unlockContextAndSurface' in case the context is already current (-> recursion). Above case was detected within a code block tailed by a finally block, which acted on mentioned flag, i.e. called lock.unlock() and hence decremented the lock count even though the method return w/ successful state. Fixed. Added debug code: GLContext.release() debug code (DEBUG | TRACE_SWITCH), recording stack trace of last release() call, which is dumped in case no current was current. Added 2 unit tests: - Simple recursive GLContext makeCurrent()/release() from within GLEventListener's display(). Test also validates lock count and lock ownership. - GLAutoDrawable display() of another GLAutoDrawable from within GLEventListener's display(..).
* *Drawable impl. DEBUG: Add getThreadName() to debug out.Sven Gothel2012-12-223-5/+9
|
* GLContextImpl: Make createContextARBImpl/setGLFunctionAvailability more ↵Sven Gothel2012-12-212-3/+3
| | | | robost while detecting erroneous queried GL version
* Cleanup GLContext special entries: getOffscreenContextPixelDataType(), ↵Sven Gothel2012-12-152-30/+1
| | | | | | | | | | | | | | | | | | | | | | | getOffscreenContextReadBuffer(), .. ; Add GLFBODrawable API entries for multi buffering (no impl. yet); GLJPanel 1st simplification using offscreen drawable - Cleanup GLContext special entries: getOffscreenContextPixelDataType(), getOffscreenContextReadBuffer(), .. ; - add: getDefaultReadBuffer() (-> exposed via GLBase as well) - add: isGLOrientationFlippedVertical() - add: getDefaultPixelDataType() - removed impl: getOffscreenContextPixelDataType() - removed impl: getOffscreenContextReadBuffer() - removed impl: offscreenImageNeedsVerticalFlip() - Add GLFBODrawable API entries for multi buffering (no impl. yet); - TODO: Add implementation code in GLFBODrawableImpl - GLJPanel 1st simplification using FBO - Use above new GL/GLContext entries - Fix: getNativeSurface() and getHandle() - TODO: - Remove distinction of 'pbuffer' and 'software', - Use GLDrawableFactory.createOffscreenDrawable(..) - Use GL for FBO swapping
* GLX/GLXExt Robustness: Use NIODirectOnly for all bindings. For these ↵Sven Gothel2012-10-308-159/+185
| | | | internal APIs, critical array is not required, hence redundant.
* NativeWindowFactory: Remove 'remedy' of Bug 613 Commit ↵Sven Gothel2012-10-021-16/+4
| | | | | | 92398025abdabb2fdef0d78edd41e730991a6f94 GlobalToolkitLock for create/destroy Turns out on it has no effect and ATI prop. driver still has XCB failures at this point.
* Relax Bug 613 workaround of commit 92398025abdabb2fdef0d78edd41e730991a6f94Sven Gothel2012-10-023-32/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | Utilizing a GlobalToolkitLock in general to lock the display connection results in deadlock situations where locked surfaces signal other [offscreen] surfaces to render. We have to see whether we find a better solution, for now sporadic XCB assertion still happen. But it is preferrable to point to the root cause, then to jumping through hoops to complicate locking or even to deadlock. Locking: - X11GLXGraphicsConfigurationFactory add missing device locking in: - getAvailableCapabilities - chooseGraphicsConfigurationStatic - Newt/X11Window: Discard display events after window close. Relax ATI XCB/threading bug workaround: - ToolkitProperties: requiresGlobalToolkitLock() -> hasThreadingIssues() - NativeWindowFactory: Don't use GlobalToolkitLock in case of 'threadingIssues' the impact is too severe (see above) - NativeWindowFactory: Add getGlobalToolkitLockIfRequired(): To be used for small code blocks. If having 'threadingIssues' a GlobalToolkitLock is returned, otherwise NullToolkitLock. - X11GLXContext: [create/destroy]ContextARBImpl: Use 'NativeWindowFactory.getGlobalToolkitLockIfRequired()' for extra locking Misc Cleanup: - *DrawableFactory createMutableSurface: Also create new device if type is not suitable - *DrawableFactory createDummySurfaceImpl: Pass chosenCaps and use it (preserves orig. requested user caps)
* Workaround for Bug 623: Sporadic XCB assertion failures w/ ATI proprietary ↵Sven Gothel2012-09-301-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | driver and w/o native X11 locking The proprietary ATI X11 driver does not handle multi-threaded [GL] clients well, i.e. triggers an XCB assertion 'from time to time'. It almost seems like that the driver either: - aliases all display connections to it's connection name, i.e. server; or - utilizes a build-in display connection w/o locking, used for some reason +++ - X11Lib: Add QueryExtension(dpy, name) allowing early driver determination w/o GL - X11Util detects 'requiresGlobalToolkitLock' and 'markAllDisplaysUnclosable' via X11 extensions. In case certain ATI extensions are available, both are set to true. - X11GLXDrawableFactory: Dropped setting 'markAllDisplaysUnclosable', using X11Util's detection (see above). - New GlobalToolkitLock to satisfy certain driver restrictions (ATI's XCB multithreading bug) - NativeWindowFactory handles new property requiresGlobalToolkitLock, in which case the new GlobalToolkitLock is being used instead of ResourceToolkitLock. - JAWTUtil ToolkitLock locks GlobalToolkitLock 1st to match new 'requiresGlobalToolkitLock' property. - Document static method requirement of X11Util, GDIUtil and OSXUtil via marker interface ToolkitProperties - ToolkitLock: New method 'validateLocked()', allowing use to validate whether the device/toolkit is properly locked and hence to detect implementation bugs. See unit test class: ValidateLockListener
* Misc X11: Add GLX_MESA_swap_control; GLXExtensions (private); X11GLXContext ↵Sven Gothel2012-09-291-15/+34
| | | | commented out GLX_MESA_swap_control; native test of Mesa context-retarget bug, cannot reproduce yet.
* Adding Mesa Quirk 'NoSetSwapIntervalPostRetarget': SIGSEGV on ↵Sven Gothel2012-09-281-1/+0
| | | | | | | | | | | | setSwapInterval() after changing the context's drawable w/ 'Mesa 8.0.4' dri2SetSwapInterval/DRI2 (soft & intel) Analyzing 'TestGLContextDrawableSwitchNEWT' crash at setSwapInterval -> dri2SetSwapInterval after retargeting the context (new drawable association). Turns out Mesa's dri2SetSwapInterval may have a bug. +++ GLContext TRACE_SWITCH: Add drawable handle to debug/trace output.
* GLXUtil: Lock X11 DeviceSven Gothel2012-09-283-48/+98
|
* Fix Bug 616: X11: Remove XInitThreads() dependency while cleaning up device ↵Sven Gothel2012-09-272-38/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | locking, resulting in a native-lock-free impl. The X11 implementation details of NativeWindow and NEWT used the X11 implicit locking facility XLockDisplay/XUnlockDisplay, enabled via XInitThreads(). The latter useage is complicated within an unsure environment where the initialization point of JOGL is unknown, but XInitThreads() requires to be called once and before any other X11 calls. The solution is simple and thorough, replace native X11 locking w/ 'application level' locking. Following this pattern actually cleans up a pretty messy part of X11 NativeWindow and NEWT, since the generalization of platform independent locking simplifies code. Simply using our RecursiveLock also speeds up locking, since it doesn't require JNI calls down to X11 anymore. It allows us to get rid of X11ToolkitLock and X11JAWTToolkitLock. Using the RecursiveLock also allows us to remove the shortcut of explicitly createing a NullToolkitLocked device for 'private' display connections. All devices use proper locking as claimed in their toolkit util 'requiresToolkitLock()' in X11Util, OSXUtil, .. Further more a bug has been fixed of X11ErrorHandler usage, i.e. we need to keep our handler alive at all times due to async X11 messaging behavior. This allows to remove the redundant code in X11/NEWT. The AbstractGraphicsDevice lifecycle has been fixed as well, i.e. called when closing NEWT's Display for all driver implementations. On the NEWT side the Display's AbstractGraphicsDevice semantics has been clarified, i.e. it's usage for EDT and lifecycle operations. Hence the X11 Display 2nd device for rendering operations has been moved to X11 Window where it belongs - and the X11 Display's default device used for EDT/lifecycle-ops as it should be. This allows running X11/NEWT properly with the default usage, where the Display instance and hence the EDT thread is shared with many Screen and Window. Rendering using NEWT Window is decoupled from it's shared Display lock via it's own native X11 display. Lock free AbstractGraphicsDevice impl. (Windows, OSX, ..) don't require any attention in this regard since they use NullToolkitLock. Tests: ====== This implementation has been tested manually with Mesa3d (soft, Intel), ATI and Nvidia on X11, Windows and OSX w/o any regressions found in any unit test. Issues on ATI: ============== Only on ATI w/o a composite renderer the unit tests expose a driver or WM bug where XCB claims a lack of locking. Setting env. var 'LIBXCB_ALLOW_SLOPPY_LOCK=true' is one workaround if users refuse to enable compositing. We may investigate this issue in more detail later on.
* Add GLRendererQuirks; Fix shared EGL/ES resources;Sven Gothel2012-09-201-4/+3
| | | | | | | | | | | | | | | | | | | | | | | Add GLRendererQuirks: - Contains centralized 'tagged' workarounds for GL renderer bugs (quirks) - Accessible via GLContext and GLDrawableFactory - Initialized in GLContext.setAvailability* - Simplify GLGraphicsConfigurationUtil.fixOffscreenGLCapabilities(..) & use Quirks - use quirks - instead of passing booleans for each config, pass factory & device Fix shared EGL/ES resources: - GLProfile needs to initialize EGLDrawableFactory's shared resources before desktop, so EGLDrawableFactory can use the fallback defaultDisplay & defaultSharedResource for host mapped sharedResources (hack). - If using defaultSharedResources for host mapped ones, do not go through initialization cycles - simply map (sharedResource + context). - EGLDrawableFactory: Use device's unique-key instead of connection only, since the latter causes a collision (EGL-connection == X11-connection).
* Fixes Bug 615 - X11: Use proper screen index/name for shared resources and ↵Sven Gothel2012-09-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | device denominated 'mutable' surfaces (dummy, offscreen, ..) Fix follows findings of Rob Hatcherson, but instead of parsing the display connection ourself we use the X11 macro 'DefaultScreen(display)' See <http://tronche.com/gui/x/xlib/display/opening.html#Display> "The screen number specified in the display_name argument is returned by the DefaultScreen() macro (or the XDefaultScreen() function)." Since I currently have no two-head X11 setup here, only xinerama via virtualbox, pls test / validate. Note: One Display connection may span multiple screens, i.e.: display 'lala:0.1' may span from screen 1 - 3 (non xinerama mode) Discussion: [1] How to validate whether a screen number belongs to one display connection ? We can query ScreenCount(display), however it is not clear what the range would be. [2] With 1 display connection spanning multiple screens, what is/are the proper connection string[s] ? [3] After all, it seems this ancient configuration really cannot beat a modern setup w/ XRandR having Xinerama enabled. The latter is the default anyways.
* Seamless Integration of an FBObject based GLFBODrawable as ↵Sven Gothel2012-09-157-79/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GLOffscreenAutoDrawable.FBO and as an OffscreenLayerSurface's drawable (OSX) - Fix Bugs 569 and 599 Summary: ========= The new FBObject based GLFBODrawable implementation allows the seamless utilization of FBO offscreen rendering in single buffer, double buffer and MSAA mode. The GLFBODrawable uses a parent drawable based on a dummy surface to allow a GLOffscreenAutoDrawable.FBO creation or a mutable surface supporting an existing offscreen layer surface (OSX CALayer). Offscreen GLDrawable's and GLOffscreenAutoDrawable's can be selected via the GLCapabilities. If simply !onscreen is selected in the caps instance w/o enabling FBO, PBuffer or Bitmap, the factory will automatically choose regarding availability: FBO > PBuffer > Bitmap Double buffering is supported in MSAA more (intrinsic) and explicit in non MSAA. It is preferred when delivering resources (texture id's or framebuffer names) to a shared GLContext. This is demonstrated in (emulates our OSX CALayer implementation): TestFBOOffThreadSharedContextMix2DemosES2NEWT, TestFBOOnThreadSharedContext1DemoES2NEWT and with the OSX JAWT OffscreenLayerSurface itself. FBO is the preferred choice. +++ Offscreen drawables can be resized while maintaining a bound GLContext (e.g. w/ GLAutoDrawable). Previously both, drawable and context, needed to be destroyed and recreated at offscreen resize. Common implementation in GLDrawableHelper is used in the implementations (NEWT's GLWindow, AWT GLCanvas, SWT GLCanvas). +++ Tested: ======= Manually run all unit tests on: - Linux x86_64 NVidia/AMD/Mesa3d(ES) - OSX x86_64 NVidia - Windows x86_64 NVidia - Android arm Mali-400/Tegra-2 No regressions. Disclaimer: =========== This feature is committed almost in one patch. Both previous commits were introducing / fixing the capabilities behavior: 90d45928186f2be99999461cfe45f76a783cc961 9036376b7806a5fc61590bf49404eb71830de92f I have to appologize for the huge size and impact (files and platforms) of this commit however, I could not find a better way to inject this feature in one sane piece. NativeWindow Details: ===================== Complete decoupling of platform impl. detail of surfaces implementing ProxySurface. Used to generalize dummy surfaces and EGL surfaces on top of a native platform surface. - ProxySurface.UpstreamSurfaceHook -> UpstreamSurfaceHook - abstract class ProxySurface -> interface ProxySurface + ProxySurfaceImpl - Misc. implementations JOGL Details: ===================== FBOObject: API Change / Simplification & Usability - Removed reference counter to remove complexity, allow user to choose. - Add 'dispose' flag for detachColorbuffer(..), allowing to keep attachment alive - Fix equals operation of Attachment - Check pre-exising GL errors - Interface Colobuffer gets lifecycle methods - Add static factory methods to create Attachments w/o FBObject instance - Reset: - Clip min size to 1 - Keep alive samplingSink, i.e. don't issue resetMSAATexture2DSink(..). It gets called at syncFramebuffer()/use(..) later on before actual usage. This allows the consumer to utilize the GL_FRONT buffer until (e.g.) swap. - misc bugfixes GLOffscreenAutoDrawable: API Change - Reloc and interfacing - class com.jogamp.opengl.OffscreenAutoDrawable -> javax.media.opengl.* interfaces GLOffscreenAutoDrawable extends GLAutoDrawable GLOffscreenAutoDrawable.FBO extends GLOffscreenAutoDrawable, GLFBODrawable - Added general implementation and FBO specialization - Replacing GLPBuffer (deprecated) .. usable for any offscreen GLDrawable via factory GLAutoDrawable: - Add 'GLDrawable getDelegatedDrawable()' - Refine documentation of setContext(..), remove disclaimer and fixme tags GLDrawableFactory: - Refine API doc and it's selection mechanism for offscreen. - Add createOffscreenDrawable(..) - Add createOffscreenAutoDrawable(..) - Add canCreateFBO(..) - Mark createGLPbuffer(..) deprectated Mark GLPBuffer deprecated New: GLFBODrawable extends GLDrawable GLCanvas (AWT and SWT): Add offscreen resize support w/o GLContext recreation GLAutoDrawableBase .. GLWindow: - Add offscreen resize support w/o GLContext recreation - Remove double swapBuffer call - GLBase/GLContext: - Add: - boolean hasBasicFBOSupport() - boolean hasFullFBOSupport() - int getMaxRenderbufferSamples() - boolean isTextureFormatBGRA8888Available() GLContext: Fix version detection and hasGLSL() - Version detection in setGLFunctionAvailability(..) - Query GL_VERSION ASAP and parse it and compare w/ given major/minor - Use parsed version if valid and lower than given _or_ given is invalid. - Use validated version for caching (procaddr, ..), version number, etc. - Fix hasGLSL() Since 'isGL2ES2()' is true if 'isGL2()' and the latter simply alows GL 1.*, we confine the result to a GL >= 2.0 on desktops. FIXME: May consider GL 1.5 w/ extensions. - return isGL2ES2(); + return isGLES2() || + isGL3() || + isGL2() && ctxMajorVersion>1 ; GLDrawableImpl: - Add 'associateContext(GLContext, boolean)' allowing impl. to have a (weak) reference list of bound context. This is was pulled up from the OSX specific drawable impl. - swapBuffersImpl() -> swapBuffersImpl(boolean doubleBuffered) and call it regardless of single buffering. This is required to propagate this event to impl. properly, i.e. FBODrawable requires a swap notification. - Clarify 'contextMadeCurrent(..)' protocol GLDrawableHelper: - Add resize and recreate offscreen drawable util method - Simplify required init/reshape calls for GLEventListener - GLGraphicsConfigurationUtil: - fixWinAttribBitsAndHwAccel: Reflect sharede context hw-accel bits - OSX has no offscreen bitmap, use pbuffer - use proper offscreen auto selection if offscreen and no modes are set EGL Context/Drawable/DrawableFactory: Abstract native platform code out of base classes - Use EGLWrappedSurface w/ UpstreamSurfaceHook to handle upstream (X11, WGL, ..) lifecycle - in case the EGL resource is hooked up on it. Invisible dummy surfaces: All platforms - size is now reduced to 64x64 and decoupled of actual generic mutable size - fix device lifecycle, no more leaks +++ OSX ==== Enable support for GLFBODrawableImpl in offscreen CALayer mode - NSOpenGLImpl: hooks to calayer native code - calayer code: - allows pbuffer and texures (FBO) - decouple size and draw calls avoiding flickering - enable auto resize of calayer tree MacOSXCGLContext: - NSOpenGLImpl: - Fix false pbuffer 'usage', validate the pointer - If !pbuffer, copy other window mode bits of caps - MacOSXCGLGraphicsConfiguration: - Only assume pbuffer if !onscreen - Remove reference of native pixelformat pointer Native code: - use 'respondsToSelector:' query before calling 'new' methods avoiding an error message where unsuported (prev. OSX versions) - if monitor refresh-rate is queried 0, set to default 60hz - add missing NSAutoreleasePool decoration +++ Android / NEWT: =============== Issue setVisible(..) w/o wait, i.e. queue on EDT, @Android surfaceChanged() callback. Otherwise we could deadlock: setVisible(..) -> EDT -> setVisibleImpl(..) -> 'GL-display'. the latter may may cause havoc while Android-EDT is blocked [until it's return].
* Fix window mode attribute bit FBO_BIT usage in platform dependent code (map ↵Sven Gothel2012-09-082-43/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | it to native type) ; OSX Caps selection ; WGL/GDI BITMAP fix Fix window mode attribute bit FBO_BIT usage in platform dependent code (map it to native type) All platform dependent winAttrBit mapping: 'nativeType -> winAttrBit' and 'GLCapabilities -> winAttrBits' shall replace FBO_BIT w/ the native type of the wrapper surface, i.e. WINDOW_BIT (X11, WGL, CGL) or PBUFFER_BIT (EGL). This condenses to changes in - EGLGraphicsConfiguration: EGLConfigDrawableTypeBits / GLCapabilities2AttribList - X11GLXGraphicsConfiguration: FBCfgDrawableTypeBits, XVisualInfo2GLCapabilities / GLCapabilities2AttribList - WindowsWGLGraphicsConfiguration: AttribList2DrawableTypeBits, PFD2DrawableTypeBits / GLCapabilities2AttribList - OSX CGL/NS requires changes in MacOSXCGLContext, i.e. fix the surface mode of NSPixelFormat2GLCapabilities, CGLPixelFormat2GLCapabilities results. This change is included in the upcoming commit (class is heavily edited). OSX chooseGraphicsConfigurationStatic: Add missing 'GLGraphicsConfigurationUtil.fixGLCapabilities(..)' call - all platform impl. require to fix the given user caps due to the new offscreen auto selection mode WindowsWGLGraphicsConfiguration*: ARB / GDI updateGraphicsConfiguration*() - ARB method detects early whether it's suitable for given HDC, i.e. in case of BITMAP (it's not here) - GDI methods detect failure while choosing PFD and doesn't care of DOUBLEBUFFER in case of bitmap (fixes BITMAP usage) Capabilities/GLCapabilities: - Fix missing double-buffer check in GLCapabilities.equals() - add 'copyFrom(..)' method copy all data from give caps
* Cleanup shutdown mechanism ; Fix X11/ATI SIGV at shutdown ; EGLDisplayUtil: ↵Sven Gothel2012-09-071-10/+4
| | | | | | | | | | | | | | | | | | Check for leaked display handles GLProfile / all shutdown methods: Remove ShutdownType to remove complexity (not required) Proper shutdown sequence: GLProfile - GLDrawableFactory+ - GLContext - NativeWindowFactory - [X11Util, OSXUtil, ..] GLDrawableFactory: Always keep shutdown-hook alive, required for X11Util shutdown (@ JVMShutdown only) X11Util: Shutdown - @ JVMShutdown only - If GL vendor ATI: close pending X11 display connections in proper order of creation. This finally removes the SIGV when shutting down the JVM on X11 w/ ATI driver. EGLDisplayUtil: Add shutdown, allowing to validate whether leaked EGL display handles remain.
* Fix Capabilities ambiguity and explosion of queried available-list; Add FBO ↵Sven Gothel2012-09-072-76/+64
| | | | | | | | | | | | | | | | | | | | | availability detection for EGL, WGL and OSX. Introducing Capabilities 'bitmap' boolean, complementing the offscreen modes FBO and PBuffer. This allows: 1 - deterministic setting of the offscreen mode 2 - utilizing auto configuration of offscreen mode, if !onscreen !FBO !PBuffer and !Bitmap 3 - adding 'availability' semantic of 'onscreen' boolean, i.e. if onscree:=1 for a queried instance, the offscreen modes still indicate offscreen availability - see [4] 4 - avoiding explosion of the availability list due to [3], one Capability entry reflect on- and offscreen settings. Add FBO availability detection for EGL, WGL and OSX. Tested manually w/ 'TestGLCapabilities01NEWT' on X11 [NV, ATI], WGL[NV], OSX[NV].
* Fix EGLDrawableFactory ES1/ES2 detection for !pbuffer ; Misc robustness ↵Sven Gothel2012-08-211-0/+5
| | | | | | | | | | | | | | | | | | | changes for GLDrawableFactory .. - EGLDrawableFactory ES1/ES2 detection for !pbuffer - isEGLContextAvailable(..) -> mapAvailableEGLESConfig(..) - handle case where no pbuffer configuration is available (nokia n9 meego ..). in such case, assume availability if onscreen profile is avail. - EGLDrawableFactory.getOrCreateEGLSharedResource(..) - avoid double creation attempt (similar to SharedResourceRunner) - EGLGraphicsConfiguration.EGLConfig2Capabilities(..) respect EGL.EGL_CONFIG_CAVEAT's EGL.EGL_SLOW_CONFIG - if EGL.EGL_SLOW_CONFIG -> no hw accel. - Fix GLContext.getRequestMajorAndCompat(..): Proper handling of ES1 and ES2 - Add abstract GLDrawableFactory.isComplete(): Only if true use the factory for 'getFactory(..)' avoid using incomplete ones.
* Fix GraphicsConfigurationFactory: Map factory to device-type _and_ ↵Sven Gothel2012-07-244-37/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | capabilities-type; Add a pre-set nativeVisualID to chooseGraphicsConfiguration(..) Map factory to device-type _and_ capabilities-type: - Allows using different GraphicsConfigurationFactory implementations for different capabilities-types. Previous impl. failed to use an OpenGL agnostic CapabilitiesImmutable for 'chooseGraphicsConfiguration(..)' since only the GL aware factory was mapped. The latter failed since it expected a GLCapabilitiesImmutable. - The passed capabilities-type as well as device-type given at getFactory(..) is traversed top-to-down to find a most suitable factory: For-All devT := getTopDownDeviceTypes(deviceType) For-All capsT := getTopDownCapabilitiesTypes(capabilitiesType) f = factory.get(devT, capsT); if(f) { return f; } end end Add a pre-set nativeVisualID to chooseGraphicsConfiguration(..) - In situations where a native visualID is already chosen [by external means for example], but we still need to query a matching GraphicsConfiguration - we require to pass a non VisualIDHolder.VID_UNDEFINED nativeVisualID. We had a hack implemented before within some implementations and their static calls, however an agnostic mechanism is required to implement new NativeSurface/Window's platform agnostic. - X11GLXGraphicsConfigurationFactory: respect a pre-set xvisualID - X11GLXDrawableFactory.createProxySurfaceImpl(..) queries the given windowHandle's visualID and 'chooses' the configuration accordingly. If the visualID is undefined an exception is thrown, since window is invalid. These mechanics are implicit for Windows and OSX. Fix X11GLXGraphicsConfiguration.updateGraphicsConfiguration(): - Skip any action if a valid X11GLCapabilities is already chosen, i.e. w/ visualID. Otherwise choose a suitable configuration incl. visualID. The latter is quite impossible and invalid, since visualID must be defined at window creation time and the update method is issued with a valid window. X11 - Misc: - Added 'int jogamp.nativewindow.x11.X11Lib.GetVisualIDFromWindow(..)' - All returned visualID's are of type 'int'
* GLCapabilities Native Aquisition: Set alpha bits at last - due to it's auto ↵Sven Gothel2012-07-202-26/+28
| | | | | | | | | setting by setSampleBuffers(true) and setBackgroundOpaque(false) This bug lead to X11 GLCapabilities rgba: 8/8/8/1 - which ofc is invalid. Sideeffect was a bad selected GLXFB configuration and the GLContext couldn't be made current. Patch sets alpha bits reflecting reality carefully after opaque/samples. Added API doc note.
* Bug 599 - FBObject / Offscreen Support - Part 1Sven Gothel2012-07-1910-194/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - New FBObject implementation handling FBO and it's attachments *** API CHANGE: Util -> Core *** while it's size and sample-count can be reconfigured on the fly. - com.jogamp.opengl.util.FBObject -> com.jogamp.opengl.FBObject - agnostic to texture unit - separate attachments using OO hierarchy reflecting FBO - handling MSAA and blitting - no FBO destruction for reconfig (attach/detach) - New GLFBODrawableImpl impl. an FBObject based GLDrawable - Instantiated by a dummy native surface (onscreen and invisible) hooked up to a dummy GLDrawable, which is the delegation for context creation. - Utilizies ProxySurface.UpstreamSurfaceHook for dummy surface avoiding specialization for native platforms. - TODO: Allow to utilize common surface interface as a dummy-surface to supporting API seperation of windowing/GL. The latter allows impl. of createGLDrawable(NativeSurface) with FBO. - New OffscreenAutoDrawable (extends GLAutoDrawableDelegate) for all offscreen drawables. Shall replace GLPbuffer. - New GLCapabilities*.isFBO() / setFBO(boolean) to request FBO offscreen, similar to isPBuffer(). Rule: if both are requested, FBO shall be favored. - GLContext adds raw FBO availability query (min. FBO avail), FBObject contains fine grained queries (TODO: Move parts to GLContext for efficiency). - Add framebuffer tracking, allowing fast querying: - GLBase/GLContext: public int getBoundFramebuffer(int target); public int getDefaultDrawFramebuffer(); public int getDefaultReadFramebuffer(); - GLContextImpl public final void setBoundFramebuffer(int target, int framebufferName) .. called by GL impl bind framebuffer - GL: getDefaultDrawFramebuffer(), getDefaultReadFramebuffer() Adding default framebuffer queries being issued by GL.glBindFramebuffer(target, 0) w/ a default framebuffer, o.e. zero. This allows a transparent use of a custom FBO even in case the applications attempts to reset FBO to zero. Value flow: GL <- GLContext <- GLDrawable, - GLCapabilities handle fbo/pbuffer seperate, don't disable the other - GLContext/GL track read/write framebuffer to be queried by FBObject to determine whether to bind/unbind a framebuffer - Test cases for multiple FBO w/ and w/o MSAA Other Features: - New interface ProxySurface.UpstreamSurfaceHook, allowing to hook an upstream surface of unknown type providing lifecycle and information (size, ..) callbacks. Used for all new dummy NativeSurface impl and SWT GLCanvas. - GLContext -> GLDrawable propagation context/drawable lifecycle via ProxySurface.UpstreamSurfaceHook allowing dynamic resources to react (create, init, ..) - contextRealized() - contextMadeCurrent() - SurfaceChangeable -> MutableSurface currently only contains setting the surface handle. TODO: May need to move ProxySurface.UpstreamSurfaceHook -> MutableSurface.UpstreamSurfaceHook, allowing other impl. classes (NEWT OffscreenWindow) to utilize the new upstream hookup mechanism - will allow FBO/Dummy window to work. - SWT GLCanvas using ProxySurface.UpstreamSurfaceHook for proper size propagation. - New GLAutoDrawable::getUpstreamWidget(), allowing GLEventListener to fetch the owning Java side UI element (NEWT, SWT, AWT, ..). - GLDrawableFactory: Removed createOffscreenSurface() - unused and not GL related - EGLDrawableFactory handles device/profile avail. mapping while actually creating context/drawable. This allows us to learn whether the ES context is software/hardware as well as FBO avail. - EGLDrawable: Removed secret buckets of EGL configs :) Employ native surface (X11, WGL, ..) to EGL 'mapping' in EGLDrawableFactory utilizing new EGLUpstreamSurfaceHook (implements ProxySurface.UpstreamSurfaceHook). Other Bugs: - Add CTX_OPTION_DEBUG to ctx/extension cache key since only a debug ctx may expose the ARB debug capability. This bug caused lack of ARB/AMD debug functionality. - Fix GLProfile deadlock (debug mode, w/ EGL/ES, no X11), dump availability information _after_ lock. - ImmModeSink draw(): Use GL's glDrawElements(..), don't cast for GL2ES1. Fixes use for GL2ES2. - Fix KeyEvent.getKeyChar() comment (-> only stable for keyTyped(..)) Misc: - Refined alot of API doc - New GLExtensions holds commonly used GL extension strings, allows better referencing and usage lookup. - Move GL (interface) decl. to GLBase - GLBuffers: Cleanup API doc (format, types) - TextureIO: Add PAM and PPM static suffix identifier - GLCapabilities getNumSamples() returns 0 if sampleBuffers is disabled, this seems to be more natural. - finalized a lot
* Enhance Bootsrapping of JOGL around 37% - 40% (1st start in new JVM) - ↵Sven Gothel2012-07-061-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | GLProfile and GLContext* GLProfile: Enhance bootsrapping performance of loading GL*Impl class - Offthread classloading of all GL*Impl via reflection at startup reduces startup time here around 12% (800ms down to 700ms). GLContext*: Enhance bootsrapping performance of querying available GL profiles - Add PROFILE_ALIASING mode, defaults to true - can be disabled w/ property 'jogl.debug.GLContext.NoProfileAliasing' - PROFILE_ALIASING: If true (default), bootstrapping the available GL profiles will use the highest compatible GL context for each profile, hence skipping querying lower profiles if a compatible higher one is found. Linux x86_64 - Nvidia: 28%, 700ms down to 500ms Linux x86_64 - AMD : 40%, 1500ms down to 900ms - GL*Impl: - make fields final: glProfile, _context, buffer*Tracker and glStateTracker - allow null _context/glProfile in initialization (bootstrapping) - JoglVersion.getDefaultOpenGLInfo(..) - add arg: 'boolean withCapabilitiesInfo', allowing to suppres the list of caps
* GLAutoDrawable* refinement of abstraction / generalization - API Change!Sven Gothel2012-07-044-17/+11
| | | | | | | | | | | | | | | | | | | | | | | | - GLAutoDrawable (compat change - recompile): - 'void invoke(boolean wait, GLRunnable glRunnable)' -> 'boolean invoke(boolean wait, GLRunnable glRunnable)' Allows notifying caller whether the task has been executed or at least enqueued. - GLAutoDrawable add 'GLEventListener removeGLEventListener(int index)' - This allow one to remove a specific GLEventListener and reusing it (return value). - GLDrawableImpl remove 'destroy()' to favor 'setRealized(false)' - Using more common code of GLAutoDrawableBase, i.e. GLPbufferImpl can use defaultDestroyOp(). - Removes redundancy of methods - GLAutoDrawableBase/Delegate - better 'default' names to emphasize it's purpose, adding API doc - includes more generic functionality - defaultWindowDestroyNotify() - defaultDestroyOp() - TestGLAutoDrawableDelegateNEWT demonstrates a simple example w/ all window events handled. - Fix TestParenting01cSwingAWT's threading use (gl disturbance thread)
* Minor cleanupSven Gothel2012-06-291-8/+10
|
* GLDrawable* cleanup: Add @Override, remove trailing whitespace, ..Sven Gothel2012-06-287-50/+102
|
* Capabilities cleanup: make most get*() final, impl. Comparable to ↵Sven Gothel2012-06-271-2/+5
| | | | | | | | | | | | | | | | CapabilitiesImmutable, Misc .. - Comparable<CapabilitiesImmutable> to CapabilitiesImmutable: "interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable" -> "interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable, Comparable<CapabilitiesImmutable>" - CapabilitiesImmutable and GLCapabilitiesImmutable get-methods final (most) - GLCapabilitiesImmutable.compareTo: add doubleBuffered (between stereo and samples) Misc: - Add @Override - remove trailing whitespace,
* Misc cleanup: Add @Override, remove trailing whitespaceSven Gothel2012-06-274-43/+69
|
* Misc cleanup: Add @Override, remove trailing whitespaceSven Gothel2012-06-277-62/+84
|
* JOGL CapabilitiesChooser-API and impl.: Cleanup using generics: 'List l' -> ↵Sven Gothel2012-06-212-5/+6
| | | | 'List<? extends CapabilitiesImmutable> l'