mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-22 05:12:16 +00:00
Initial commit for shader-loading-optimizations (#2213)
This commit is contained in:
1 parent
10922edca3
commit
38af64f10c
35 files changed
+1239
-194
No files matched your search
@@ -5,6 +5,7 @@ import net.coderbot.iris.gl.GlResource;
|
||||
import net.coderbot.iris.gl.blending.DepthColorStorage;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.lwjgl.opengl.GL42;
|
||||
import org.lwjgl.opengl.GL43;
|
||||
|
||||
@@ -25,9 +26,14 @@ public final class Program extends GlResource {
|
||||
@Getter
|
||||
private final ProgramImages images;
|
||||
|
||||
Program(int program, ProgramUniforms uniforms, ProgramSamplers samplers, ProgramImages images) {
|
||||
@Nullable
|
||||
private final RetainedPrograms.Sources sources;
|
||||
|
||||
Program(int program, @Nullable RetainedPrograms.Sources sources, ProgramUniforms uniforms, ProgramSamplers samplers, ProgramImages images) {
|
||||
super(program);
|
||||
|
||||
this.sources = sources;
|
||||
|
||||
this.uniforms = uniforms;
|
||||
this.samplers = samplers;
|
||||
this.images = images;
|
||||
@@ -63,7 +69,11 @@ public final class Program extends GlResource {
|
||||
@Override
|
||||
public void destroyInternal() {
|
||||
DepthColorStorage.unregisterOwnedProgram(getGlId());
|
||||
GLStateManager.glDeleteProgram(getGlId());
|
||||
if (sources != null) {
|
||||
RetainedPrograms.retain(sources, getGlId());
|
||||
} else {
|
||||
GLStateManager.glDeleteProgram(getGlId());
|
||||
}
|
||||
}
|
||||
|
||||
public int getProgramId() {
|
||||
|
||||
Reference in new issue
Block a user