API EnumOutputs在Win8 / Windows 8上失败DXGI_ERROR_NOT_FOUND

时间:2013-11-23 13:05:07

标签: windows directx directx-11 directx-10

与win7相比,我们的产品在win8上的表现太奇怪了。所以尝试了PNTriangles11 DX SDK示例并获得了相同的结果。这是在测试BestBuy的行为后,24个系统的行为都相同,所有调用EnumOutputs都失败了。无论是台式机,笔记本电脑,一体机还是平板电脑都没关系。

PNTriangles11 color problem

我们的directx图表产品看起来像......还显示了我们的WPF图表组件,以及由同样的故障问题引起的更多亮度变化。

DirectX charting component color problem, DirectX WPF Charting component

所以这导致了研究,我发现我可以通过添加以下内容在Win7上重现......

HRESULT CD3D11Enumeration::EnumerateOutputs( CD3D11EnumAdapterInfo* pAdapterInfo )
{
HRESULT hr;
IDXGIOutput* pOutput;

for( int iOutput = 0; ; ++iOutput )
{
    pOutput = NULL;
    hr = pAdapterInfo->m_pAdapter->EnumOutputs( iOutput, &pOutput );

// FORCE FAILURE ON WIN7 FOR TESTING PURPOSES
hr = DXGI_ERROR_NOT_FOUND;

    if( DXGI_ERROR_NOT_FOUND == hr )
    {
        return S_OK;
    }
    else if( FAILED( hr ) )
    {
        return hr;  //Something bad happened.
    }
    else //Success!
    {
        CD3D11EnumOutputInfo* pOutputInfo = new CD3D11EnumOutputInfo;
        if( !pOutputInfo

虽然要在Win8和Win7上运行sdk示例,但您还需要修改(为非零hAdapterMonitor添加测试......

// Check to see if the window needs to be resized.  
// Handle cases where the window is minimized and maxmimized as well.

bool bNeedToResize = false;
if(hAdapterMonitor && DXUTGetIsWindowedFromDS( pNewDeviceSettings ) && 
!bKeepCurrentWindowSize )      
{
    UINT nClientWidth;
    UINT nClientHeight;
    if( IsIconic( DXUTGetHWNDDeviceWindowed() ) )
    {

以上允许您修改win7上的问题,作为开发win8的方法。

所以我的问题是,在Win8上处理EnumOutputs失败的最佳解决方案是什么。或者您认为DXUT的其他变化有用。

微软正在研究这个问题,我希望很快就会发布他们的回复,但是需要讨论这个主题,因为许多dxut启发的软件项目或那些使用EnumOutputs的人在Win8上失败了。

回答1:微软确实回复了我的初步回应,让PNTriangles11在Win8上工作。他们指出我在DXUTApplyDefaultDeviceSettings(DXUTDeviceSettings * modifySettings)中的变化......

modifySettings->d3d11.sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;

必须改为......

modifySettings->d3d11.sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; 

但仍需要DXUTChangeDevice的简单解决方法:测试非零hAdapterMonitor ......

bool bNeedToResize = false;
if(hAdapterMonitor && DXUTGetIsWindowedFromDS( pNewDeviceSettings ) && !bKeepCurrentWindowSize ) 
{
    UINT nClientWidth;
    UINT nClientHeight;
    if( ::IsIconic( DXUTGetHWNDDeviceWindowed() ) )
    {
        // Window is currently minimized. To tell if it needs to resize, 

还在等待微软的解释为什么EnumOutputs在我在BestBuy上测试的所有24个系统上都失败了。

0 个答案:

没有答案
相关问题