Porting direct x 11 desktop game to uwp app

12
DirectX 11 Desktop Game UWP App 으으 으으으으 MS Visual C++ MVP 으으으 @dgtman http:// megayuchi.wordpress.com Channel 9 으으으으 https://channel9.msdn.com/Blogs/MVPKorea/win32DirectXU WP

Transcript of Porting direct x 11 desktop game to uwp app

Page 1: Porting direct x 11 desktop game to uwp app

DirectX 11 Desktop Game UWP App 으로 포팅하기

MS Visual C++ MVP유영천

@dgtmanhttp://megayuchi.wordpress.com

Channel 9 발표영상https://channel9.msdn.com/Blogs/MVPKorea/win32DirectXUWP

Page 2: Porting direct x 11 desktop game to uwp app

Desktop Application -> Windows 10 UWP App• Desktop Application( 이하 win32 App) 과 Windows Store App( 이하 UWP App)은 상당히 많이 다름 .

• UWP 앱에서 일부 win32 API 를 사용할 수 있지만 UI 프로그래밍에서의 공통점은 아예 없다고 봐야…

• win32 app 의 UI 코드 비중이 높다면 UWP app으로의 포팅이 어려움 .

Page 3: Porting direct x 11 desktop game to uwp app

win32 Game -> UWP Game• 게임의 코드는 대부분 C/C++.

• 대부분의 게임이 Graphics API 로 DirectX 를 사용 .

• DirectX API 는 99% 이상 동일 .

• 게임에선 win32 API 를 많이 사용하지만 GDI 는 거의 사용하지 않음 .

• Windows 8/8.1 에 비해 Windows 10 은 훨씬 많은 win32 API 를 사용 가능 . 게임에서 필요한 win32 API 는 대부분 사용 가능 .

Page 4: Porting direct x 11 desktop game to uwp app

Win32 Game -> UWP Game : 포팅이 어렵지 않다 .

Page 5: Porting direct x 11 desktop game to uwp app

Win32 • Language : C/C++• Network : winsock• Graphics API : Direct X 9/11• Multi Threading : • _beginthread(),_endthread()

• OS UI Framework : GDI

UWP• Language : C/C++• Network : winsock• Graphics API : DirectX 11• Multi Threading : • _beginthread(),_endthread()

• OS UI Framework : XAML

MMORPG Client 를 만든다고 하면…

Page 6: Porting direct x 11 desktop game to uwp app

포팅시 대응관계• 렌더링할 윈도우 : • HWND -> SwapChainPanel

• 입력 : • Keyboard/Mouse -> Keyboard/Mouse• Xinput -> Xinput , Windows::Gaming::Input

• 네트워크• winsock -> winsock , StreamSocket

Page 7: Porting direct x 11 desktop game to uwp app

GDI Windows Handle - HWNDSwapChainPlanel

<SwapChainPanel x:Name="swapChainPanel"/>

in XAML

Desktop Application – win32 UWP App

Page 8: Porting direct x 11 desktop game to uwp app

포팅시 고려해야할 사항

Page 9: Porting direct x 11 desktop game to uwp app

사용 가능한 win32 API 확인• 사용하고자 하는 함수가 인텔리센스로 확인되지 않으면 Ex 를 붙여볼것 .

FindFirstFileEx(), WaitForSingleObjectEx() 등…• GDI 함수 사용 불가 .

• SetCurrentDirectory(), GetCurrentDirectory() 사용 가능• 지원되지 않는 win32 함수는 내용이 없는 더미 함수를 만들어 일단 컴파일 가능하게 만들어 두면 편하다 . MessageBox() 등

Page 10: Porting direct x 11 desktop game to uwp app

Direct X Feature Level• 디바이스 (GPU) 가 DirectX 의 어느 버전의 기능을 지원하는지 Feature Level 로 구분 .• PC 의 경우 Intel HD Graphics 2000 이상이면 Feature Level 11 은 지원 .

• 대부분의 Windows Phone 디바이스는 DirectX Feature Level 9.3 까지만 지원 .

• Feature Level 9.x 의 의미는 실제로는 DirectX 9기기란 뜻 . • Shader 명령어 개수 제한 , 동시 샘플링 텍스쳐 개수 제한 , 상수 버퍼 용량 제한 , 사용 가능

Shader 명령 제한…모든 기능이 DirectX 9 의 사양으로 제한됨 .• Lumia 950/950XL 을 제외하고 폰을 지원하려면

DirectX 관련 코드를 2 벌 작성해야함

Page 11: Porting direct x 11 desktop game to uwp app

Direct X Feature Level 11.xDX11 Gen PC GPUs,

Mobile GPUs >= Adreno 405

Direct X Feature Level 9.xDX9 Gen PC GPUs ,

Mobile GPUs < Adreno 405

Engine Common DLLsIndependent to Graphics API

• Graphics API 의존적인 레이어를 분리한다 .• Feature Level 9.x 와 11.x 용 DLL 을 따로 만든다 .

Page 12: Porting direct x 11 desktop game to uwp app

DemoDirectX 11 Game Engine for win32 and UWP(Window 10 ,Windows 10 Mobile) https://youtu.be/VRRYi_G2zsc

Testing my game engine on Lumia 1520 https://youtu.be/93ObDDnM4Dg

Testing my game engine on Lumia 950 https://youtu.be/jhGya-2Jw6U