import { _decorator, Component, director, game, Node } from 'cc';

const { ccclass, property } = _decorator;

@ccclass('test')
export class test extends Component {


    start() {

        this.scheduleOnce(() => {
            director.purgeDirector()
            // this.showGPU()
            this.loadScene("scene2")

        },0.5)
    }

    update(deltaTime: number) {
        
    }


    loadScene(_scene){
        director.loadScene(_scene, () => {

            }
        );

    }

    showGPU(){

        const device = director.root?.device;
            const bufferSizeMB = device?.memoryStatus.bufferSize / (1024 * 1024);
            console.log('GPU scene',device?.memoryStatus.bufferSize, JSON.stringify({
                // textures: device?.memoryStatus.textureSize,    // 纹理内存
                buffers: bufferSizeMB+"MB",     // 顶点/索引缓冲
                // drawCalls: device?.numDrawCalls,
                // numTris: device?.numTris,
                // bufferMemory:gpuInfo.bufferMemory.counter.value ,
                // textureMemory:gpuInfo.textureMemory.counter.value

                // framebuffers: device.memoryStatus.fboSize,   // 帧缓冲对象
                // programs: device.memoryStatus.programSize    // 着色器程序
            }))

    }
}


