Why does swapChain.ResizeBuffers throw a SharpDX.SharpDXException?

0

I am developing a SharpDX game and I am trying to implement window resizing, but when I try to call my SetResolution method, It throws a SharpDX.SharpDXException and I don't know why.

Am I doing something wrong, or am I missing something?

Here is my current resize code:

public static void SetResolution(int width, int height)
{
    viewport.Width = width;
    viewport.Height = height;

    swapChain.ResizeBuffers(1, width, height, Format.R8G8B8A8_UNorm, SwapChainFlags.None); 
    /*
     * Exception thrown: 'SharpDX.SharpDXException' in SharpDX.dll
     * An unhandled exception of type 'SharpDX.SharpDXException' occurred in SharpDX.dll
     * HRESULT: [0x887A0001], Module: [SharpDX.DXGI], ApiCode: [DXGI_ERROR_INVALID_CALL/InvalidCall], 
     * Message: The application made a call that is invalid. Either the parameters of the call or the state 
     * of some object was incorrect
     */
}

This error makes no sense to me, and I can't find any other information about it.

c#
directx-11
sharpdx
direct3d11
asked on Stack Overflow Aug 23, 2020 by BendedWills

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0