mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-10 07:48:29 -04:00
rendering: allow ignoring uniform errors
This allows easier debugging on such errors for non developers.
This commit is contained in:
parent
5b1ca516e1
commit
e7b57e4da3
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Minosoft
|
* Minosoft
|
||||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
* Copyright (C) 2020-2024 Moritz Zwerger
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
@ -37,4 +37,10 @@ class AdvancedC(profile: RenderingProfile) {
|
|||||||
* Requires rendering restart to apply
|
* Requires rendering restart to apply
|
||||||
*/
|
*/
|
||||||
var preferQuads by BooleanDelegate(profile, false)
|
var preferQuads by BooleanDelegate(profile, false)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This option makes shader uniform errors just warnings and does not crash it. This only helps if there is a driver bug or the included shader does not follow
|
||||||
|
* the specs strictly. Not recommended to enable.
|
||||||
|
*/
|
||||||
|
var allowUniformErrors by BooleanDelegate(profile, false)
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,9 @@ import de.bixilon.minosoft.gui.rendering.exceptions.ShaderLoadingException
|
|||||||
import de.bixilon.minosoft.gui.rendering.system.base.buffer.uniform.UniformBuffer
|
import de.bixilon.minosoft.gui.rendering.system.base.buffer.uniform.UniformBuffer
|
||||||
import de.bixilon.minosoft.gui.rendering.system.base.shader.NativeShader
|
import de.bixilon.minosoft.gui.rendering.system.base.shader.NativeShader
|
||||||
import de.bixilon.minosoft.gui.rendering.system.base.shader.code.glsl.GLSLShaderCode
|
import de.bixilon.minosoft.gui.rendering.system.base.shader.code.glsl.GLSLShaderCode
|
||||||
|
import de.bixilon.minosoft.util.logging.Log
|
||||||
|
import de.bixilon.minosoft.util.logging.LogLevels
|
||||||
|
import de.bixilon.minosoft.util.logging.LogMessageType
|
||||||
import it.unimi.dsi.fastutil.ints.IntArrayList
|
import it.unimi.dsi.fastutil.ints.IntArrayList
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap
|
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap
|
||||||
import org.lwjgl.opengl.GL11.GL_FALSE
|
import org.lwjgl.opengl.GL11.GL_FALSE
|
||||||
@ -129,7 +132,11 @@ class OpenGLNativeShader(
|
|||||||
val location = uniformLocations.getOrPut(uniformName) {
|
val location = uniformLocations.getOrPut(uniformName) {
|
||||||
val location = glGetUniformLocation(handler, uniformName)
|
val location = glGetUniformLocation(handler, uniformName)
|
||||||
if (location < 0) {
|
if (location < 0) {
|
||||||
throw IllegalArgumentException("No uniform named $uniformName in $this, maybe you use something that has been optimized out? Check your shader code!")
|
val error = "No uniform named $uniformName in $this, maybe you use something that has been optimized out? Check your shader code!"
|
||||||
|
if (!context.profile.advanced.allowUniformErrors) {
|
||||||
|
throw IllegalArgumentException(error)
|
||||||
|
}
|
||||||
|
Log.log(LogMessageType.RENDERING, LogLevels.WARN, error)
|
||||||
}
|
}
|
||||||
return@getOrPut location
|
return@getOrPut location
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user