mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-09 07:20:04 -04:00
remove RenderSystem::nativeShaders
Should not be exposed publicly as it does not matter. Checking system quality is faster then set contains
This commit is contained in:
parent
c18515ff57
commit
dc575601a9
@ -41,7 +41,6 @@ import java.nio.FloatBuffer
|
||||
class DummyRenderSystem(
|
||||
private val context: RenderContext,
|
||||
) : RenderSystem {
|
||||
override val nativeShaders: MutableSet<NativeShader> = mutableSetOf()
|
||||
override val shaders: MutableSet<Shader> = mutableSetOf()
|
||||
override lateinit var vendor: GPUVendor
|
||||
override var shader: NativeShader? = null
|
||||
|
@ -33,7 +33,6 @@ import de.bixilon.minosoft.util.collections.floats.DirectArrayFloatList
|
||||
import java.nio.FloatBuffer
|
||||
|
||||
interface RenderSystem {
|
||||
val nativeShaders: MutableSet<NativeShader>
|
||||
val shaders: MutableSet<Shader>
|
||||
val vendor: GPUVendor
|
||||
var shader: NativeShader?
|
||||
|
@ -17,6 +17,7 @@ import de.bixilon.kotlinglm.mat4x4.Mat4
|
||||
import de.bixilon.kotlinglm.vec2.Vec2
|
||||
import de.bixilon.kotlinglm.vec3.Vec3
|
||||
import de.bixilon.kotlinglm.vec4.Vec4
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.minosoft.assets.util.InputStreamUtil.readAsString
|
||||
import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
||||
import de.bixilon.minosoft.data.text.formatting.color.RGBColor
|
||||
@ -37,6 +38,7 @@ class OpenGLNativeShader(
|
||||
private val vertex: ResourceLocation,
|
||||
private val geometry: ResourceLocation?,
|
||||
private val fragment: ResourceLocation,
|
||||
val system: OpenGLRenderSystem = context.system.unsafeCast(),
|
||||
) : NativeShader {
|
||||
override var loaded: Boolean = false
|
||||
private set
|
||||
@ -98,8 +100,6 @@ class OpenGLNativeShader(
|
||||
glDeleteShader(program)
|
||||
}
|
||||
loaded = true
|
||||
|
||||
context.system.nativeShaders += this
|
||||
}
|
||||
|
||||
override fun unload() {
|
||||
@ -107,7 +107,6 @@ class OpenGLNativeShader(
|
||||
glDeleteProgram(this.handler)
|
||||
loaded = false
|
||||
this.handler = -1
|
||||
context.system.nativeShaders -= this
|
||||
}
|
||||
|
||||
override fun reload() {
|
||||
|
@ -50,7 +50,6 @@ class OpenGLRenderSystem(
|
||||
private val context: RenderContext,
|
||||
) : RenderSystem {
|
||||
private var thread: Thread? = null
|
||||
override val nativeShaders: MutableSet<NativeShader> = mutableSetOf()
|
||||
override val shaders: MutableSet<Shader> = mutableSetOf()
|
||||
private val capabilities: MutableSet<RenderingCapabilities> = RenderingCapabilities.set()
|
||||
override lateinit var vendor: OpenGLVendor
|
||||
@ -84,7 +83,7 @@ class OpenGLRenderSystem(
|
||||
|
||||
check(value is OpenGLNativeShader) { "Can not use non OpenGL shader in OpenGL render system!" }
|
||||
check(value.loaded) { "Shader not loaded!" }
|
||||
check(value in nativeShaders) { "Shader not part of this context!" }
|
||||
check(this === value.system) { "Shader not part of this context!" }
|
||||
|
||||
value.unsafeUse()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user