add todo and optimized imports
This commit is contained in:
@@ -14,6 +14,7 @@ import static org.lwjgl.opengl.GL30.glBindBufferRange;
|
||||
import static org.lwjgl.opengl.GL31.GL_UNIFORM_BUFFER;
|
||||
import static org.lwjgl.opengl.GL33.glBindSampler;
|
||||
import static org.lwjgl.opengl.GL43.GL_SHADER_STORAGE_BUFFER;
|
||||
import static org.lwjgl.opengl.GL44.*;
|
||||
|
||||
|
||||
//TODO: rewrite the entire shader builder system
|
||||
@@ -26,6 +27,8 @@ public class AutoBindingShader extends Shader {
|
||||
private final List<BufferBinding> bindings = new ArrayList<>();
|
||||
private final List<TextureBinding> textureBindings = new ArrayList<>();
|
||||
|
||||
private boolean rebuild = true;
|
||||
|
||||
AutoBindingShader(Shader.Builder<AutoBindingShader> builder, int program) {
|
||||
super(program);
|
||||
this.defines = builder.defines;
|
||||
@@ -70,6 +73,8 @@ public class AutoBindingShader extends Shader {
|
||||
}
|
||||
|
||||
private void insertOrReplaceBinding(BufferBinding binding) {
|
||||
this.rebuild = true;
|
||||
|
||||
//Check if there is already a binding at the index with the target, if so, replace it
|
||||
for (int i = 0; i < this.bindings.size(); i++) {
|
||||
var entry = this.bindings.get(i);
|
||||
@@ -92,6 +97,16 @@ public class AutoBindingShader extends Shader {
|
||||
}
|
||||
|
||||
public AutoBindingShader texture(int unit, int sampler, GlTexture texture) {
|
||||
this.rebuild = true;
|
||||
|
||||
for (int i = 0; i < this.textureBindings.size(); i++) {
|
||||
var entry = this.textureBindings.get(i);
|
||||
if (entry.unit == unit) {
|
||||
this.textureBindings.set(i, new TextureBinding(unit, sampler, texture));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
this.textureBindings.add(new TextureBinding(unit, sampler, texture));
|
||||
return this;
|
||||
}
|
||||
@@ -99,6 +114,13 @@ public class AutoBindingShader extends Shader {
|
||||
@Override
|
||||
public void bind() {
|
||||
super.bind();
|
||||
//TODO: replace with multibind and use the invalidate flag
|
||||
/*
|
||||
glBindSamplers();
|
||||
glBindTextures();
|
||||
glBindBuffersBase();
|
||||
glBindBuffersRange();
|
||||
*/
|
||||
if (!this.bindings.isEmpty()) {
|
||||
for (var binding : this.bindings) {
|
||||
binding.buffer.assertNotFreed();
|
||||
|
||||
@@ -7,11 +7,10 @@ import me.cortex.voxy.client.core.gl.GlBuffer;
|
||||
import me.cortex.voxy.client.core.gl.shader.AutoBindingShader;
|
||||
import me.cortex.voxy.client.core.gl.shader.Shader;
|
||||
import me.cortex.voxy.client.core.gl.shader.ShaderType;
|
||||
import me.cortex.voxy.client.core.rendering.building.RenderGenerationService;
|
||||
import me.cortex.voxy.client.core.rendering.util.PrintfDebugUtil;
|
||||
import me.cortex.voxy.client.core.rendering.util.HiZBuffer;
|
||||
import me.cortex.voxy.client.core.rendering.Viewport;
|
||||
import me.cortex.voxy.client.core.rendering.building.RenderGenerationService;
|
||||
import me.cortex.voxy.client.core.rendering.util.DownloadStream;
|
||||
import me.cortex.voxy.client.core.rendering.util.PrintfDebugUtil;
|
||||
import me.cortex.voxy.client.core.rendering.util.UploadStream;
|
||||
import me.cortex.voxy.common.util.MemoryBuffer;
|
||||
import me.cortex.voxy.common.world.WorldEngine;
|
||||
|
||||
@@ -3,7 +3,6 @@ package me.cortex.voxy.client.core.rendering.section;
|
||||
import me.cortex.voxy.client.core.gl.GlBuffer;
|
||||
import me.cortex.voxy.client.core.rendering.Viewport;
|
||||
import me.cortex.voxy.client.core.rendering.hierachical.HierarchicalOcclusionTraverser;
|
||||
import me.cortex.voxy.client.core.rendering.util.HiZBuffer;
|
||||
|
||||
public class MDICViewport extends Viewport<MDICViewport> {
|
||||
public final GlBuffer drawCountCallBuffer = new GlBuffer(1024).zero();
|
||||
|
||||
Reference in New Issue
Block a user