Search in sources :

Example 1 with GbufferProgram

use of net.coderbot.iris.layer.GbufferProgram in project Iris by IrisShaders.

the class DeferredWorldRenderingPipeline method popProgram.

@Override
public void popProgram(GbufferProgram expected) {
    checkWorld();
    if (!isRenderingWorld || isRenderingShadow) {
        // don't mess with non-world rendering
        return;
    }
    if (programStack.isEmpty()) {
        Iris.logger.fatal("Tried to pop from an empty program stack!");
        Iris.logger.fatal("Program stack log: " + programStackLog);
        throw new IllegalStateException("Tried to pop from an empty program stack!");
    }
    // Equivalent to pop(), but a bit more verbose.
    // This shouldn't have the same performance issues that remove() normally has since we're removing from the end
    // every time.
    GbufferProgram popped = programStack.remove(programStack.size() - 1);
    if (popped != expected) {
        Iris.logger.fatal("Program stack in invalid state, popped " + popped + " but expected to pop " + expected);
        Iris.logger.fatal("Program stack content after pop: " + programStack);
        throw new IllegalStateException("Program stack in invalid state, popped " + popped + " but expected to pop " + expected);
    }
    if (popped != GbufferProgram.NONE) {
        Pass poppedPass = getPass(popped);
        if (poppedPass != null) {
            poppedPass.stopUsing();
        }
    }
    programStackLog.add("pop:" + popped);
    if (programStack.isEmpty()) {
        // No remaining program, use fixed-function rendering
        teardownProgram();
        return;
    }
    // Use the previous program
    GbufferProgram toUse = programStack.get(programStack.size() - 1);
    useProgram(toUse);
}
Also used : GbufferProgram(net.coderbot.iris.layer.GbufferProgram) AlphaTestOverride(net.coderbot.iris.gl.blending.AlphaTestOverride) BlendModeOverride(net.coderbot.iris.gl.blending.BlendModeOverride)

Example 2 with GbufferProgram

use of net.coderbot.iris.layer.GbufferProgram in project Iris by IrisShaders.

the class DeferredWorldRenderingPipeline method beginTranslucents.

@Override
public void beginTranslucents() {
    isBeforeTranslucent = false;
    // We need to copy the current depth texture so that depthtex1 can contain the depth values for
    // all non-translucent content, as required.
    baseline.bind();
    GlStateManager._bindTexture(renderTargets.getDepthTextureNoTranslucents().getTextureId());
    IrisRenderSystem.copyTexImage2D(GL20C.GL_TEXTURE_2D, 0, GL20C.GL_DEPTH_COMPONENT, 0, 0, renderTargets.getCurrentWidth(), renderTargets.getCurrentHeight(), 0);
    GlStateManager._bindTexture(0);
    deferredRenderer.renderAll();
    Program.unbind();
    RenderSystem.enableBlend();
    RenderSystem.enableAlphaTest();
    Minecraft.getInstance().gameRenderer.lightTexture().turnOnLightLayer();
    Minecraft.getInstance().gameRenderer.overlayTexture().setupOverlayColor();
    if (!programStack.isEmpty()) {
        GbufferProgram toUse = programStack.get(programStack.size() - 1);
        useProgram(toUse);
    } else {
        useProgram(GbufferProgram.NONE);
        baseline.bind();
    }
}
Also used : GbufferProgram(net.coderbot.iris.layer.GbufferProgram) AlphaTestOverride(net.coderbot.iris.gl.blending.AlphaTestOverride) BlendModeOverride(net.coderbot.iris.gl.blending.BlendModeOverride)

Aggregations

AlphaTestOverride (net.coderbot.iris.gl.blending.AlphaTestOverride)2 BlendModeOverride (net.coderbot.iris.gl.blending.BlendModeOverride)2 GbufferProgram (net.coderbot.iris.layer.GbufferProgram)2