JDK-8302309 : [Ventura][x64]Assertion in 2D shapes sample program with metal pipeline
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: internal
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86_64
  • Submitted: 2023-02-13
  • Updated: 2024-07-06
  • Resolved: 2023-02-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
internalFixed
Related Reports
Relates :  
Description
Looks like fix for JDK-8293341 has broken metal pipeline behaviour on my x64 based system : macOS 13.1.

Running 2D shapes draw PoC results in an assert with below log-

>>> MTLShader(): fragFuncName = Solid_Color
2023-02-13 14:41:08.655 java[36470:827135] 
2023-02-13 14:41:08.655 java[36470:827135] >>>> JNICALL Native: MTLShader_nCreateMetalShader
2023-02-13 14:41:08.655 java[36470:827135] 
2023-02-13 14:41:08.655 java[36470:827135] >>>> MetalShader.initWithContext()----> fragFuncName: Solid_Color
2023-02-13 14:41:08.655 java[36470:827135] getPRISMDict 
2023-02-13 14:41:08.655 java[36470:827135] getPRISMDict() : calling -> getSolid_Color_Uniform_VarID_Dict()
2023-02-13 14:41:08.655 java[36470:827135] getDECORADict 
2023-02-13 14:41:08.657 java[36470:827135] -> Native: MTLShader.initWithContext()  argumentBufferLength = 0
2023-02-13 14:41:08.657 java[36470:827135] MetalPipelineManager.getPipeStateWithFragFunc()
2023-02-13 14:41:08.832 java[36470:827135] *** Assertion failure in -[MetalPipelineManager getPipeStateWithFragFunc:], MetalPipelineManager.m:88
2023-02-13 14:41:08.833 java[36470:827135] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed to create pipeline state to render to texture: Error Domain=CompilerError Code=2 "Compiler encountered an internal error" UserInfo={NSLocalizedDescription=Compiler encountered an internal error}'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007ff81329740b __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x00007ff812de3e25 objc_exception_throw + 48
	2   Foundation                          0x00007ff81413afb0 -[NSCalendarDate initWithCoder:] + 0
	3   libprism_mtl.dylib                  0x000000010b0b4cc9 -[MetalPipelineManager getPipeStateWithFragFunc:] + 329
	4   libprism_mtl.dylib                  0x000000010b0ce29e -[MetalShader initWithContext:withFragFunc:] + 670
	5   libprism_mtl.dylib                  0x000000010b0cf67f Java_com_sun_prism_mtl_MTLShader_nCreateMetalShader + 95
	6   ???                                 0x000000011c316051 0x0 + 4767965265
	7   ???                                 0x000000011c311dd0 0x0 + 4767948240
)
libc++abi: terminating with uncaught exception of type NSException

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
Comments
The fix is tested by running several samples on three different machines: 1. Ventura, x64 2. Ventura, M1 3. Monterey, x64
13-02-2023

Changeset: 5c58b648 Author: Ambarish Rapte <arapte@openjdk.org> Date: 2023-02-13 15:24:10 +0530 URL: https://github.com/openjdk/jfx-sandbox/commit/5c58b64870ee9789498eafae0b14d53a6c02363e
13-02-2023

Issue is that it fails to create MTLRenderPipelineState with any fragment function. There are no compile or linking time warnings generated. The issue occurs with Ventura on x64 machine only. Does NOT occur on, 1. Monterey with x64 2. Ventura with M1 As part of JDK-8293341 : Decora POC We pass a MTLSamplerState to fragment function as function argument and store it's reference in a file global sampler variable. Saving reference into global variable seems to be the cause of this issue. Fix: We have to remove use of global variable. So we shall be passing the MTLSamplerState as argument to all user defined functions. We already do this for sharing the Uniform across functions.
13-02-2023