import { native_ } from './Constants';
export class GPURenderPassEncoder {
    get label() {
        return this[native_]?.label ?? '';
    }
    beginOcclusionQuery(queryIndex) {
        this[native_].beginOcclusionQuery(queryIndex);
    }
    draw(vertexCount, instanceCount = 1, firstVertex = 0, firstInstance = 0) {
        this[native_].draw(vertexCount, instanceCount ?? 1, firstVertex ?? 0, firstInstance ?? 0);
    }
    drawIndexed(indexCount, instanceCount = 1, firstVertex = 0, firstInstance = 0) {
        this[native_].drawIndexed(indexCount, instanceCount ?? 1, firstVertex ?? 0, firstInstance ?? 0);
    }
    drawIndexedIndirect(indirectBuffer, indirectOffset) {
        this[native_].drawIndexedIndirect(indirectBuffer[native_], indirectOffset);
    }
    drawIndirect(indirectBuffer, indirectOffset) {
        this[native_].drawIndirect(indirectBuffer[native_], indirectOffset);
    }
    end() {
        this[native_].end();
    }
    endOcclusionQuery() {
        this[native_].endOcclusionQuery();
    }
    executeBundles(bundles) {
        if (Array.isArray(bundles)) {
            this[native_].executeBundles(bundles.map((bundle) => bundle[native_]));
        }
    }
    insertDebugMarker(markerLabel) {
        this[native_].insertDebugMarker(markerLabel);
    }
    popDebugGroup() {
        this[native_].popDebugGroup();
    }
    pushDebugGroup(groupLabel) {
        this[native_].pushDebugGroup(groupLabel);
    }
    setBindGroup(index, bindGroup, dynamicOffsetsData, dynamicOffsetsDataStart, dynamicOffsetsDataLength) {
        const group = bindGroup?.[native_];
        if (!group) {
            return;
        }
        if (Array.isArray(dynamicOffsetsData)) {
            const data = new Uint32Array(dynamicOffsetsData);
            this[native_].setBindGroup(index, group, data, 0, data.length);
        }
        else if (dynamicOffsetsData instanceof Uint32Array) {
            this[native_].setBindGroup(index, group, dynamicOffsetsData, dynamicOffsetsDataStart, dynamicOffsetsDataLength);
        }
        else {
            this[native_].setBindGroup(index, group);
        }
    }
    setBlendConstant(color) {
        if (Array.isArray(color)) {
            this[native_].setBlendConstant({
                r: color[0],
                g: color[1],
                b: color[2],
                a: color[3],
            });
        }
        else {
            this[native_].setBlendConstant(color);
        }
    }
    setIndexBuffer(buffer, indexFormat, offset, size) {
        this[native_].setIndexBuffer(buffer[native_], indexFormat, offset ?? 0, size ?? buffer.size - (offset ?? 0));
    }
    setPipeline(renderPipeline) {
        this[native_].setPipeline(renderPipeline[native_]);
    }
    setScissorRect(x, y, width, height) {
        this[native_].setScissorRect(x, y, width, height);
    }
    setStencilReference(reference) {
        this[native_].setStencilReference(reference);
    }
    setVertexBuffer(slot, buffer, offset, size) {
        this[native_].setVertexBuffer(slot, buffer[native_], offset ?? 0, size ?? buffer.size - (offset ?? 0));
    }
    setViewport(x, y, width, height, minDepth, maxDepth) {
        this[native_].setViewport(x, y, width, height, minDepth, maxDepth);
    }
    static fromNative(pass) {
        if (pass) {
            const ret = new GPURenderPassEncoder();
            ret[native_] = pass;
            return ret;
        }
        return null;
    }
}
//# sourceMappingURL=GPURenderPassEncoder.js.map