"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.createViewportQuadBuilder = createViewportQuadBuilder;
const AttributeMap_1 = require("../AttributeMap");
const ShaderBuilder_1 = require("../ShaderBuilder");
// Positions are in NDC [-1..1]. Compute UV params in [0..1]
const computeTexCoord = "v_texCoord = (rawPosition.xy + 1.0) * 0.5;";
const computePosition = "return rawPos;";
function addTexture(prog) {
    prog.addInlineComputedVarying("v_texCoord", 3 /* VariableType.Vec2 */, computeTexCoord);
}
/** @internal */
function createViewportQuadBuilder(textured, attrMapOverride) {
    const attrMap = undefined !== attrMapOverride ? attrMapOverride : AttributeMap_1.AttributeMap.findAttributeMap(undefined, false);
    const prog = new ShaderBuilder_1.ProgramBuilder(attrMap);
    prog.vert.set(10 /* VertexShaderComponent.ComputePosition */, computePosition);
    if (textured) {
        addTexture(prog);
    }
    return prog;
}
//# sourceMappingURL=ViewportQuad.js.map