mirror of https://github.com/kami-blue/client
[cleanup] Use lazy init for integrated graphics check
This commit is contained in:
parent
c9bdd7d004
commit
6850761a79
|
@ -100,7 +100,7 @@ object Search : Module() {
|
|||
}
|
||||
|
||||
override fun onEnable() {
|
||||
if (!overrideWarning.value && ShaderHelper.isIntegratedGraphics()) {
|
||||
if (!overrideWarning.value && ShaderHelper.isIntegratedGraphics) {
|
||||
MessageSendHelper.sendErrorMessage("$chatName Warning: Running Search with an Intel Integrated GPU is not recommended, as it has a &llarge&r impact on performance.")
|
||||
MessageSendHelper.sendWarningMessage("$chatName If you're sure you want to try, run the &7 ${Command.getCommandPrefix()}search override&f command")
|
||||
disable()
|
||||
|
|
|
@ -12,7 +12,7 @@ import net.minecraft.client.shader.ShaderGroup
|
|||
import net.minecraft.client.shader.ShaderLinkHelper
|
||||
import net.minecraft.util.ResourceLocation
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent
|
||||
import org.lwjgl.opengl.GL11
|
||||
import org.lwjgl.opengl.GL11.GL_VENDOR
|
||||
|
||||
class ShaderHelper(shaderIn: ResourceLocation, vararg frameBufferNames: String) {
|
||||
private val mc = Wrapper.minecraft
|
||||
|
@ -28,7 +28,7 @@ class ShaderHelper(shaderIn: ResourceLocation, vararg frameBufferNames: String)
|
|||
null
|
||||
}
|
||||
|
||||
isIntegratedGraphics() -> {
|
||||
isIntegratedGraphics -> {
|
||||
KamiMod.LOG.warn("Running on Intel Integrated Graphics!")
|
||||
null
|
||||
}
|
||||
|
@ -72,13 +72,8 @@ class ShaderHelper(shaderIn: ResourceLocation, vararg frameBufferNames: String)
|
|||
fun getFrameBuffer(name: String) = frameBufferMap[name]
|
||||
|
||||
companion object {
|
||||
private var cachedIsIntegratedGraphics: Boolean? = null
|
||||
|
||||
fun isIntegratedGraphics() = cachedIsIntegratedGraphics ?: run {
|
||||
GlStateManager.glGetString(GL11.GL_VENDOR).contains("Intel").apply {
|
||||
cachedIsIntegratedGraphics = this
|
||||
return this
|
||||
}
|
||||
val isIntegratedGraphics by lazy {
|
||||
GlStateManager.glGetString(GL_VENDOR).contains("Intel")
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue