Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.
/ lanai Public archive

8262729: Cleanup OpenGL references from Metal implementation #206

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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();
}
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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;