Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8262729: Cleanup OpenGL references from Metal implementation
  • Loading branch information
aghaisas committed Mar 1, 2021
1 parent 15df88a commit 50bf043568159a49e464009e497e764320cd092d
@@ -42,7 +42,7 @@ public class MTLLayer extends CFRetainedResource {

// Pass the insets to native code to make adjustments in blitTexture
private static native void nativeSetInsets(long layerPtr, int top, int left);
private static native void validate(long layerPtr, MTLSurfaceData cglsd);
private static native void validate(long layerPtr, MTLSurfaceData mtlsd);
private static native void blitTexture(long layerPtr);

private LWWindowPeer peer;
@@ -107,11 +107,11 @@ public SurfaceData getSurfaceData() {
return surfaceData;
}

public void validate(final MTLSurfaceData cglsd) {
public void validate(final MTLSurfaceData mtlsd) {
MTLRenderQueue rq = MTLRenderQueue.getInstance();
rq.lock();
try {
execute(ptr -> validate(ptr, cglsd));
execute(ptr -> validate(ptr, mtlsd));
} finally {
rq.unlock();
}
@@ -613,15 +613,6 @@ public Object getDestination() {
}


// additional cleanup
private static native void destroyCGLContext(long ctx);

public static void destroyOGLContext(long ctx) {
if (ctx != 0L) {
destroyCGLContext(ctx);
}
}

/**
* Disposes the native resources associated with the given MTLSurfaceData
* (referenced by the pData parameter). This method is invoked from
@@ -50,11 +50,11 @@ public static SurfaceDataProxy createProxy(SurfaceData srcData,
return new MTLSurfaceDataProxy(dstConfig, srcData.getTransparency());
}

MTLGraphicsConfig oglgc;
MTLGraphicsConfig mtlgc;
int transparency;

public MTLSurfaceDataProxy(MTLGraphicsConfig oglgc, int transparency) {
this.oglgc = oglgc;
public MTLSurfaceDataProxy(MTLGraphicsConfig mtlgc, int transparency) {
this.mtlgc = mtlgc;
this.transparency = transparency;
}

@@ -65,7 +65,7 @@ public SurfaceData validateSurfaceData(SurfaceData srcData,
{
if (cachedData == null) {
try {
cachedData = oglgc.createManagedSurface(w, h, transparency);
cachedData = mtlgc.createManagedSurface(w, h, transparency);
} catch (OutOfMemoryError er) {
return null;
}
@@ -223,7 +223,7 @@ + (MTLContext*) setSurfacesEnv:(JNIEnv*)env src:(jlong)pSrc dst:(jlong)pDst {
// initialize the surface as an MTLSD_WINDOW
if (!MTLSD_InitMTLWindow(env, dstOps)) {
J2dRlsTraceLn(J2D_TRACE_ERROR,
"MTLContext_SetSurfaces: could not init OGL window");
"MTLContext_SetSurfaces: could not init MTL window");
return NULL;
}
}
@@ -378,11 +378,11 @@ static jboolean MTLSurfaceData_initTexture(BMTLSDOps *bmtlsdo, jboolean isOpaque

JNIEXPORT void JNICALL
Java_sun_java2d_metal_MTLSurfaceData_clearWindow
(JNIEnv *env, jobject cglsd)
(JNIEnv *env, jobject mtlsd)
{
J2dTraceLn(J2D_TRACE_INFO, "MTLSurfaceData_clearWindow");

BMTLSDOps *bmtlsdo = (MTLSDOps*) SurfaceData_GetOps(env, cglsd);
BMTLSDOps *bmtlsdo = (MTLSDOps*) SurfaceData_GetOps(env, mtlsd);
MTLSDOps *mtlsdo = (MTLSDOps*) bmtlsdo->privOps;

mtlsdo->peerData = NULL;

0 comments on commit 50bf043

Please sign in to comment.