Shadow demo causing exception in Windows 10

Home Forums Real-Time 3D Rendering with DirectX and HLSL Shadow demo causing exception in Windows 10

This topic contains 3 replies, has 2 voices, and was last updated by  jcomputer 1 year ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #441

    jcomputer
    Participant

    Hi Paul,

    I have been using your book to learn D3D programming. All the examples worked fine under Windows 8. The system was upgraded to Windows 10 and I recompiled all the program under VS2015 without any problem but only the shadow map demo, when starting, gave a strange exception:

    Exception thrown at 0x0FAE2C02 (d3d11_3SDKLayers.dll) in ShadowMappingDemo.exe: 0xC0000005: Access violation reading location 0x3C8EFA35.

    The actual function causing the problem is this:
    mDirect3DDeviceContext->PSSetShaderResources(startSlot, count, &emptySRV);

    in the void ShadowMappingDemo::Draw(const GameTime& gameTime) function.

    Did you know what possibly cause this error? I didn’t have this before the windows 10 upgrade. I tried the same demo on a different machine running windows 10 and it has the same problem.

    Thanks
    Jeff

    #442

    Paul Varcholik
    Keymaster

    Hello Jeff,

    I’m running on Windows 10 and I don’t see this error. There are two calls to mGame->UnbindPixelShaderResources(0, 3) from ShadowMappingDemo::Draw; on lines 252 and 278. That method calls PSSetShaderResources using an empty array of shader resource views (to unbind the textures associated with the pixel shader).

    I suspect it’s one of those UnbindPixelShaderResources calls that’s causing the error. Have you stepped through the code to see which? And/or examined the call stack and local variables? Might something be null that should not be?

    Paul

    #443

    jcomputer
    Participant

    Hi Paul,

    Thanks very much for coming back to me for this. I didn’t change the code, the call stack is like:
    d3d11_3SDKLayers.dll!0fd22c02() Unknown
    [Frames below may be incorrect and/or missing, no symbols loaded for d3d11_3SDKLayers.dll]
    [External Code]
    > ShadowMappingDemo.exe!Library::Game::UnbindPixelShaderResources(unsigned int startSlot, unsigned int count) Line 228 C++
    ShadowMappingDemo.exe!Rendering::ShadowMappingDemo::Draw(const Library::GameTime & gameTime) Line 252 C++
    ShadowMappingDemo.exe!Library::Game::Draw(const Library::GameTime & gameTime) Line 214 C++
    ShadowMappingDemo.exe!Rendering::RenderingGame::Draw(const Library::GameTime & gameTime) Line 113 C++
    ShadowMappingDemo.exe!Library::Game::Run() Line 158 C++
    ShadowMappingDemo.exe!WinMain(HINSTANCE__ * instance, HINSTANCE__ * previousInstance, char * commandLine, int showCommand) Line 25 C++
    [External Code]

    And the local variable looks like these:

    +&emptySRV 0x015df268 {ShadowMappingDemo.exe!ID3D11ShaderResourceView *emptySRV} {0x00000000 <NULL>} ID3D11ShaderResourceView * *
    count 3 unsigned int
    +emptySRV 0x00000000 <NULL> ID3D11ShaderResourceView *
    +mDirect3DDeviceContext 0x019259e0 <Information not available, no symbols loaded for d3d11_3SDKLayers.dll> ID3D11DeviceContext1 *
    startSlot 0 unsigned int
    +this 0x018fa5f8 {mDirectInput=0x01920ff0 <Information not available, no symbols loaded for dinput8.dll> mKeyboard=…} Library::Game * {Rendering::RenderingGame}

    I don’t see any thing suspicious here (e.g. null object etc..)

    thanks
    Jeff

    #444

    jcomputer
    Participant

    Hi Paul,

    It seems to me the declaration of empty SVR array causes the problem, although I don’t understand why it worked fine before in Windows8 but not the Windows10.(same hardware, a Alienware laptop with NVidia 860m graphics)

    I did a small experiment and change the code as follows:
    void Game::UnbindPixelShaderResources(UINT startSlot,const UINT count)
    {
    for (int i=0;i<count;i++){
    ID3D11ShaderResourceView* const emptySRV[1] = { nullptr};
    mDirect3DDeviceContext->PSSetShaderResources(startSlot+i, 1, emptySRV);
    }
    }
    I do not think it is efficient but the demo work fine without throwing the exception.

    Any thought on this?

    thanks
    Jeff

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.