I am developping an application using SharpDX and on one of my machines the call
_swapChain = new SwapChain(factory, _device, desc);
fails with the error message
HRESULT: [0x887A0001], Module: [SharpDX.DXGI], ApiCode: [DXGI_ERROR_INVALID_CALL/InvalidCall], Message: Unknown
When I googled the error I found this where it states:
DXGI_ERROR_INVALID_CALL (0x887A0001)
The application provided invalid parameter data; this must be debugged and fixed before the application is released.
But how?
The error message does not give me any indication whatsoever to why the creation failed.
I checked the debug layer output but that only shows Info. No Warning, no Error, nothing. The factory and the device are created just fine and I tried several combinations of parameters in my SwapChainDescription but the error always remains the same.
How am I supposed to find out what triggers the error?
Just to be clear: I am not so much looking for a solution for my specific problem as I am wondering how I would go about debugging such a problem in general.
This is the boiled down code:
const int MAXFPS = 60;
const Format PIXELFORMAT = Format.R8G8B8A8_UNorm;
// Create device
_device = new Device(DriverType.Hardware, DeviceCreationFlags.None); // Or DeviceCreationFlags.Debug
// SwapChain description
var desc = new SwapChainDescription()
{
BufferCount = 2, // I tried 1 too
ModeDescription = new ModeDescription(_renderSize.Width, _renderSize.Height,
new Rational(MAXFPS, 1), PIXELFORMAT),
IsWindowed = true,
OutputHandle = _hwnd,
SampleDescription = _samples,
SwapEffect = SwapEffect.Discard,
Usage = Usage.RenderTargetOutput
};
// Create SwapChain
var factory = new SharpDX.DXGI.Factory();
_swapChain = new SwapChain(factory, _device, desc);
I confirmed the sample description is valid using
_device.CheckMultisampleQualityLevels(PIXELFORMAT, _samples.Count) > _samples.Quality
(though, those are 1 and 0 anyway), that the format is supported using
_device.CheckFormatSupport(PIXELFORMAT).HasFlag(FormatSupport.RenderTarget)
and also checked that
_hwnd != IntPtr.Zero
_renderSize.Width > 0
_renderSize.Height > 0
What else to check?
Update: I was able to fix the problem following the advice from here:
I changed this
Device device = new Device(DriverType.Hardware, DeviceCreationFlags.None);
Factory factory = new Factory();
SwapChain swapChain = new SwapChain(factory, device, desc);
to
Factory factory = new Factory();
var adapter = factory.GetAdapter(0);
Device device = new Device(adapter, DeviceCreationFlags.None);
SwapChain swapChain = new SwapChain(factory, device, desc);
October 2013
— last edited
October 2013
Hey,
I’m having the same problem.
WHich setting option are you refer to as «Language Area»?
Is it the language of Windows, or location setting under Region in control panal?
Thanks a lot!
——————————————
Update:
OK, I think I understand your solution now
Control panel -> Time, Launguage and Region -> Region -> Administrative tab
Change Language for non-Unicode programs To English(US)
And DXGI_ERROR_INVALID_CALL error will no longer appear…
Всех приветствую, кто читает эту тему.
Проблема вот какая: после часа игры в marvel’s avengers вышла такая ошибка.
(0x887A0001: DXGI_ERROR_INVALID_CALL)»
Характеристики ПК:
Видеокарта: Palit RTX 3070 JetStream OC.
Процессор: i5-10400f
Оперативной памяти: 16 гб
Блок питания: 650W DEEPCOOL
*андервольт видеокарты уже делал, все работает хорошо. Прошёл всю сюжетку в рдр2 (не было вылетов)
*но были вылеты и в других играх, но это было до андервольта и там скорее всего был сделан не правильно андервольт.
*также хотел добавить, что монитор у меня стоит до исторический с переходником HDMI. (Может ли быть ещё в нем проблема ?)
Если кто то сталкивался с такой же проблемой даже если в другой игре но с такой же ошибкой — прошу помочь мне, за ранее всех благодарю ☺
- Remove From My Forums
-
Question
-
I am creating a simple video application in WinRT using DirectX. While calling IDXGISwapChain::ResizeBuffers method , sometimes I
get the error hr == DXGI_ERROR_INVALID_CALL(error code 0x887A0001). Any leads ? Here is the code snipet :
void Direct3DBase::CreateWindowSizeDependentResources(CoreWindow ^window, bool isWebcamShared, int scaledheightpercentage) { static ComPtr<IDXGISurface> dxgiBackBuffer = nullptr; static ComPtr<ID3D11Texture2D> backBuffer = nullptr; static ComPtr<ID2D1Bitmap1> targetBitmap = nullptr; static Microsoft::WRL::ComPtr<ISwapChainPanelNative> swapChainNative = nullptr; // Store the window bounds so the next time we get a SizeChanged event we can // avoid rebuilding everything if the size is identical. // m_windowBounds = m_swapChainPanel; m_coreWindow = window; m_windowBounds = m_coreWindow->Bounds; auto windowWidth = ConvertDipsToPixels(m_windowBounds.Width); auto windowHeight = ConvertDipsToPixels(m_windowBounds.Height); #if informwindowsoforientation m_orientation = DisplayProperties::CurrentOrientation; bool swapDimensions = ( m_orientation == DisplayOrientations::Portrait || m_orientation == DisplayOrientations::PortraitFlipped ); m_renderTargetSize.Width = swapDimensions ? windowHeight : windowWidth; m_renderTargetSize.Height = swapDimensions ? windowWidth : windowHeight; #else if (isWebcamShared) { m_renderTargetSize.Height = ((windowHeight*scaledheightpercentage) / 100) - 5.00; } else { m_renderTargetSize.Height = windowHeight; } m_renderTargetSize.Width = windowWidth; #endif // If the swap chain already exists, resize it. if(m_swapChain != nullptr) { // release all resources first m_d2dContext->SetTarget(nullptr); backBuffer = nullptr; dxgiBackBuffer = nullptr; targetBitmap = nullptr; swapChainNative = nullptr; m_d3dContext->ClearState(); HRESULT hr = m_swapChain->ResizeBuffers( 2, static_cast<UINT>(m_renderTargetSize.Width), static_cast<UINT>(m_renderTargetSize.Height), DXGI_FORMAT_B8G8R8A8_UNORM, 0); if (hr == DXGI_ERROR_INVALID_CALL) { } else { // todo } }
Answers
-
Windows phone does not support resizing swap chains, you have to recreate it.
This is reflected in the VS template in CommonDeviceResources.cpp
// These resources need to be recreated every time the window size is changed. void DX::DeviceResources::CreateWindowSizeDependentResources() { #if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) // Windows Phone does not support resizing the swap chain, so clear it instead of resizing. m_swapChain = nullptr; #endif
-
Edited by
Tuesday, March 3, 2015 5:28 AM
-
Proposed as answer by
Jamles Hez
Saturday, March 7, 2015 3:54 PM -
Marked as answer by
Franklin ChenMicrosoft employee
Monday, March 16, 2015 12:41 PM
-
Edited by