Jump to content
  • Advertisement

DX11 Exception when creating a 2D render target

Recommended Posts

A new player of my game reported an issue. When he starts the game, it immediately crashes, before he even can see the main menu. He sent me a log file of my game and it turns out that the game crashes, when my game creates a 2D render target. Here is the full "Interface not supported" error message:

HRESULT: [0x80004002], Module: [General], ApiCode: [E_NOINTERFACE/No such interface supported], Message: Schnittstelle nicht unterstützt
    bei SharpDX.Result.CheckError()
    bei SharpDX.Direct2D1.Factory.CreateDxgiSurfaceRenderTarget(Surface dxgiSurface, RenderTargetProperties& renderTargetProperties, RenderTarget renderTarget)
    bei SharpDX.Direct2D1.RenderTarget..ctor(Factory factory, Surface dxgiSurface, RenderTargetProperties properties)
    bei Game.AGame.Initialize()

Because of the log file's content, I know exactly where the game crashes:

Factory2D = new SharpDX.Direct2D1.Factory();

_surface = backBuffer.QueryInterface<SharpDX.DXGI.Surface>();

// It crashes when calling this line!
RenderTarget2D = new SharpDX.Direct2D1.RenderTarget(Factory2D, _surface, new SharpDX.Direct2D1.RenderTargetProperties(new SharpDX.Direct2D1.PixelFormat(_dxgiFormat, SharpDX.Direct2D1.AlphaMode.Premultiplied)));

RenderTarget2D.AntialiasMode = SharpDX.Direct2D1.AntialiasMode.Aliased;

I did some research on this error message and all similar problems I found were around six to seven years old, when people tried to work with DirectX 11 3D graphics and Dirext 10.1 2D graphics. However, I am using DirectX 11 for all visual stuff. The game runs very well on the computers of all other 2500 players. So I am trying to figure out, why the source code crashes on this player's computer. He used Windows 7 with all Windows Updates, 17179 MB memory and a NVIDIA GeForce GTX 870M graphics card. This is more than enough to run my game.

Below, you can see the code I use for creating the 3D device and the swap chain. I made sure to use BGRA-Support when creating the device, because it is required when using Direct2D in a 3D game in DirectX 11. The same DXGI format is used in creating 2D and 3D content. The refresh rate is read from the used adapter.

// Set swap chain flags, DXGI format and default refresh rate.
_swapChainFlags = SharpDX.DXGI.SwapChainFlags.None;
_dxgiFormat = SharpDX.DXGI.Format.B8G8R8A8_UNorm;
SharpDX.DXGI.Rational refreshRate = new SharpDX.DXGI.Rational(60, 1);

// Get proper video adapter and create device and swap chain.
using (var factory = new SharpDX.DXGI.Factory1())
    SharpDX.DXGI.Adapter adapter = GetAdapter(factory);
    if (adapter != null)
        // Get refresh rate.
        refreshRate = GetRefreshRate(adapter, _dxgiFormat, refreshRate);

        // Create Device and SwapChain
        _device = new SharpDX.Direct3D11.Device(adapter, SharpDX.Direct3D11.DeviceCreationFlags.BgraSupport, new SharpDX.Direct3D.FeatureLevel[]

        _swapChain = new SharpDX.DXGI.SwapChain(factory, _device, GetSwapChainDescription(clientSize, outputHandle, refreshRate));

        _deviceContext = _device.ImmediateContext;


Share this post

Link to post
Share on other sites

No, I am not. He told me he has all Windows Updates. I can't spy my players' computer and I don't want to do it :-) I will ask him.

Share this post

Link to post
Share on other sites

Cool, glad I could help. That number is burned into my brain from all the troubles it caused, but I'm glad it's helping at least one person.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!