Direct3D11在调试程序运行时发出声音

Direct3D11 makes a sound while debug program is running

本文关键字:声音 运行时 调试程序 Direct3D11      更新时间:2023-10-16

我有一个简单的块旋转应用程序(基本上是d3d11 Hello World!),但每当我运行它时,我都能听到可听到的噪音。

我试图遍历代码以查看使噪音"发生"的调用,但我无法在任何D3Dinit中找到它。

这是我用来初始化的代码:
    HRESULT hr = D3D11CreateDevice(
        0,                 // default adapter
        md3dDriverType,
        0,                 // no software device
        createDeviceFlags, 
        0, 0,              // default feature level array
        D3D11_SDK_VERSION,
        &md3dDevice,
        &featureLevel,
        &md3dImmediateContext);

这里是我连接接口和创建交换缓冲区的地方(注意,HR()只是一个宏,如果调试打开,将显示HRESULTS)

    IDXGIDevice* dxgiDevice = 0;
HR(md3dDevice->QueryInterface(__uuidof(IDXGIDevice), (void**)&dxgiDevice));
IDXGIAdapter* dxgiAdapter = 0;
HR(dxgiDevice->GetParent(__uuidof(IDXGIAdapter), (void**)&dxgiAdapter));
IDXGIFactory* dxgiFactory = 0;
HR(dxgiAdapter->GetParent(__uuidof(IDXGIFactory), (void**)&dxgiFactory));
HR(dxgiFactory->CreateSwapChain(md3dDevice, &sd, &mSwapChain));

有谁知道是什么导致这种声音发生的吗?

当帧率非常高时,我注意到一些显卡上出现了这种情况。启用垂直同步通常可以消除这种声音。

http://www.techpowerup.com/forums/threads/whine-from-gpu-under-high-frame-rate.157681/

视频中听不清,但很明显

http://www.youtube.com/watch?v=3ibkMvhMlgs