fast path on not windows
This commit is contained in:
@@ -4,6 +4,7 @@ import me.cortex.voxy.client.core.gl.Capabilities;
|
|||||||
import me.cortex.voxy.client.core.gl.GlBuffer;
|
import me.cortex.voxy.client.core.gl.GlBuffer;
|
||||||
import me.cortex.voxy.client.core.gl.GlDebug;
|
import me.cortex.voxy.client.core.gl.GlDebug;
|
||||||
import me.cortex.voxy.common.Logger;
|
import me.cortex.voxy.common.Logger;
|
||||||
|
import me.cortex.voxy.common.util.ThreadUtils;
|
||||||
import me.cortex.voxy.common.util.TrackedObject;
|
import me.cortex.voxy.common.util.TrackedObject;
|
||||||
import org.lwjgl.opengl.GL20C;
|
import org.lwjgl.opengl.GL20C;
|
||||||
import org.lwjgl.system.MemoryStack;
|
import org.lwjgl.system.MemoryStack;
|
||||||
@@ -151,6 +152,7 @@ public class Shader extends TrackedObject {
|
|||||||
|
|
||||||
public T compile() {
|
public T compile() {
|
||||||
this.defineIf("IS_INTEL", Capabilities.INSTANCE.isIntel);
|
this.defineIf("IS_INTEL", Capabilities.INSTANCE.isIntel);
|
||||||
|
this.defineIf("IS_WINDOWS", ThreadUtils.isWindows);
|
||||||
return this.constructor.make(this, this.compileToProgram());
|
return this.constructor.make(this, this.compileToProgram());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class ThreadUtils {
|
|||||||
public static final int WIN32_THREAD_PRIORITY_LOWEST = -2;
|
public static final int WIN32_THREAD_PRIORITY_LOWEST = -2;
|
||||||
public static final int WIN32_THREAD_MODE_BACKGROUND_BEGIN = 0x00010000;
|
public static final int WIN32_THREAD_MODE_BACKGROUND_BEGIN = 0x00010000;
|
||||||
public static final int WIN32_THREAD_MODE_BACKGROUND_END = 0x00020000;
|
public static final int WIN32_THREAD_MODE_BACKGROUND_END = 0x00020000;
|
||||||
private static final boolean isWindows = Platform.get() == Platform.WINDOWS;
|
public static final boolean isWindows = Platform.get() == Platform.WINDOWS;
|
||||||
private static final long SetThreadPriority;
|
private static final long SetThreadPriority;
|
||||||
private static final long SetThreadSelectedCpuSetMasks;
|
private static final long SetThreadSelectedCpuSetMasks;
|
||||||
private static final long schedSetaffinity;
|
private static final long schedSetaffinity;
|
||||||
|
|||||||
@@ -93,8 +93,8 @@ void main() {
|
|||||||
barrier();
|
barrier();
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef IS_WINDOWS
|
||||||
//hate amd hate amd hate amd hate amd
|
//hate amd hate amd hate amd hate amd
|
||||||
|
|
||||||
uint val = warpPrefixSum[gl_LocalInvocationID.x&3u];
|
uint val = warpPrefixSum[gl_LocalInvocationID.x&3u];
|
||||||
|
|
||||||
subgroupBarrier();
|
subgroupBarrier();
|
||||||
@@ -105,6 +105,14 @@ void main() {
|
|||||||
if (gl_LocalInvocationID.x<4) {
|
if (gl_LocalInvocationID.x<4) {
|
||||||
warpPrefixSum[gl_LocalInvocationID.x] = extraJank;
|
warpPrefixSum[gl_LocalInvocationID.x] = extraJank;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (gl_LocalInvocationID.x<4) {
|
||||||
|
uint val = warpPrefixSum[gl_SubgroupInvocationID];
|
||||||
|
subgroupBarrier();
|
||||||
|
//Use warp to do entire add in 1 reduction
|
||||||
|
warpPrefixSum[gl_SubgroupInvocationID] = subgroupExclusiveAdd(val);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
memoryBarrierShared();
|
memoryBarrierShared();
|
||||||
barrier();
|
barrier();
|
||||||
|
|||||||
Reference in New Issue
Block a user