summaryrefslogtreecommitdiffstats
path: root/LibOVR/Src/OVR_CAPI_D3D.h
blob: 112525d838093df87d8e7ca38e46b0b19a616262 (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
/************************************************************************************

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, Inc. All Rights reserved.

Licensed under the Oculus VR Rift SDK License Version 3.1 (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.1 

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

#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

#include <d3d11.h>

// Used to configure slave D3D rendering (i.e. for devices created externally).
struct ovrD3D11ConfigData
{
    // General device settings.
    ovrRenderAPIConfigHeader Header;
	ID3D11Device*            pDevice;
    ID3D11DeviceContext*     pDeviceContext;
    ID3D11RenderTargetView*  pBackBufferRT;
    IDXGISwapChain*          pSwapChain;
};

union ovrD3D11Config
{
    ovrRenderAPIConfig Config;
    ovrD3D11ConfigData D3D11;
};

// Used to pass D3D11 eye texture data to ovrHmd_EndFrame.
struct ovrD3D11TextureData
{
    // General device settings.
    ovrTextureHeader          Header;
    ID3D11Texture2D*          pTexture;
    ID3D11ShaderResourceView* pSRView;
};

union ovrD3D11Texture
{
    ovrTexture          Texture;
    ovrD3D11TextureData D3D11;
};



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

//-----------------------------------------------------------------------------------
// ***** 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)

//-----------------------------------------------------------------------------------
// ***** 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