blob: c95e1f66b80993ba438e3796d2051b5255852fd8 [file] [log] [blame]
daniel@transgaming.come979ead2010-09-23 18:03:14 +00001//
2// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7// Display.cpp: Implements the egl::Display class, representing the abstract
8// display on which graphics are drawn. Implements EGLDisplay.
9// [EGL 1.4] section 2.1.2 page 3.
10
11#include "libEGL/Display.h"
12
13#include <algorithm>
14#include <vector>
15
16#include "common/debug.h"
17
18#include "libEGL/main.h"
19
20#define REF_RAST 0 // Can also be enabled by defining FORCE_REF_RAST in the project's predefined macros
21#define ENABLE_D3D9EX 1 // Enables use of the IDirect3D9Ex interface, when available
22
23namespace egl
24{
25Display::Display(HDC deviceContext) : mDc(deviceContext)
26{
27 mD3d9Module = NULL;
28
29 mD3d9 = NULL;
30 mD3d9ex = NULL;
31 mDevice = NULL;
32 mDeviceWindow = NULL;
33
34 mAdapter = D3DADAPTER_DEFAULT;
35
36 #if REF_RAST == 1 || defined(FORCE_REF_RAST)
37 mDeviceType = D3DDEVTYPE_REF;
38 #else
39 mDeviceType = D3DDEVTYPE_HAL;
40 #endif
41
42 mMinSwapInterval = 1;
43 mMaxSwapInterval = 1;
44}
45
46Display::~Display()
47{
48 terminate();
49}
50
51bool Display::initialize()
52{
53 if (isInitialized())
54 {
55 return true;
56 }
57
58 mD3d9Module = LoadLibrary(TEXT("d3d9.dll"));
59 if (mD3d9Module == NULL)
60 {
61 terminate();
62 return false;
63 }
64
65 typedef IDirect3D9* (WINAPI *Direct3DCreate9Func)(UINT);
66 Direct3DCreate9Func Direct3DCreate9Ptr = reinterpret_cast<Direct3DCreate9Func>(GetProcAddress(mD3d9Module, "Direct3DCreate9"));
67
68 if (Direct3DCreate9Ptr == NULL)
69 {
70 terminate();
71 return false;
72 }
73
74 typedef HRESULT (WINAPI *Direct3DCreate9ExFunc)(UINT, IDirect3D9Ex**);
75 Direct3DCreate9ExFunc Direct3DCreate9ExPtr = reinterpret_cast<Direct3DCreate9ExFunc>(GetProcAddress(mD3d9Module, "Direct3DCreate9Ex"));
76
77 // Use Direct3D9Ex if available. Among other things, this version is less
78 // inclined to report a lost context, for example when the user switches
79 // desktop. Direct3D9Ex is available in Windows Vista and later if suitable drivers are available.
80 if (ENABLE_D3D9EX && Direct3DCreate9ExPtr && SUCCEEDED(Direct3DCreate9ExPtr(D3D_SDK_VERSION, &mD3d9ex)))
81 {
82 ASSERT(mD3d9ex);
83 mD3d9ex->QueryInterface(IID_IDirect3D9, reinterpret_cast<void**>(&mD3d9));
84 ASSERT(mD3d9);
85 }
86 else
87 {
88 mD3d9 = Direct3DCreate9Ptr(D3D_SDK_VERSION);
89 }
90
91 if (mD3d9)
92 {
93 if (mDc != NULL)
94 {
95 // UNIMPLEMENTED(); // FIXME: Determine which adapter index the device context corresponds to
96 }
97
98 HRESULT result;
99
100 do
101 {
102 result = mD3d9->GetDeviceCaps(mAdapter, mDeviceType, &mDeviceCaps);
103
104 if (result == D3DERR_NOTAVAILABLE)
105 {
106 Sleep(0); // Give the driver some time to initialize/recover
107 }
108 else if (FAILED(result)) // D3DERR_OUTOFVIDEOMEMORY, E_OUTOFMEMORY, D3DERR_INVALIDDEVICE, or another error we can't recover from
109 {
110 return error(EGL_BAD_ALLOC, false);
111 }
112 }
113 while(result == D3DERR_NOTAVAILABLE);
114
115 ASSERT(SUCCEEDED(result));
116
117 if (mDeviceCaps.PixelShaderVersion < D3DPS_VERSION(2, 0))
118 {
119 terminate();
120 return error(EGL_NOT_INITIALIZED, false);
121 }
122
123 mMinSwapInterval = 4;
124 mMaxSwapInterval = 0;
125
126 if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_IMMEDIATE) {mMinSwapInterval = std::min(mMinSwapInterval, 0); mMaxSwapInterval = std::max(mMaxSwapInterval, 0);}
127 if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_ONE) {mMinSwapInterval = std::min(mMinSwapInterval, 1); mMaxSwapInterval = std::max(mMaxSwapInterval, 1);}
128 if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_TWO) {mMinSwapInterval = std::min(mMinSwapInterval, 2); mMaxSwapInterval = std::max(mMaxSwapInterval, 2);}
129 if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_THREE) {mMinSwapInterval = std::min(mMinSwapInterval, 3); mMaxSwapInterval = std::max(mMaxSwapInterval, 3);}
130 if (mDeviceCaps.PresentationIntervals & D3DPRESENT_INTERVAL_FOUR) {mMinSwapInterval = std::min(mMinSwapInterval, 4); mMaxSwapInterval = std::max(mMaxSwapInterval, 4);}
131
132 const D3DFORMAT renderTargetFormats[] =
133 {
134 D3DFMT_A1R5G5B5,
135 // D3DFMT_A2R10G10B10, // The color_ramp conformance test uses ReadPixels with UNSIGNED_BYTE causing it to think that rendering skipped a colour value.
136 D3DFMT_A8R8G8B8,
137 D3DFMT_R5G6B5,
138 D3DFMT_X1R5G5B5,
139 D3DFMT_X8R8G8B8
140 };
141
142 const D3DFORMAT depthStencilFormats[] =
143 {
144 // D3DFMT_D16_LOCKABLE,
145 D3DFMT_D32,
146 // D3DFMT_D15S1,
147 D3DFMT_D24S8,
148 D3DFMT_D24X8,
149 // D3DFMT_D24X4S4,
150 D3DFMT_D16,
151 // D3DFMT_D32F_LOCKABLE,
152 // D3DFMT_D24FS8
153 };
154
155 D3DDISPLAYMODE currentDisplayMode;
156 mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
157
158 ConfigSet configSet;
159
160 for (int formatIndex = 0; formatIndex < sizeof(renderTargetFormats) / sizeof(D3DFORMAT); formatIndex++)
161 {
162 D3DFORMAT renderTargetFormat = renderTargetFormats[formatIndex];
163
164 HRESULT result = mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET, D3DRTYPE_SURFACE, renderTargetFormat);
165
166 if (SUCCEEDED(result))
167 {
168 for (int depthStencilIndex = 0; depthStencilIndex < sizeof(depthStencilFormats) / sizeof(D3DFORMAT); depthStencilIndex++)
169 {
170 D3DFORMAT depthStencilFormat = depthStencilFormats[depthStencilIndex];
171 HRESULT result = mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, depthStencilFormat);
172
173 if (SUCCEEDED(result))
174 {
175 HRESULT result = mD3d9->CheckDepthStencilMatch(mAdapter, mDeviceType, currentDisplayMode.Format, renderTargetFormat, depthStencilFormat);
176
177 if (SUCCEEDED(result))
178 {
179 // FIXME: enumerate multi-sampling
180
181 configSet.add(currentDisplayMode, mMinSwapInterval, mMaxSwapInterval, renderTargetFormat, depthStencilFormat, 0);
182 }
183 }
184 }
185 }
186 }
187
188 // Give the sorted configs a unique ID and store them internally
189 EGLint index = 1;
190 for (ConfigSet::Iterator config = configSet.mSet.begin(); config != configSet.mSet.end(); config++)
191 {
192 Config configuration = *config;
193 configuration.mConfigID = index;
194 index++;
195
196 mConfigSet.mSet.insert(configuration);
197 }
198 }
199
200 if (!isInitialized())
201 {
202 terminate();
203
204 return false;
205 }
206
207 static const TCHAR windowName[] = TEXT("AngleHiddenWindow");
208 static const TCHAR className[] = TEXT("STATIC");
209
210 mDeviceWindow = CreateWindowEx(WS_EX_NOACTIVATE, className, windowName, WS_DISABLED | WS_POPUP, 0, 0, 1, 1, HWND_MESSAGE, NULL, GetModuleHandle(NULL), NULL);
211
212 return true;
213}
214
215void Display::terminate()
216{
217 while (!mSurfaceSet.empty())
218 {
219 destroySurface(*mSurfaceSet.begin());
220 }
221
222 while (!mContextSet.empty())
223 {
224 destroyContext(*mContextSet.begin());
225 }
226
227 if (mDevice)
228 {
229 // If the device is lost, reset it first to prevent leaving the driver in an unstable state
230 if (FAILED(mDevice->TestCooperativeLevel()))
231 {
232 resetDevice();
233 }
234
235 mDevice->Release();
236 mDevice = NULL;
237 }
238
239 if (mD3d9)
240 {
241 mD3d9->Release();
242 mD3d9 = NULL;
243 }
244
245 if (mDeviceWindow)
246 {
247 DestroyWindow(mDeviceWindow);
248 mDeviceWindow = NULL;
249 }
250
251 if (mD3d9ex)
252 {
253 mD3d9ex->Release();
254 mD3d9ex = NULL;
255 }
256
257 if (mD3d9Module)
258 {
259 FreeLibrary(mD3d9Module);
260 mD3d9Module = NULL;
261 }
262}
263
264void Display::startScene()
265{
266 if (!mSceneStarted)
267 {
268 long result = mDevice->BeginScene();
269 ASSERT(SUCCEEDED(result));
270 mSceneStarted = true;
271 }
272}
273
274void Display::endScene()
275{
276 if (mSceneStarted)
277 {
278 long result = mDevice->EndScene();
279 ASSERT(SUCCEEDED(result));
280 mSceneStarted = false;
281 }
282}
283
284bool Display::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig)
285{
286 return mConfigSet.getConfigs(configs, attribList, configSize, numConfig);
287}
288
289bool Display::getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value)
290{
291 const egl::Config *configuration = mConfigSet.get(config);
292
293 switch (attribute)
294 {
295 case EGL_BUFFER_SIZE: *value = configuration->mBufferSize; break;
296 case EGL_ALPHA_SIZE: *value = configuration->mAlphaSize; break;
297 case EGL_BLUE_SIZE: *value = configuration->mBlueSize; break;
298 case EGL_GREEN_SIZE: *value = configuration->mGreenSize; break;
299 case EGL_RED_SIZE: *value = configuration->mRedSize; break;
300 case EGL_DEPTH_SIZE: *value = configuration->mDepthSize; break;
301 case EGL_STENCIL_SIZE: *value = configuration->mStencilSize; break;
302 case EGL_CONFIG_CAVEAT: *value = configuration->mConfigCaveat; break;
303 case EGL_CONFIG_ID: *value = configuration->mConfigID; break;
304 case EGL_LEVEL: *value = configuration->mLevel; break;
305 case EGL_NATIVE_RENDERABLE: *value = configuration->mNativeRenderable; break;
306 case EGL_NATIVE_VISUAL_TYPE: *value = configuration->mNativeVisualType; break;
307 case EGL_SAMPLES: *value = configuration->mSamples; break;
308 case EGL_SAMPLE_BUFFERS: *value = configuration->mSampleBuffers; break;
309 case EGL_SURFACE_TYPE: *value = configuration->mSurfaceType; break;
310 case EGL_TRANSPARENT_TYPE: *value = configuration->mTransparentType; break;
311 case EGL_TRANSPARENT_BLUE_VALUE: *value = configuration->mTransparentBlueValue; break;
312 case EGL_TRANSPARENT_GREEN_VALUE: *value = configuration->mTransparentGreenValue; break;
313 case EGL_TRANSPARENT_RED_VALUE: *value = configuration->mTransparentRedValue; break;
314 case EGL_BIND_TO_TEXTURE_RGB: *value = configuration->mBindToTextureRGB; break;
315 case EGL_BIND_TO_TEXTURE_RGBA: *value = configuration->mBindToTextureRGBA; break;
316 case EGL_MIN_SWAP_INTERVAL: *value = configuration->mMinSwapInterval; break;
317 case EGL_MAX_SWAP_INTERVAL: *value = configuration->mMaxSwapInterval; break;
318 case EGL_LUMINANCE_SIZE: *value = configuration->mLuminanceSize; break;
319 case EGL_ALPHA_MASK_SIZE: *value = configuration->mAlphaMaskSize; break;
320 case EGL_COLOR_BUFFER_TYPE: *value = configuration->mColorBufferType; break;
321 case EGL_RENDERABLE_TYPE: *value = configuration->mRenderableType; break;
322 case EGL_MATCH_NATIVE_PIXMAP: *value = false; UNIMPLEMENTED(); break;
323 case EGL_CONFORMANT: *value = configuration->mConformant; break;
324 default:
325 return false;
326 }
327
328 return true;
329}
330
331bool Display::createDevice()
332{
333 D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters();
334 DWORD behaviorFlags = D3DCREATE_FPU_PRESERVE | D3DCREATE_NOWINDOWCHANGES;
335
336 HRESULT result = mD3d9->CreateDevice(mAdapter, mDeviceType, mDeviceWindow, behaviorFlags | D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE, &presentParameters, &mDevice);
337
338 if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DEVICELOST)
339 {
340 return error(EGL_BAD_ALLOC, false);
341 }
342
343 if (FAILED(result))
344 {
345 result = mD3d9->CreateDevice(mAdapter, mDeviceType, mDeviceWindow, behaviorFlags | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &presentParameters, &mDevice);
346
347 if (FAILED(result))
348 {
349 ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_NOTAVAILABLE || result == D3DERR_DEVICELOST);
350 return error(EGL_BAD_ALLOC, false);
351 }
352 }
353
354 // Permanent non-default states
355 mDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, TRUE);
356
357 mSceneStarted = false;
358
359 return true;
360}
361
362bool Display::resetDevice()
363{
364 D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters();
365 HRESULT result;
366
367 do
368 {
369 Sleep(0); // Give the graphics driver some CPU time
370
371 result = mDevice->Reset(&presentParameters);
372 }
373 while (result == D3DERR_DEVICELOST);
374
375 if (FAILED(result))
376 {
377 return error(EGL_BAD_ALLOC, false);
378 }
379
380 ASSERT(SUCCEEDED(result));
381
382 return true;
383}
384
385Surface *Display::createWindowSurface(HWND window, EGLConfig config)
386{
387 const Config *configuration = mConfigSet.get(config);
388
389 Surface *surface = new Surface(this, configuration, window);
390 mSurfaceSet.insert(surface);
391
392 return surface;
393}
394
395EGLContext Display::createContext(EGLConfig configHandle, const gl::Context *shareContext)
396{
397 if (!mDevice)
398 {
399 if (!createDevice())
400 {
401 return NULL;
402 }
403 }
404 else if (FAILED(mDevice->TestCooperativeLevel())) // Lost device
405 {
406 if (!resetDevice())
407 {
408 return NULL;
409 }
410
411 // Restore any surfaces that may have been lost
412 for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++)
413 {
414 (*surface)->resetSwapChain();
415 }
416 }
417
418 const egl::Config *config = mConfigSet.get(configHandle);
419
420 gl::Context *context = glCreateContext(config, shareContext);
421 mContextSet.insert(context);
422
423 return context;
424}
425
426void Display::destroySurface(egl::Surface *surface)
427{
428 delete surface;
429 mSurfaceSet.erase(surface);
430}
431
432void Display::destroyContext(gl::Context *context)
433{
434 glDestroyContext(context);
435 mContextSet.erase(context);
436
437 if (mContextSet.empty() && mDevice && FAILED(mDevice->TestCooperativeLevel())) // Last context of a lost device
438 {
439 for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++)
440 {
441 (*surface)->release();
442 }
443 }
444}
445
446bool Display::isInitialized()
447{
448 return mD3d9 != NULL && mConfigSet.size() > 0;
449}
450
451bool Display::isValidConfig(EGLConfig config)
452{
453 return mConfigSet.get(config) != NULL;
454}
455
456bool Display::isValidContext(gl::Context *context)
457{
458 return mContextSet.find(context) != mContextSet.end();
459}
460
461bool Display::isValidSurface(egl::Surface *surface)
462{
463 return mSurfaceSet.find(surface) != mSurfaceSet.end();
464}
465
466bool Display::hasExistingWindowSurface(HWND window)
467{
468 for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++)
469 {
470 if ((*surface)->getWindowHandle() == window)
471 {
472 return true;
473 }
474 }
475
476 return false;
477}
478
479EGLint Display::getMinSwapInterval()
480{
481 return mMinSwapInterval;
482}
483
484EGLint Display::getMaxSwapInterval()
485{
486 return mMaxSwapInterval;
487}
488
489IDirect3DDevice9 *Display::getDevice()
490{
491 if (!mDevice)
492 {
493 if (!createDevice())
494 {
495 return NULL;
496 }
497 }
498
499 return mDevice;
500}
501
502D3DCAPS9 Display::getDeviceCaps()
503{
504 return mDeviceCaps;
505}
506
507void Display::getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray)
508{
509 for (int multiSampleIndex = 0; multiSampleIndex <= D3DMULTISAMPLE_16_SAMPLES; multiSampleIndex++)
510 {
511 HRESULT result = mD3d9->CheckDeviceMultiSampleType(mAdapter, mDeviceType, format,
512 TRUE, (D3DMULTISAMPLE_TYPE)multiSampleIndex, NULL);
513
514 multiSampleArray[multiSampleIndex] = SUCCEEDED(result);
515 }
516}
517
518bool Display::getCompressedTextureSupport()
519{
520 D3DDISPLAYMODE currentDisplayMode;
521 mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
522
523 return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT1));
524}
525
526bool Display::getFloatTextureSupport(bool *filtering, bool *renderable)
527{
528 D3DDISPLAYMODE currentDisplayMode;
529 mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
530
531 *filtering = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER,
532 D3DRTYPE_TEXTURE, D3DFMT_A32B32G32R32F)) &&
533 SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER,
534 D3DRTYPE_CUBETEXTURE, D3DFMT_A32B32G32R32F));
535
536 *renderable = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET,
537 D3DRTYPE_TEXTURE, D3DFMT_A32B32G32R32F))&&
538 SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET,
539 D3DRTYPE_CUBETEXTURE, D3DFMT_A32B32G32R32F));
540
541 if (!filtering && !renderable)
542 {
543 return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0,
544 D3DRTYPE_TEXTURE, D3DFMT_A32B32G32R32F)) &&
545 SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0,
546 D3DRTYPE_CUBETEXTURE, D3DFMT_A32B32G32R32F));
547 }
548 else
549 {
550 return true;
551 }
552}
553
554bool Display::getHalfFloatTextureSupport(bool *filtering, bool *renderable)
555{
556 D3DDISPLAYMODE currentDisplayMode;
557 mD3d9->GetAdapterDisplayMode(mAdapter, &currentDisplayMode);
558
559 *filtering = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER,
560 D3DRTYPE_TEXTURE, D3DFMT_A16B16G16R16F)) &&
561 SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER,
562 D3DRTYPE_CUBETEXTURE, D3DFMT_A16B16G16R16F));
563
564 *renderable = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET,
565 D3DRTYPE_TEXTURE, D3DFMT_A16B16G16R16F)) &&
566 SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET,
567 D3DRTYPE_CUBETEXTURE, D3DFMT_A16B16G16R16F));
568
569 if (!filtering && !renderable)
570 {
571 return SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0,
572 D3DRTYPE_TEXTURE, D3DFMT_A16B16G16R16F)) &&
573 SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0,
574 D3DRTYPE_CUBETEXTURE, D3DFMT_A16B16G16R16F));
575 }
576 else
577 {
578 return true;
579 }
580}
581
582bool Display::getEventQuerySupport()
583{
584 IDirect3DQuery9 *query;
585 HRESULT result = mDevice->CreateQuery(D3DQUERYTYPE_EVENT, &query);
586 if (SUCCEEDED(result))
587 {
588 query->Release();
589 }
590
591 return result != D3DERR_NOTAVAILABLE;
592}
593
594D3DPRESENT_PARAMETERS Display::getDefaultPresentParameters()
595{
596 D3DPRESENT_PARAMETERS presentParameters = {0};
597
598 // The default swap chain is never actually used. Surface will create a new swap chain with the proper parameters.
599 presentParameters.AutoDepthStencilFormat = D3DFMT_UNKNOWN;
600 presentParameters.BackBufferCount = 1;
601 presentParameters.BackBufferFormat = D3DFMT_UNKNOWN;
602 presentParameters.BackBufferWidth = 1;
603 presentParameters.BackBufferHeight = 1;
604 presentParameters.EnableAutoDepthStencil = FALSE;
605 presentParameters.Flags = 0;
606 presentParameters.hDeviceWindow = mDeviceWindow;
607 presentParameters.MultiSampleQuality = 0;
608 presentParameters.MultiSampleType = D3DMULTISAMPLE_NONE;
609 presentParameters.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
610 presentParameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
611 presentParameters.Windowed = TRUE;
612
613 return presentParameters;
614}
daniel@transgaming.comd36c6a02010-08-31 12:15:09 +0000615}