RFR: 8310847: [Mac] Silence OpenGL deprecation warnings

Martin Fox duke at openjdk.org
Wed Jun 28 18:28:02 UTC 2023


On Wed, 28 Jun 2023 06:37:57 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:

>> The Mac build issues a lot of warnings including several related to the deprecation of OpenGL in macOS 10.14. Now that the deployment target for JavaFX is 11.0 across the board these warnings are showing up on both M1 and Intel builds. Luckily Apple provides a simply way to silence these warnings by setting a single C preprocessor define.
>
> All the OpenGL warnings get silenced except following two:
> 
> 1. modules/javafx.graphics/src/main/native-prism-es2/macosx/MacOSXWindowSystemInterface.m:120:24: warning: 'setView:' is deprecated: first deprecated in macOS 10.14 - Use NSOpenGLView to provide OpenGL content in a Cocoa app. [-Wdeprecated-declarations]
> 
> 2. modules/javafx.graphics/src/main/native-prism-es2/macosx/MacOSXWindowSystemInterface.m:181:57: warning: 'NSOpenGLCPSwapInterval' is deprecated: first deprecated in macOS 10.14 [-Wdeprecated-declarations]
> 
> Could you please take a look why are these not silenced. The other warnings from same file are silenced but not these.
> The first warning does not seem like specific to deprecation of OpenGL. But the second one does.
> Please take a quick look if can be solved, otherwise looks good.
> 
> I shall approve the PR as-is. and shall re-aproove if any changes.

@arapte NSOpenGLCPSwapInterval is deprecated in favor of NSOpenGLContextParameterSwapInterval. I've updated the PR. Apparently Apple deprecated OpenGL and cleaned up the API all at the same time.

Prism creates an NSOpenGLContext and then attaches it to the NSView using `setView:`. This approach is deprecated, the recommended way is to create an NSOpenGLView or CAOpenGLLayer and use the associated context. I don't understand Prism at all so can't really address this. (In fact I'm confused. In Glass the 3D view is an NSOpenGLView and also creates a CAOpenGLLayer which seems redundant. Then there's this Prism code that is creating an NSOpenGLContext and attaching it to the NSView? I'm sure it all makes sense but it would nice to see some documentation on how this all hangs together.)

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1161#issuecomment-1611885532


More information about the openjfx-dev mailing list