Skip to content

Commit

Permalink
[DXGI] Fix DXGI error/status and add DXGI1.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
xoofx committed Jun 6, 2015
1 parent a38ef66 commit d7cc0d4
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 31 deletions.
47 changes: 47 additions & 0 deletions Source/SharpDX.DXGI/Factory4.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;

namespace SharpDX.DXGI
{
public partial class Factory4
{
/// <summary>
/// Initializes a new instance of <see cref="Factory4"/> class.
/// </summary>
public Factory4() : this(IntPtr.Zero)
{
IntPtr factoryPtr;
DXGI.CreateDXGIFactory1(Utilities.GetGuidFromType(GetType()), out factoryPtr);
NativePointer = factoryPtr;
}

/// <summary>
/// Gets the default warp adapter.
/// </summary>
/// <returns>The warp adapter.</returns>
public Adapter GetWarpAdapter()
{
IntPtr adapterPtr;
EnumWarpAdapter(Utilities.GetGuidFromType(typeof(Adapter)), out adapterPtr);
return new Adapter(adapterPtr);
}
}
}
38 changes: 7 additions & 31 deletions Source/SharpDX.DXGI/Mapping.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,40 +29,12 @@
<!-- DXGI includes -->
<include id="dxgi" file="dxgi.h" attach="true" />
<include id="dxgiformat" file="dxgiformat.h" attach="true" />
<include id="dxgitype" file="dxgitype.h" attach="true">
<post>
#define _FACDXGI 0x87a
#define MAKE_DXGI_HRESULT(code) MAKE_HRESULT(1, _FACDXGI, code)
#define MAKE_DXGI_STATUS(code) MAKE_HRESULT(0, _FACDXGI, code)

#define DXGI_STATUS_OCCLUDED MAKE_DXGI_STATUS(1)
#define DXGI_STATUS_CLIPPED MAKE_DXGI_STATUS(2)
#define DXGI_STATUS_NO_REDIRECTION MAKE_DXGI_STATUS(4)
#define DXGI_STATUS_NO_DESKTOP_ACCESS MAKE_DXGI_STATUS(5)
#define DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE MAKE_DXGI_STATUS(6)
#define DXGI_STATUS_MODE_CHANGED MAKE_DXGI_STATUS(7)
#define DXGI_STATUS_MODE_CHANGE_IN_PROGRESS MAKE_DXGI_STATUS(8)

#define DXGI_ERROR_INVALID_CALL MAKE_DXGI_HRESULT(1)
#define DXGI_ERROR_NOT_FOUND MAKE_DXGI_HRESULT(2)
#define DXGI_ERROR_MORE_DATA MAKE_DXGI_HRESULT(3)
#define DXGI_ERROR_UNSUPPORTED MAKE_DXGI_HRESULT(4)
#define DXGI_ERROR_DEVICE_REMOVED MAKE_DXGI_HRESULT(5)
#define DXGI_ERROR_DEVICE_HUNG MAKE_DXGI_HRESULT(6)
#define DXGI_ERROR_DEVICE_RESET MAKE_DXGI_HRESULT(7)
#define DXGI_ERROR_WAS_STILL_DRAWING MAKE_DXGI_HRESULT(10)
#define DXGI_ERROR_FRAME_STATISTICS_DISJOINT MAKE_DXGI_HRESULT(11)
#define DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE MAKE_DXGI_HRESULT(12)
#define DXGI_ERROR_DRIVER_INTERNAL_ERROR MAKE_DXGI_HRESULT(32)
#define DXGI_ERROR_NONEXCLUSIVE MAKE_DXGI_HRESULT(33)
#define DXGI_ERROR_NOT_CURRENTLY_AVAILABLE MAKE_DXGI_HRESULT(34)
#define DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED MAKE_DXGI_HRESULT(35)
#define DXGI_ERROR_REMOTE_OUTOFMEMORY MAKE_DXGI_HRESULT(36)
</post>
</include>
<include id="winerror" file="winerror.h"/>
<include id="dxgitype" file="dxgitype.h" attach="true"/>
<include id="dxgi1_2" file="dxgi1_2.h" attach="true" />
<include id="windows.ui.xaml.media.dxinterop" file="windows.ui.xaml.media.dxinterop.h" attach="true" />
<include id="dxgi1_3" file="dxgi1_3.h" attach="true" />
<include id="dxgi1_4" file="dxgi1_4.h" attach="true" />

<context-set id="dxgi-all">
<context>sharpdx-dxgi</context>
Expand All @@ -72,6 +44,8 @@
<context>dxgitype</context>
<context>dxgi1_2</context>
<context>dxgi1_3</context>
<context>dxgi1_4</context>
<context>winerror</context>
<context>windows.ui.xaml.media.dxinterop</context>
</context-set>

Expand Down Expand Up @@ -260,6 +234,8 @@
<map param="IDXGISwapChain2::GetMaximumFrameLatency::pMaxLatency" attribute="out" />
<map param="IDXGISwapChain2::GetMatrixTransform::pMatrix" attribute="out" />
<map method="IDXGISwapChain2::[GS]etSourceSize" visibility="internal" />

<map method="IDXGIFactory4::EnumWarpAdapter" visibility="private"/>

<!--
// *****************************************************************
Expand Down
1 change: 1 addition & 0 deletions Source/SharpDX.DXGI/SharpDX.DXGI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
</Compile>
<Compile Include="Adapter.cs" />
<Compile Include="AssemblyDoc.cs" />
<Compile Include="Factory4.cs" />
<Compile Include="Factory2.cs" />
<Compile Include="Output1.cs" />
<Compile Include="NamespaceDoc.cs" />
Expand Down

0 comments on commit d7cc0d4

Please sign in to comment.