remove deprecated detection of shader uniforms

This commit is contained in:
Bixilon 2022-11-12 15:53:10 +01:00
parent 9ff7a4a641
commit fb873ab418
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
3 changed files with 0 additions and 21 deletions

View File

@ -28,7 +28,6 @@ import kotlin.math.max
interface Shader { interface Shader {
val loaded: Boolean val loaded: Boolean
val renderWindow: RenderWindow val renderWindow: RenderWindow
val uniforms: Set<String>
val defines: MutableMap<String, Any> val defines: MutableMap<String, Any>
val log: String val log: String

View File

@ -24,23 +24,8 @@ class GLSLShaderCode(
private val rawCode: String, private val rawCode: String,
) { ) {
val defines: MutableMap<String, Any> = mutableMapOf() val defines: MutableMap<String, Any> = mutableMapOf()
val uniforms: MutableSet<String> = mutableSetOf()
init { init {
// ToDo: This is complete trash and should be replaced
for (line in rawCode.lines()) {
if (!line.startsWith("uniform ")) {
continue
}
val reader = GLSLStringReader(line.removePrefix("uniform "))
reader.skipWhitespaces()
reader.readUnquotedString() // data type
reader.skipWhitespaces()
uniforms += reader.readWord() ?: continue
}
for ((name, value) in Shader.DEFAULT_DEFINES) { for ((name, value) in Shader.DEFAULT_DEFINES) {
value(renderWindow)?.let { defines[name] = it } value(renderWindow)?.let { defines[name] = it }
} }
@ -70,7 +55,6 @@ class GLSLShaderCode(
val include = ResourceLocation(reader.readString()!!) val include = ResourceLocation(reader.readString()!!)
val includeCode = GLSLShaderCode(renderWindow, renderWindow.connection.assetsManager[ResourceLocation(include.namespace, "rendering/shader/includes/${include.path}.glsl")].readAsString()) val includeCode = GLSLShaderCode(renderWindow, renderWindow.connection.assetsManager[ResourceLocation(include.namespace, "rendering/shader/includes/${include.path}.glsl")].readAsString())
this.uniforms += includeCode.uniforms
code.append('\n') code.append('\n')
code.append(includeCode.code) code.append(includeCode.code)

View File

@ -41,8 +41,6 @@ class OpenGLShader(
private set private set
override val defines: MutableMap<String, Any> = mutableMapOf() override val defines: MutableMap<String, Any> = mutableMapOf()
private var shader = -1 private var shader = -1
override var uniforms: MutableSet<String> = mutableSetOf()
private set
private val uniformLocations: Object2IntOpenHashMap<String> = Object2IntOpenHashMap() private val uniformLocations: Object2IntOpenHashMap<String> = Object2IntOpenHashMap()
private fun load(resourceLocation: ResourceLocation, shaderType: Int): Int { private fun load(resourceLocation: ResourceLocation, shaderType: Int): Int {
@ -58,8 +56,6 @@ class OpenGLShader(
glShaderSource(program, code.code) glShaderSource(program, code.code)
this.uniforms += code.uniforms
glCompileShader(program) glCompileShader(program)
if (glGetShaderi(program, GL_COMPILE_STATUS) == GL_FALSE) { if (glGetShaderi(program, GL_COMPILE_STATUS) == GL_FALSE) {