| 228 | } |
| 229 | |
| 230 | bool TriDevice::CreateSimpleDevice( |
| 231 | Tr2WindowHandle hwnd, |
| 232 | unsigned int width, |
| 233 | unsigned int height, |
| 234 | DeviceScreenType type, |
| 235 | Tr2RenderContextEnum::PresentInterval presentInterval, |
| 236 | unsigned int adapter ) |
| 237 | { |
| 238 | // Clean out old resources and the old device (if exists) |
| 239 | DestroyRenderContext(); |
| 240 | |
| 241 | // Build a windowd device: |
| 242 | Tr2PresentParametersAL pp = mPresentParam; |
| 243 | |
| 244 | //Create the device, using those creation parameters present in the device. |
| 245 | pp.mode.width = width; |
| 246 | pp.mode.height = height; |
| 247 | pp.outputWindow = hwnd; |
| 248 | pp.software = ( m_deviceType == TriDevice::DEVICE_TYPE_SOFTWARE ); |
| 249 | |
| 250 | pp.windowed = false; |
| 251 | if( type == FULLSCREEN ) |
| 252 | { |
| 253 | Tr2DisplayModeInfo mode; |
| 254 | if( FAILED( Tr2VideoAdapterInfo::GetAdapterDisplayMode( Tr2VideoAdapterInfo::DEFAULT_ADAPTER, mode ) ) ) |
| 255 | { |
| 256 | CCP_LOGERR( "Failed to get adapter display mode!" ); |
| 257 | return false; |
| 258 | } |
| 259 | pp.mode.format = mode.format; |
| 260 | pp.mode.refreshRateNumerator = mode.refreshRateNumerator; |
| 261 | pp.mode.refreshRateDenominator = mode.refreshRateDenominator; |
| 262 | } |
| 263 | else if( type == WINDOWED ) |
| 264 | { |
| 265 | pp.windowed = true; |
| 266 | } |
| 267 | pp.presentInterval = presentInterval; |
| 268 | pp.variableRefreshRateSupported = IsVariableRefreshRateSupported(); |
| 269 | |
| 270 | //take nvperfhud into account! |
| 271 | // Set default settings |
| 272 | uint32_t adapterToUse = adapter; |
| 273 | |
| 274 | CreateUpscalingTechnique( adapter ); |
| 275 | CreateDeviceInt( adapterToUse, hwnd, pp ); |
| 276 | |
| 277 | if( !DeviceExists() ) |
| 278 | { |
| 279 | // failed to create a device, forced to give up. |
| 280 | CCP_LOGERR( "Failed to create compatible device!" ); |
| 281 | return false; |
| 282 | } |
| 283 | |
| 284 | mPresentParam = pp; |
| 285 | |
| 286 | mWidth = width; |
| 287 | mHeight = height; |
nothing calls this directly
no test coverage detected