RFR: 8258754: Gracefully fallback to the OpenGL rendering pipeline if Metal rendering pipeline initialization fails [v6]

Alexey Ushakov alexey.ushakov at jetbrains.com
Mon Jan 11 10:11:31 UTC 2021


Hi Ajit, 

Let’s have some refactoring here.

We have two places this:

107         surfaceData = (CGraphicsDevice.usingMetalPipeline()) ?

108                     ((MTLLayer)windowLayer).replaceSurfaceData() :
109                     ((CGLLayer)windowLayer).replaceSurfaceData()
110         ;
111         return surfaceData;
112     }

I think it would be better to have a common superclass for CGLayer and MTLLayer with  common methods  replaceSurfaceData(), getPointer(). 

public class CFLayer extends CFRetainedResource {
…
	public long getWindowLayerPtr() {}

        public SurfaceData replaceSurfaceData() {}
...
}

So, we can get rid of (CGraphicsDevice.usingMetalPipeline()) ? … : … checks
 
Best Regards,
Alexey



> On 11 Jan 2021, at 12:50, Ajit Ghaisas <aghaisas at openjdk.java.net> wrote:
> 
>> This implements fallback to the OpenGL rendering pipeline if Metal rendering pipeline initialization fails.
>> I have tested this fallback on 10.15.4 by stubbing code. We need real testing on a system where Metal is not available.
> 
> Ajit Ghaisas has updated the pull request incrementally with one additional commit since the last revision:
> 
>  Address review comments
> 
> -------------
> 
> Changes:
>  - all: https://git.openjdk.java.net/lanai/pull/147/files
>  - new: https://git.openjdk.java.net/lanai/pull/147/files/d23bd72f..93ad2318
> 
> Webrevs:
> - full: https://webrevs.openjdk.java.net/?repo=lanai&pr=147&range=05
> - incr: https://webrevs.openjdk.java.net/?repo=lanai&pr=147&range=04-05
> 
>  Stats: 119 lines in 7 files changed: 37 ins; 60 del; 22 mod
>  Patch: https://git.openjdk.java.net/lanai/pull/147.diff
>  Fetch: git fetch https://git.openjdk.java.net/lanai pull/147/head:pull/147
> 
> PR: https://git.openjdk.java.net/lanai/pull/147



More information about the lanai-dev mailing list