Skip to content

Commit 352bd8e

Browse files
Completed Vulkan enabling on Android (closed DiligentGraphics/DiligentCore#33)
1 parent f4a2ebe commit 352bd8e

9 files changed

Lines changed: 26 additions & 59 deletions

File tree

.gitignore

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,2 @@
1-
*.sdf
2-
*.opensdf
3-
*.tlog
4-
*.lastbuildstate
5-
*.idb
6-
*.manifest
7-
*.user
8-
*.suo
9-
*.ipch
10-
*.o
11-
*.a
12-
*.aps
13-
*.ilk
14-
*.pdb
15-
*.dll
16-
*.exp
17-
*.lib
18-
*.iobj
19-
*.ipdb
20-
*.db
21-
libs
22-
obj
23-
VisualGDBCache
24-
bin
25-
ARM
26-
gen
27-
tmp
28-
*.log
29-
*.mk.old
30-
*.opendb
31-
local.properties
32-
project.properties
33-
proguard-project.txt
34-
html
35-
doc/latex
36-
*.obj
37-
Debug
38-
Release
39-
/cmk_build
40-
/build
41-
*.db-shm
42-
*.db-wal
43-
*.vspx
44-
*.VC.db
45-
*.VC.VC.opendb
1+
build
462
.vs

DiligentCore

Submodule DiligentCore updated 31 files

DiligentSamples

Submodule DiligentSamples updated 48 files

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ It is distributed under [Apache 2.0 license](License.txt) and is free to use.
6161
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/windows-logo.png" width=24 valign="middle"> Win32 (Windows desktop)| Direct3D11, Direct3D12, OpenGL4.2+, Vulkan | [![Build Status](https://ci.appveyor.com/api/projects/status/github/DiligentGraphics/DiligentEngine?svg=true)](https://ci.appveyor.com/project/DiligentGraphics/diligentengine) |
6262
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/uwindows-logo.png" width=24 valign="middle"> Universal Windows | Direct3D11, Direct3D12 | [![Build Status](https://ci.appveyor.com/api/projects/status/github/DiligentGraphics/DiligentEngine?svg=true)](https://ci.appveyor.com/project/DiligentGraphics/diligentengine) |
6363
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/linux-logo.png" width=24 valign="middle"> Linux | OpenGL4.2+, Vulkan | [![Build Status](https://travis-ci.org/DiligentGraphics/DiligentEngine.svg?branch=master)](https://travis-ci.org/DiligentGraphics/DiligentEngine) |
64-
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/android-logo.png" width=24 valign="middle"> Android | OpenGLES3.0+ | |
64+
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/android-logo.png" width=24 valign="middle"> Android | OpenGLES3.0+, Vulkan | |
6565
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/macos-logo.png" width=24 valign="middle"> MacOS | OpenGL4.1, Vulkan (via [MoltenVK](https://github.com/KhronosGroup/MoltenVK)) | [![Build Status](https://travis-ci.org/DiligentGraphics/DiligentEngine.svg?branch=master)](https://travis-ci.org/DiligentGraphics/DiligentEngine) |
6666
| <img src="https://github.com/DiligentGraphics/DiligentCore/blob/master/media/apple-logo.png" width=24 valign="middle"> iOS | OpenGLES3.0, Vulkan (via [MoltenVK](https://github.com/KhronosGroup/MoltenVK)) | [![Build Status](https://travis-ci.org/DiligentGraphics/DiligentEngine.svg?branch=master)](https://travis-ci.org/DiligentGraphics/DiligentEngine) |
6767

@@ -267,11 +267,21 @@ Please make sure that your machine is set up for Android development. Download
267267
and other required tools. If you are not using CMake version bundled with Android Studio, make sure
268268
your build files are [properly configured](https://developer.android.com/studio/projects/add-native-code.html#use_a_custom_cmake_version).
269269
To verify that your environment is properly set up, try building the
270-
[teapots sample](https://github.com/googlesamples/android-ndk/tree/master/teapots).
270+
[teapots sample](https://github.com/googlesamples/android-ndk/tree/master/teapots) as well as
271+
[Vulkan Android tutorials](https://github.com/googlesamples/android-vulkan-tutorials).
272+
273+
Known issues:
274+
275+
* If native build does not find python executable, add `PYTHON_EXECUTABLE` variable to [CMake arguments in NativeApp's
276+
build.gradle file](https://github.com/DiligentGraphics/DiligentTools/blob/master/NativeApp/Android/build.gradle#L12):
277+
`-DPYTHON_EXECUTABLE=/Path/To/Your/Python36/python.exe`
278+
* If native build messes up shader_list.h file, go to git and undo the changes.
271279

272280
Open *DiligentSamples/Android* or *UnityPlugin/Android* folders with Android Studio to build and run
273281
the engine samples and Unity emulator on Android.
274282

283+
By default, appplications will run in OpenGLES mode. To run them in Vulkan mode, add the following launch flags:
284+
`--es mode vk` (in Android Studio, go to Run->Edit Configurations menu)
275285

276286
<a name="build_and_run_macos"></a>
277287
## MacOS
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
Library
22
Temp
3-
build
3+
build
4+
Logs

unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D11.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ class ProxySwapChainD3D11 : public SwapChainBase<ISwapChainD3D11>
4141
UNEXPECTED("Present is not expected to be called directly");
4242
}
4343

44-
virtual void DILIGENT_CALL_TYPE Resize(Uint32 NewWidth, Uint32 NewHeight) override final
44+
virtual void DILIGENT_CALL_TYPE Resize(Uint32 NewWidth, Uint32 NewHeight, SURFACE_TRANSFORM NewPreTransform) override final
4545
{
46-
TBase::Resize(NewWidth, NewHeight, 0);
46+
TBase::Resize(NewWidth, NewHeight, NewPreTransform, 0);
4747
}
4848

4949
void ReleaseViews()
@@ -150,7 +150,7 @@ void DiligentGraphicsAdapterD3D11::PostSwapChainResize()
150150
{
151151
auto* GraphicsD3D11Impl = m_UnityGraphicsD3D11.GetGraphicsImpl();
152152
auto* pProxySwapChainD3D11 = m_pProxySwapChain.RawPtr<ProxySwapChainD3D11>();
153-
pProxySwapChainD3D11->Resize(GraphicsD3D11Impl->GetBackBufferWidth(), GraphicsD3D11Impl->GetBackBufferHeight());
153+
pProxySwapChainD3D11->Resize(GraphicsD3D11Impl->GetBackBufferWidth(), GraphicsD3D11Impl->GetBackBufferHeight(), SURFACE_TRANSFORM_OPTIMAL);
154154
pProxySwapChainD3D11->CreateViews(GraphicsD3D11Impl->GetRTV(), GraphicsD3D11Impl->GetDSV());
155155
}
156156

unityplugin/UnityEmulator/src/DiligentGraphicsAdapterD3D12.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ class ProxySwapChainD3D12 : public SwapChainBase<ISwapChainD3D12>
125125
UNEXPECTED("Windowed mode cannot be set through the proxy swap chain");
126126
}
127127

128-
virtual void DILIGENT_CALL_TYPE Resize(Uint32 NewWidth, Uint32 NewHeight) override final
128+
virtual void DILIGENT_CALL_TYPE Resize(Uint32 NewWidth, Uint32 NewHeight, SURFACE_TRANSFORM NewPreTransform) override final
129129
{
130-
TBase::Resize(NewWidth, NewHeight, 0);
130+
TBase::Resize(NewWidth, NewHeight, NewPreTransform, 0);
131131
}
132132

133133
void ReleaseBuffers()

unityplugin/UnityEmulator/src/DiligentGraphicsAdapterGL.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ class ProxySwapChainGL : public SwapChainBase<ISwapChainGL>
4848
UNEXPECTED("Windowed mode cannot be set through the proxy swap chain");
4949
}
5050

51-
virtual void DILIGENT_CALL_TYPE Resize(Uint32 NewWidth, Uint32 NewHeight)override final
51+
virtual void DILIGENT_CALL_TYPE Resize(Uint32 NewWidth, Uint32 NewHeight, SURFACE_TRANSFORM NewPreTransform)override final
5252
{
53-
if (TBase::Resize(NewWidth, NewHeight, 0))
53+
if (TBase::Resize(NewWidth, NewHeight, NewPreTransform))
5454
{
5555
CreateDummyBuffers();
5656
}
@@ -145,7 +145,7 @@ void DiligentGraphicsAdapterGL::BeginFrame()
145145
auto *UnityGraphicsGLImpl = m_UnityGraphicsGL.GetGraphicsImpl();
146146
Uint32 Width = UnityGraphicsGLImpl->GetBackBufferWidth();
147147
Uint32 Height = UnityGraphicsGLImpl->GetBackBufferHeight();
148-
m_pProxySwapChain.RawPtr<ProxySwapChainGL>()->Resize(Width, Height);
148+
m_pProxySwapChain.RawPtr<ProxySwapChainGL>()->Resize(Width, Height, SURFACE_TRANSFORM_OPTIMAL);
149149
}
150150

151151
void DiligentGraphicsAdapterGL::EndFrame()

0 commit comments

Comments
 (0)