DX Sample Tutorial07 crached in pix for windows

Started by
1 comment, last by db123 10 years, 1 month ago

i want to debug this tutorial in pix for windows, but it crashed when CreateRenderTargetView

the output message is


D3D11 CORRUPTION: ID3D11Device::CreateRenderTargetView: First parameter is corrupt! [ MISCELLANEOUS CORRUPTION #13: CORRUPTED_PARAMETER1]

the call stack is


 	KernelBase.dll!_RaiseException@16()	??
 	d3d11_1sdklayers.dll!ReportCorruption(unsigned int,enum D3D11_MESSAGE_ID,char const *,...)	??
 	d3d11_1sdklayers.dll!NDebug::CInterfaceSentinel::CFunctionSentinel::ReportMessageAndRaiseException(enum D3D11_MESSAGE_ID,char const *,...)	??
 	d3d11_1sdklayers.dll!NDebug::CDevice::CreateRenderTargetViewPreValidation(class NDebug::CInterfaceSentinel::CFunctionSentinel &,struct ID3D11Resource *,struct D3D11_RENDER_TARGET_VIEW_DESC const *,struct IUnknown * *)	??
 	d3d11_1sdklayers.dll!NDebug::CDevice::CreateRenderTargetView(struct ID3D11Resource *,struct D3D11_RENDER_TARGET_VIEW_DESC const *,struct ID3D11RenderTargetView * *)	??
 	PIXHelper.dll!CHookedID3D11Device::CreateRenderTargetView(struct ID3D11Resource *,struct D3D11_RENDER_TARGET_VIEW_DESC const *,struct ID3D11RenderTargetView * *)	??
>	PIXHelper.dll!CSpyHookedID3D11Device::CreateRenderTargetView(struct ID3D11Resource *,struct D3D11_RENDER_TARGET_VIEW_DESC const *,struct ID3D11RenderTargetView * *)	??
 	Tutorial07.exe!InitDevice() ? 255	C++
 	Tutorial07.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) ? 93	C++
 	Tutorial07.exe!__tmainCRTStartup() ? 528	C
 	Tutorial07.exe!wWinMainCRTStartup() ? 377	C
 	kernel32.dll!@BaseThreadInitThunk@12()	??
 	ntdll.dll!___RtlUserThreadStart@8()	??
 	ntdll.dll!__RtlUserThreadStart@8()	??

code :


HRESULT InitDevice()
{
    HRESULT hr = S_OK;

    RECT rc;
    GetClientRect( g_hWnd, &rc );
    UINT width = rc.right - rc.left;
    UINT height = rc.bottom - rc.top;

    UINT createDeviceFlags = 0;
#ifdef _DEBUG
    createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif

    D3D_DRIVER_TYPE driverTypes[] =
    {
        D3D_DRIVER_TYPE_HARDWARE,
        D3D_DRIVER_TYPE_WARP,
        D3D_DRIVER_TYPE_REFERENCE,
    };
    UINT numDriverTypes = ARRAYSIZE( driverTypes );

    D3D_FEATURE_LEVEL featureLevels[] =
    {
        D3D_FEATURE_LEVEL_11_0,
        D3D_FEATURE_LEVEL_10_1,
        D3D_FEATURE_LEVEL_10_0,
    };
    UINT numFeatureLevels = ARRAYSIZE( featureLevels );

    DXGI_SWAP_CHAIN_DESC sd;
    ZeroMemory( &sd, sizeof( sd ) );
    sd.BufferCount = 1;
    sd.BufferDesc.Width = width;
    sd.BufferDesc.Height = height;
    sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    sd.BufferDesc.RefreshRate.Numerator = 60;
    sd.BufferDesc.RefreshRate.Denominator = 1;
    sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
    sd.OutputWindow = g_hWnd;
    sd.SampleDesc.Count = 1;
    sd.SampleDesc.Quality = 0;
    sd.Windowed = TRUE;

    for( UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++ )
    {
        g_driverType = driverTypes[driverTypeIndex];
        hr = D3D11CreateDeviceAndSwapChain( NULL, g_driverType, NULL, createDeviceFlags, featureLevels, numFeatureLevels,
                                            D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, &g_featureLevel, &g_pImmediateContext );
        if( SUCCEEDED( hr ) )
            break;
    }
    if( FAILED( hr ) )
        return hr;

    ::MessageBox(g_hWnd, 0,0,0);
    // Create a render target view
    ID3D11Texture2D* pBackBuffer = NULL;
    hr = g_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), ( LPVOID* )&pBackBuffer );
    if( FAILED( hr ) )
        return hr;

    hr = g_pd3dDevice->CreateRenderTargetView( pBackBuffer, NULL, &g_pRenderTargetView );
    pBackBuffer->Release();
    if( FAILED( hr ) )
        return hr;

is there any known solution?

Advertisement

http://www.gamedev.net/topic/639532-d3d11createdevice-failed/

http://www.gamedev.net/topic/639533-is-anyone-elses-pix-for-windows-crashing-since-the-latest-windows-update/

but i have install vs2012/vs2013..

my operation system is windows 7 64bit sp1

graphics card : gtx660.

This topic is closed to new replies.

Advertisement