aboutsummaryrefslogtreecommitdiffstats
path: root/LibOVR/Src/OVR_CAPI_D3D.h
blob: c0b0667282b152c3a872bd35d1273e8ea43cb794 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/************************************************************************************

Filename    :   OVR_CAPI_D3D.h
Content     :   D3D specific structures used by the CAPI interface.
Created     :   November 7, 2013
Authors     :   Michael Antonov

Copyright   :   Copyright 2014 Oculus VR, LLC All Rights reserved.

Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); 
you may not use the Oculus VR Rift SDK except in compliance with the License, 
which is provided at the time of installation or download, or which 
otherwise accompanies this software in either electronic or hard copy form.

You may obtain a copy of the License at

http://www.oculusvr.com/licenses/LICENSE-3.2 

Unless required by applicable law or agreed to in writing, the Oculus VR SDK 
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

************************************************************************************/
#ifndef OVR_CAPI_D3D_h
#define OVR_CAPI_D3D_h

/// @file OVR_CAPI_D3D.h
/// D3D rendering support.

#include "OVR_CAPI.h"

#ifndef OVR_D3D_VERSION
#error Please define OVR_D3D_VERSION to 9 or 10 or 11 before including OVR_CAPI_D3D.h
#endif


#if defined(OVR_D3D_VERSION) && (OVR_D3D_VERSION == 11)

//-----------------------------------------------------------------------------------
// ***** D3D11 Specific

#if defined(OVR_OS_WIN32) // Desktop Windows only.
#include <d3d11.h>
#endif

/// Used to configure slave D3D rendering (i.e. for devices created externally).
struct ovrD3D11ConfigData
{
    /// General device settings.
    ovrRenderAPIConfigHeader Header;
    /// The D3D device to use for rendering.
	ID3D11Device*            pDevice;
    /// The D3D device context to use for rendering.
    ID3D11DeviceContext*     pDeviceContext;
    /// A render target view for the backbuffer.
    ID3D11RenderTargetView*  pBackBufferRT;
    /// The swapchain that will present rendered frames.
    IDXGISwapChain*          pSwapChain;
};

/// Contains D3D11-specific rendering information.
union ovrD3D11Config
{
    /// General device settings.
    ovrRenderAPIConfig Config;
    /// D3D11-specific settings.
    ovrD3D11ConfigData D3D11;
};

/// Used to pass D3D11 eye texture data to ovrHmd_EndFrame.
struct ovrD3D11TextureData
{
    /// General device settings.
    ovrTextureHeader          Header;
    /// The D3D11 texture containing the undistorted eye image.
    ID3D11Texture2D*          pTexture;
    /// The D3D11 shader resource view for this texture.
    ID3D11ShaderResourceView* pSRView;
};

/// Contains OpenGL-specific texture information.
union ovrD3D11Texture
{
    /// General device settings.
    ovrTexture          Texture;
    /// D3D11-specific settings.
    ovrD3D11TextureData D3D11;
};



#elif defined(OVR_D3D_VERSION) && (OVR_D3D_VERSION == 10)

#include <d3d10_1.h>
#include <d3d10.h>

//-----------------------------------------------------------------------------------
// ***** D3D10 Specific

/// Used to configure slave D3D rendering (i.e. for devices created externally).
struct ovrD3D10ConfigData
{
    /// General device settings.
    ovrRenderAPIConfigHeader Header;
    ID3D10Device*            pDevice;
    void*                    Unused;
    ID3D10RenderTargetView*  pBackBufferRT;
    IDXGISwapChain*          pSwapChain;
};

union ovrD3D10Config
{
    ovrRenderAPIConfig Config;
    ovrD3D10ConfigData D3D10;
};

/// Used to pass D3D10 eye texture data to ovrHmd_EndFrame.
struct ovrD3D10TextureData
{
    /// General device settings.
    ovrTextureHeader          Header;
    ID3D10Texture2D*          pTexture;
    ID3D10ShaderResourceView* pSRView;
};

union ovrD3D10Texture
{
    ovrTexture          Texture;
    ovrD3D10TextureData D3D10;
};

#elif defined(OVR_D3D_VERSION) && (OVR_D3D_VERSION == 9)

#include <d3d9.h>

//-----------------------------------------------------------------------------------
// ***** D3D9 Specific

// Used to configure D3D9 rendering 
struct ovrD3D9ConfigData
{
    // General device settings.
    ovrRenderAPIConfigHeader Header;
    
	IDirect3DDevice9*           pDevice;
    IDirect3DSwapChain9*        pSwapChain;
};

union ovrD3D9Config
{
    ovrRenderAPIConfig Config;
    ovrD3D9ConfigData D3D9;
};

// Used to pass D3D9 eye texture data to ovrHmd_EndFrame.
struct ovrD3D9TextureData
{
    // General device settings.
    ovrTextureHeader            Header;
    IDirect3DTexture9*          pTexture;  
};

union ovrD3D9Texture
{
    ovrTexture         Texture;
    ovrD3D9TextureData D3D9;
};

#endif

#endif	// OVR_CAPI_h