import { native_ } from './Constants';
export class GPUComputePassEncoder {
    get label() {
        return this[native_]?.label ?? '';
    }
    dispatchWorkgroups(workgroupCountX, workgroupCountY = 1, workgroupCountZ = 1) {
        this[native_].dispatchWorkgroups(workgroupCountX, workgroupCountY ?? 1, workgroupCountZ ?? 1);
    }
    dispatchWorkgroupsIndirect(indirectBuffer, indirectOffset) {
        this[native_].dispatchWorkgroupsIndirect(indirectBuffer[native_], indirectOffset);
    }
    end() {
        this[native_].end();
        this[native_] = null;
    }
    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);
        }
    }
    setPipeline(renderPipeline) {
        this[native_].setPipeline(renderPipeline[native_]);
    }
    static fromNative(pass) {
        if (pass) {
            const ret = new GPUComputePassEncoder();
            ret[native_] = pass;
            return ret;
        }
        return null;
    }
}
//# sourceMappingURL=GPUComputePassEncoder.js.map