2017-04-23 9 views
0

솔루션을 많이 검색했지만 찾을 수 없습니다. 예외가 라인SharpDX.DXGI - DXGI_ERROR_INVALID_CALL

나는 2010 내 컴퓨터에 Windows 7 SP1에서 실행의 DirectX SDK 6 월 설치 한
D11.Device.CreateWithSwapChain(DriverType.Hardware, D11.DeviceCreationFlags.None, chaindesk, out device, out chain); 

던져

namespace MySharpDXGame 
{ 
public class Game 
{ 

    public static void Main() 
    { 
     Game game = new Game(); 
     game.InitializeGraphics(); 
     RenderLoop.Run(game.MainForm, game.RenderCallback); 
    } 

    private RenderForm MainForm; 

    private const int Width = 1280; 
    private const int Height = 720; 

    private D11.Device device; 
    private D11.DeviceContext context; 
    private SwapChain chain; 

    private D11.RenderTargetView rendtargview; 

    public Game() 
    { 
     MainForm = new RenderForm("Simple Render") 
     { 
      ClientSize = new System.Drawing.Size(Width, Height), 
      AllowUserResizing = true 
     }; 

    } 

    private void RenderCallback() 
    { 
     Draw(); 
    } 

    public void InitializeGraphics() 
    { 
     ModeDescription modesc = new ModeDescription(Width, Height, new Rational(60, 1), Format.R8G8B8A8_UNorm); 
     SwapChainDescription chaindesk = new SwapChainDescription() 
     { 
      ModeDescription = modesc, 
      SampleDescription = new SampleDescription(1, 0), 
      Usage = Usage.RenderTargetOutput, 
      BufferCount = 1, 
      OutputHandle = MainForm.Handle, 
      IsWindowed = true 
     }; 

     D11.Device.CreateWithSwapChain(DriverType.Hardware, D11.DeviceCreationFlags.None, chaindesk, out device, out chain); 
     context = device.ImmediateContext; 
     rendtargview = new D11.RenderTargetView(device, chain.GetBackBuffer<D11.Texture2D>(0)); 
     System.Windows.Forms.MessageBox.Show("created!"); 
    } 

    private void Draw() 
    { 
     context.OutputMerger.SetRenderTargets(rendtargview); 
     context.ClearRenderTargetView(rendtargview, new Scolor(32, 103, 178, 255)); 
    } 
} 
} 

: 다음은 내 코드입니다. Visual Studio Community 2017에서이 프로젝트를하고 있습니다. SharpDX 라이브러리는 NuGet에서 다운로드되었습니다. 디버그 DeviceCreationFlags를 사용하는

SharpDX.SharpDXException: "HRESULT: [0x887A0001], Module: [SharpDX.DXGI], ApiCode: [DXGI_ERROR_INVALID_CALL/InvalidCall], Message: Unknown" 

답변

1

시도 : 다음은 예외의 전체 로그입니다. 이렇게하면 문제를 찾을 수 있습니다. 또한 나는 robydx에서 sharpdx 튜토리얼을 추천 할 수 있습니다 :

Tutorials