Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8693765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:37:08+00:00 2026-06-13T00:37:08+00:00

I’m writing a very simple modeling software, more as a challenge than anything else.

  • 0

I’m writing a very simple modeling software, more as a challenge than anything else.
Up to about 3 weeks ago, I had no real problem with the SwapChain.ResizeBuffers() function.

I changed of PC, switched to Visual Studio Express 2012 (from Pro 9), and switch my solution to x64 with the corresponding SlimDX.dll.

It still runs fine, but when I resize my window hosting the viewport, it get : DXGI_ERROR_INVALID_CALL (-2005270527).

A quick search on google tells me Battlefield 3 also may have that problem with some specific drivers. Is it possible?

I’ve read everything I could find about that function, and somehow I can’t find what changes that is now messing things up. Hopefully, someone can see what I’m doing wrong.

    // Form we are attached to.
    private Dockable dock;

    // Rendering stuff.
    private Device device;
    private Viewport viewport;
    private SwapChain swapChain;
    private RenderTargetView renderView;
    private DepthStencilView depthView;

    public Renderer(Dockable form)
    {
        if (form == null)
            return;

        dock = form;

        CreateSwapchain();
        Resize();
    }

    private void CreateSwapchain()
    {
        // Swap Chain & Device
        SwapChainDescription description = new SwapChainDescription()
        {
            BufferCount = 1,
            Usage = Usage.RenderTargetOutput,
            OutputHandle = dock.Handle,
            IsWindowed = true,
            ModeDescription = new ModeDescription(dock.ClientSize.Width, dock.ClientSize.Height, new Rational(60, 1), Format.R8G8B8A8_UNorm),
            SampleDescription = new SampleDescription(1, 0),
            Flags = SwapChainFlags.AllowModeSwitch,
            SwapEffect = SwapEffect.Discard
        };

        Device.CreateWithSwapChain(DriverType.Hardware, DeviceCreationFlags.Debug, description, out device, out swapChain);
    }

    private void CreateRenderView()
    {
        // Dispose before resizing.
        if (renderView != null)
            renderView.Dispose();

        if (depthView != null)
            depthView.Dispose();

        swapChain.ResizeBuffers(0, 0, 0, Format.Unknown, 0); // ERROR : DXGI_ERROR_INVALID_CALL when resizing the window, but not when creating it.
        renderView = new RenderTargetView(device, Resource.FromSwapChain<Texture2D>(swapChain, 0));

        Texture2DDescription depthBufferDesc = new Texture2DDescription()
        {
            ArraySize = 1,
            BindFlags = BindFlags.DepthStencil,
            CpuAccessFlags = CpuAccessFlags.None,
            Format = Format.D16_UNorm,
            Height = dock.ClientSize.Height,
            Width = dock.ClientSize.Width,
            MipLevels = 1,
            OptionFlags = ResourceOptionFlags.None,
            SampleDescription = new SampleDescription(1, 0),
            Usage = ResourceUsage.Default
        };

        depthView = new DepthStencilView(device, new Texture2D(device, depthBufferDesc));
    }

    public void Resize()
    {
        CreateRenderView();

        viewport = new Viewport(0.0f, 0.0f, dock.ClientSize.Width, dock.ClientSize.Height);
        device.ImmediateContext.Rasterizer.SetViewports(viewport);
        device.ImmediateContext.OutputMerger.SetTargets(depthView, renderView);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:37:09+00:00Added an answer on June 13, 2026 at 12:37 am

    You need to release all resources associated to your swap chain before to resize it.

    So that includes the render view (which you do), but you do addref on the resource when you create your render target view.

    Resource.FromSwapChain<Texture2D>(swapChain, 0)
    

    Adds a ref counter to the texture. Since you don’t cache it, you can’t release it.

    So you need to do:

    Texture2D resource = Texture2D.FromSwapChain<Texture2D>(swapChain, 0);
    renderView = new RenderTargetView(device, resource);
    

    then before to call resize:

    if (resource != null) { resource.Dispose(); }
    

    Just tested it on my engine and it works (also you were right with 0s, it works too).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seemingly simple, but I cannot find anything relevant on the web. What is the
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
In my XML file chapters tag has more chapter tag.i need to display chapters
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I am writing an app with both english and french support. The app requests

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.