Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8260640: Cleanup dead code and comments imported from OpenGL
  • Loading branch information
jayathirthrao committed Jan 29, 2021
1 parent 1cc80db commit a6f59f9137738d31aa32e7c48cd5610b9df3ee58
Showing 11 changed files with 15 additions and 355 deletions.
@@ -71,7 +71,7 @@ public CGraphicsDevice(final int displayID) {

if (MacOSFlags.isMetalEnabled()) {
// Try to create MTLGraphicsConfig, if it fails, try to create CGLGraphicsConfig as a fallback
this.config = MTLGraphicsConfig.getConfig(this, displayID, 0);
this.config = MTLGraphicsConfig.getConfig(this, displayID);

if (this.config != null) {
metalPipelineEnabled = true;
@@ -99,7 +99,7 @@ public CGraphicsDevice(final int displayID) {
System.out.println("OpenGL rendering pipeline initialization failed. Using Metal rendering pipeline.");
}

this.config = MTLGraphicsConfig.getConfig(this, displayID, 0);
this.config = MTLGraphicsConfig.getConfig(this, displayID);

if (this.config != null) {
metalPipelineEnabled = true;
@@ -105,14 +105,6 @@ public static void invalidateCurrentContext() {
rq.flushNow();
}

/**
* Returns a string representing adapter id (vendor, renderer, version).
* Must be called on the rendering thread.
*
* @return an id string for the adapter
*/
public static final native String getMTLIdString();

public static class MTLContextCaps extends ContextCapabilities {
/**
* This cap will only be set if the fbobject system property has been
@@ -72,9 +72,6 @@
public final class MTLGraphicsConfig extends CGraphicsConfig
implements AccelGraphicsConfig, SurfaceManager.ProxiedGraphicsConfig
{
//private static final int kOpenGLSwapInterval =
// RuntimeOptions.getCurrentOptions().OpenGLSwapInterval;
private static final int kMetalSwapInterval = 0; // TODO
private static boolean mtlAvailable;
private static ImageCapabilities imageCaps = new MTLImageCaps();

@@ -84,7 +81,6 @@ public final class MTLGraphicsConfig extends CGraphicsConfig
"lib" + File.separator + "shaders.metallib");


private int pixfmt;
private BufferCapabilities bufferCaps;
private long pConfigInfo;
private ContextCapabilities mtlCaps;
@@ -106,12 +102,11 @@ public final class MTLGraphicsConfig extends CGraphicsConfig
mtlAvailable = isMetalFrameworkAvailable();
}

private MTLGraphicsConfig(CGraphicsDevice device, int pixfmt,
private MTLGraphicsConfig(CGraphicsDevice device,
long configInfo, int maxTextureSize,
ContextCapabilities mtlCaps) {
super(device);

this.pixfmt = pixfmt;
this.pConfigInfo = configInfo;
this.mtlCaps = mtlCaps;
this.maxTextureSize = maxTextureSize;
@@ -135,7 +130,7 @@ public SurfaceData createManagedSurface(int w, int h, int transparency) {
}

public static MTLGraphicsConfig getConfig(CGraphicsDevice device,
int displayID, int pixfmt)
int displayID)
{
if (!mtlAvailable) {
return null;
@@ -147,7 +142,6 @@ public static MTLGraphicsConfig getConfig(CGraphicsDevice device,

long cfginfo = 0;
int textureSize = 0;
final String[] ids = new String[1];
MTLRenderQueue rq = MTLRenderQueue.getInstance();
rq.lock();
try {
@@ -163,9 +157,6 @@ public static MTLGraphicsConfig getConfig(CGraphicsDevice device,
// Explicitly not support a texture more than 2^14, see 8010999.
textureSize = textureSize <= 16384 ? textureSize / 2 : 8192;
MTLContext.setScratchSurface(cfginfo);
rq.flushAndInvokeNow(() -> {
ids[0] = MTLContext.getMTLIdString();
});
}
} finally {
rq.unlock();
@@ -179,8 +170,8 @@ public static MTLGraphicsConfig getConfig(CGraphicsDevice device,
CAPS_RT_TEXTURE_ALPHA | CAPS_RT_TEXTURE_OPAQUE |
CAPS_MULTITEXTURE | CAPS_TEXNONPOW2 | CAPS_TEXNONSQUARE |
CAPS_EXT_BIOP_SHADER | CAPS_EXT_GRAD_SHADER,
ids[0]);
return new MTLGraphicsConfig(device, pixfmt, cfginfo, textureSize, caps);
null);
return new MTLGraphicsConfig(device, cfginfo, textureSize, caps);
}

public static boolean isMetalAvailable() {
@@ -273,8 +264,7 @@ public synchronized void displayChanged() {

@Override
public String toString() {
return ("MTLGraphicsConfig[" + getDevice().getIDstring() +
",pixfmt="+pixfmt+"]");
return ("MTLGraphicsConfig[" + getDevice().getIDstring() + "]");
}

@Override

This file was deleted.

0 comments on commit a6f59f9

Please sign in to comment.