aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/util/mc/CustomRenderPassHelper.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/util/mc/CustomRenderPassHelper.kt')
-rw-r--r--src/main/kotlin/util/mc/CustomRenderPassHelper.kt8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/kotlin/util/mc/CustomRenderPassHelper.kt b/src/main/kotlin/util/mc/CustomRenderPassHelper.kt
index 12f98e4..295f727 100644
--- a/src/main/kotlin/util/mc/CustomRenderPassHelper.kt
+++ b/src/main/kotlin/util/mc/CustomRenderPassHelper.kt
@@ -34,6 +34,7 @@ class CustomRenderPassHelper(
private val preparations = mutableListOf<(RenderPass) -> Unit>()
val device = RenderSystem.getDevice()
private var hasPipelineAction = false
+ private var hasSetDefaultUniforms = false
val commandEncoder = device.createCommandEncoder()
fun setPipeline(pipeline: RenderPipeline) {
ErrorUtil.softCheck("Already has a pipeline", !hasPipelineAction)
@@ -51,7 +52,13 @@ class CustomRenderPassHelper(
queueAction { it.bindSampler(name, texture.glTextureView) }
}
+
+ fun dontSetDefaultUniforms() {
+ hasSetDefaultUniforms = true
+ }
+
fun setAllDefaultUniforms() {
+ hasSetDefaultUniforms = true
queueAction {
RenderSystem.bindDefaultUniforms(it)
}
@@ -129,6 +136,7 @@ class CustomRenderPassHelper(
fun draw(): DrawToken {
val vertexData = (ErrorUtil.notNullOr(vertices, "No vertex data uploaded") { return DrawToken })
+ ErrorUtil.softCheck("Missing default uniforms", hasSetDefaultUniforms)
ErrorUtil.softCheck("Missing a pipeline", hasPipelineAction)
val renderPass = queueClose(
commandEncoder.createRenderPass(