Fix GPU rendering on Linux
- Unlock surface after making context current - Lock surface on shutdown
This commit is contained in:
@@ -110,11 +110,24 @@
|
||||
<classifier>natives-windows-i586</classifier>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jogamp.jogl</groupId>
|
||||
<artifactId>jogl-all</artifactId>
|
||||
<version>${jogl.version}</version>
|
||||
<classifier>natives-linux-amd64</classifier>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jogamp.jogl</groupId>
|
||||
<artifactId>jogl-all</artifactId>
|
||||
<version>${jogl.version}</version>
|
||||
<classifier>natives-linux-i586</classifier>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jogamp.gluegen</groupId>
|
||||
<artifactId>gluegen-rt</artifactId>
|
||||
<version>${jogl.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jogamp.gluegen</groupId>
|
||||
@@ -130,6 +143,20 @@
|
||||
<classifier>natives-windows-i586</classifier>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jogamp.gluegen</groupId>
|
||||
<artifactId>gluegen-rt</artifactId>
|
||||
<version>${jogl.version}</version>
|
||||
<classifier>natives-linux-amd64</classifier>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jogamp.gluegen</groupId>
|
||||
<artifactId>gluegen-rt</artifactId>
|
||||
<version>${jogl.version}</version>
|
||||
<classifier>natives-linux-i586</classifier>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.runelite</groupId>
|
||||
|
||||
@@ -26,8 +26,7 @@ package net.runelite.client.plugins.gpu;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
|
||||
import com.jogamp.nativewindow.NativeWindowFactory;
|
||||
import com.jogamp.nativewindow.NativeSurface;
|
||||
import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration;
|
||||
import com.jogamp.nativewindow.awt.JAWTWindow;
|
||||
import com.jogamp.opengl.GL;
|
||||
@@ -50,6 +49,7 @@ import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.function.Function;
|
||||
import javax.inject.Inject;
|
||||
import jogamp.newt.awt.NewtFactoryAWT;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.BufferProvider;
|
||||
import net.runelite.api.Client;
|
||||
@@ -231,10 +231,10 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
|
||||
GLProfile glProfile = GLProfile.get(GLProfile.GL4bc);
|
||||
|
||||
GLCapabilities glCaps = new GLCapabilities(glProfile);
|
||||
AbstractGraphicsConfiguration config = AWTGraphicsConfiguration.create(canvas.getGraphicsConfiguration(),
|
||||
glCaps, glCaps);
|
||||
AWTGraphicsConfiguration config = AWTGraphicsConfiguration.create(canvas.getGraphicsConfiguration(), glCaps, glCaps);
|
||||
|
||||
jawtWindow = (JAWTWindow) NativeWindowFactory.getNativeWindow(canvas, config);
|
||||
jawtWindow = NewtFactoryAWT.getNativeWindow(canvas, config);
|
||||
canvas.setFocusable(true);
|
||||
|
||||
GLDrawableFactory glDrawableFactory = GLDrawableFactory.getFactory(glProfile);
|
||||
|
||||
@@ -248,6 +248,11 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
|
||||
throw new GLException("Unable to make context current");
|
||||
}
|
||||
|
||||
if (jawtWindow.getLock().isLocked())
|
||||
{
|
||||
jawtWindow.unlockSurface();
|
||||
}
|
||||
|
||||
this.gl = glContext.getGL().getGL4();
|
||||
gl.setSwapInterval(0);
|
||||
|
||||
@@ -316,6 +321,11 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
|
||||
client.setGpu(false);
|
||||
client.setDrawCallbacks(null);
|
||||
|
||||
if (jawtWindow.getLock().getHoldCount() != NativeSurface.LOCK_SURFACE_NOT_READY)
|
||||
{
|
||||
jawtWindow.lockSurface();
|
||||
}
|
||||
|
||||
if (bufferId != -1)
|
||||
{
|
||||
GLUtil.glDeleteBuffer(gl, bufferId);
|
||||
|
||||
Reference in New Issue
Block a user