"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module WebGL
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.addRenderPass = addRenderPass;
// render passes actually used in shader code.
const renderPasses = [
    [0 /* RenderPass.Background */, "Background"],
    [1 /* RenderPass.OpaqueLayers */, "Layers"], // Shaders treat all layer passes the same
    [2 /* RenderPass.OpaqueLinear */, "OpaqueLinear"],
    [3 /* RenderPass.OpaquePlanar */, "OpaquePlanar"],
    [5 /* RenderPass.OpaqueGeneral */, "OpaqueGeneral"],
    [6 /* RenderPass.Classification */, "Classification"],
    [8 /* RenderPass.Translucent */, "Translucent"],
    [9 /* RenderPass.HiddenEdge */, "HiddenEdge"],
    [10 /* RenderPass.Hilite */, "Hilite"],
    [12 /* RenderPass.WorldOverlay */, "WorldOverlay"],
    [13 /* RenderPass.ViewOverlay */, "ViewOverlay"],
    [19 /* RenderPass.PlanarClassification */, "PlanarClassification"],
];
/**
 * Adds a uniform holding the current render pass and a set of kRenderPass_* constants
 * uniform float u_renderPass
 * @internal
 */
function addRenderPass(builder) {
    builder.addUniform("u_renderPass", 2 /* VariableType.Float */, (prog) => {
        prog.addProgramUniform("u_renderPass", (uniform, params) => {
            let renderPass = params.renderPass;
            switch (renderPass) {
                case 9 /* RenderPass.HiddenEdge */:
                    renderPass = 5 /* RenderPass.OpaqueGeneral */; // no distinction from shader POV...
                    break;
                case 11 /* RenderPass.OverlayLayers */:
                case 7 /* RenderPass.TranslucentLayers */:
                    renderPass = 1 /* RenderPass.OpaqueLayers */; // no distinction from shader POV...
                    break;
            }
            uniform.setUniform1f(renderPass);
        });
    });
    for (const renderPass of renderPasses)
        builder.addGlobal(`kRenderPass_${renderPass[1]}`, 2 /* VariableType.Float */, `${renderPass[0].toString()}.0`, true);
}
//# sourceMappingURL=RenderPass.js.map