Skip to content

Commit 8a32c68

Browse files
committed
PreRelease Fix
Android Optimize Release Script Fix
1 parent 35253e1 commit 8a32c68

File tree

9 files changed

+62
-32
lines changed

9 files changed

+62
-32
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
./build_android.sh
4949
- name: Create zip file
5050
run: |
51-
zip -r gknextrenderer_android_${{ github.ref_name }}.zip ./android/app/build/outputs/apk/debug/app-debug.apk ./deploy_android.bat
51+
zip -r gknextrenderer_android_${{ github.ref_name }}.zip ./android/app/build/outputs/apk/release/app-release.apk ./deploy_android.bat
5252
- name: Upload Release Asset
5353
uses: actions/upload-release-asset@v1
5454
env:
@@ -124,7 +124,7 @@ jobs:
124124
- name: Create zip file
125125
run: |
126126
cd build/windows
127-
copy /Y ..\..\package\*.bat %CD%
127+
Copy-Item -Path ..\..\package\*.bat -Destination .
128128
zip -r gknextrenderer_win64_${{ github.ref_name }}.zip ./bin ./assets/locale ./assets/fonts ./assets/models ./assets/shaders ./assets/textures ./*.bat
129129
- name: Upload Release Asset
130130
uses: actions/upload-release-asset@v1

.vscode/settings.json

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,29 @@
100100
"format": "cpp",
101101
"ranges": "cpp",
102102
"stop_token": "cpp",
103-
"cfenv": "cpp"
103+
"cfenv": "cpp",
104+
"filesystem": "cpp",
105+
"execution": "cpp",
106+
"print": "cpp",
107+
"spanstream": "cpp",
108+
"stacktrace": "cpp",
109+
"stdfloat": "cpp",
110+
"syncstream": "cpp",
111+
"xfacet": "cpp",
112+
"xhash": "cpp",
113+
"xiosbase": "cpp",
114+
"xlocale": "cpp",
115+
"xlocbuf": "cpp",
116+
"xlocinfo": "cpp",
117+
"xlocmes": "cpp",
118+
"xlocmon": "cpp",
119+
"xlocnum": "cpp",
120+
"xloctime": "cpp",
121+
"xmemory": "cpp",
122+
"xstring": "cpp",
123+
"xtr1common": "cpp",
124+
"xtree": "cpp",
125+
"xutility": "cpp",
126+
"slist": "cpp"
104127
},
105128
}

android/app/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
apply plugin: 'com.android.application'
1616

1717
android {
18+
signingConfigs {
19+
release {
20+
storeFile file('../keystore/public.jks')
21+
storePassword 'public'
22+
keyAlias 'public'
23+
keyPassword 'public'
24+
}
25+
}
1826
namespace = "com.gknextrenderer"
1927
compileSdkVersion 33
2028
//ndkVersion "25.2.9519653" on runner, ndk may differ from the vcpkg one
@@ -41,6 +49,7 @@ android {
4149
}
4250
}
4351
buildTypes.release.minifyEnabled = false
52+
buildTypes.release.signingConfig = signingConfigs.release
4453
buildFeatures.prefab = true
4554
}
4655

android/keystore/public.jks

2.45 KB
Binary file not shown.

deploy_android.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
pushd android
2-
adb install -r ./app/build/outputs/apk/debug/app-debug.apk
2+
adb install -r ./app/build/outputs/apk/release/app-release.apk
33
adb shell monkey -p com.gknextrenderer 1
44
popd

src/AndroidMain.cpp

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,18 @@ void handle_cmd(android_app* app, int32_t cmd) {
3030
MakeExternalDirectory(app, "assets/textures");
3131
MakeExternalDirectory(app, "assets/locale");
3232

33-
const char* argv[] = { "gkNextRenderer", "--renderer=4", "--scene=1", "--load-scene=simple.glb"};
34-
const Options options(4, argv);
35-
GOption = &options;
36-
GApplication.reset(new NextRendererApplication(options, app->window));
37-
__android_log_print(ANDROID_LOG_INFO, "vkdemo",
38-
"start gknextrenderer: %d", options.RendererType);
33+
const char* argv[] = { "gkNextRenderer", "--renderer=1" };
34+
GOption = new Options(2, argv);
35+
GApplication.reset(new NextRendererApplication(*GOption, app->window));
3936
GApplication->Start();
4037
}
4138
break;
4239
case APP_CMD_TERM_WINDOW:
4340
// The window is being hidden or closed, clean it up.
4441
{
45-
42+
delete GOption;
4643
}
4744
break;
48-
default:
49-
__android_log_print(ANDROID_LOG_INFO, "Vulkan Tutorials",
50-
"event not handled: %d", cmd);
5145
}
5246
}
5347

@@ -69,14 +63,14 @@ static int32_t engine_handle_input(struct android_app* app) {
6963
case AMOTION_EVENT_ACTION_UP:
7064
io.AddMouseSourceEvent(ImGuiMouseSource_Mouse);
7165
io.AddMousePosEvent(GameActivityPointerAxes_getAxisValue(
72-
&event->pointers[ptrIdx], AMOTION_EVENT_AXIS_X) * 0.75, GameActivityPointerAxes_getAxisValue(
73-
&event->pointers[ptrIdx], AMOTION_EVENT_AXIS_Y) * 0.75);
66+
&event->pointers[ptrIdx], AMOTION_EVENT_AXIS_X) * 0.5, GameActivityPointerAxes_getAxisValue(
67+
&event->pointers[ptrIdx], AMOTION_EVENT_AXIS_Y) * 0.5);
7468
io.AddMouseButtonEvent(0, event->action == AMOTION_EVENT_ACTION_DOWN);
7569

7670
GApplication->OnTouch(event->action == AMOTION_EVENT_ACTION_DOWN, GameActivityPointerAxes_getAxisValue(
77-
&event->pointers[ptrIdx], AMOTION_EVENT_AXIS_Y) * 0.75,
71+
&event->pointers[ptrIdx], AMOTION_EVENT_AXIS_Y) * 0.5,
7872
GameActivityPointerAxes_getAxisValue(
79-
&event->pointers[ptrIdx], AMOTION_EVENT_AXIS_X) * 0.75);
73+
&event->pointers[ptrIdx], AMOTION_EVENT_AXIS_X) * 0.5);
8074

8175
break;
8276
case AMOTION_EVENT_ACTION_MOVE:
@@ -88,14 +82,14 @@ static int32_t engine_handle_input(struct android_app* app) {
8882
//...
8983
io.AddMouseSourceEvent(ImGuiMouseSource_Mouse);
9084
io.AddMousePosEvent(GameActivityPointerAxes_getAxisValue(
91-
&event->pointers[ptrIdx], AMOTION_EVENT_AXIS_X) * 0.75,
85+
&event->pointers[ptrIdx], AMOTION_EVENT_AXIS_X) * 0.5,
9286
GameActivityPointerAxes_getAxisValue(
93-
&event->pointers[ptrIdx], AMOTION_EVENT_AXIS_Y) * 0.75);
87+
&event->pointers[ptrIdx], AMOTION_EVENT_AXIS_Y) * 0.5);
9488

9589
GApplication->OnTouchMove(GameActivityPointerAxes_getAxisValue(
96-
&event->pointers[ptrIdx], AMOTION_EVENT_AXIS_Y) * 0.75,
90+
&event->pointers[ptrIdx], AMOTION_EVENT_AXIS_Y) * 0.5,
9791
GameActivityPointerAxes_getAxisValue(
98-
&event->pointers[ptrIdx], AMOTION_EVENT_AXIS_X) * 0.75);
92+
&event->pointers[ptrIdx], AMOTION_EVENT_AXIS_X) * 0.5);
9993
break;
10094
}
10195
}

src/Runtime/Application.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ UserSettings CreateUserSettings(const Options& options)
115115

116116
userSettings.IsRayTraced = true;
117117
userSettings.AccumulateRays = false;
118+
118119
userSettings.NumberOfSamples = options.Benchmark ? 1 : options.Samples;
119120
userSettings.NumberOfBounces = options.Benchmark ? 4 : options.Bounces;
120121
userSettings.MaxNumberOfBounces = options.MaxBounces;
@@ -148,6 +149,11 @@ UserSettings CreateUserSettings(const Options& options)
148149
userSettings.DenoiseSigmaNormal = 0.005f;
149150
userSettings.DenoiseSize = 5;
150151

152+
#if ANDROID
153+
userSettings.NumberOfSamples = 1;
154+
userSettings.Denoiser = false;
155+
#endif
156+
151157
return userSettings;
152158
}
153159

src/Runtime/UserInterface.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ UserInterface::UserInterface(
199199

200200
// Window scaling and style.
201201
#if ANDROID
202-
const auto scaleFactor = 1.5;
202+
const auto scaleFactor = 1.0;
203203
#elif __APPLE__
204204
const auto scaleFactor = 1.0;
205205
#else
@@ -477,7 +477,11 @@ void UserInterface::DrawSettings()
477477
const ImVec2 pos = ImVec2(distance, distance);
478478
const ImVec2 posPivot = ImVec2(0.0f, 0.0f);
479479
ImGui::SetNextWindowPos(pos, ImGuiCond_Always, posPivot);
480+
#if ANDROID
481+
ImGui::SetNextWindowSize(ImVec2(300,-1));
482+
#else
480483
ImGui::SetNextWindowSize(ImVec2(400,-1));
484+
#endif
481485
ImGui::SetNextWindowBgAlpha(0.9f);
482486

483487
const auto flags =
@@ -601,7 +605,7 @@ void UserInterface::DrawOverlay(const Statistics& statistics, Vulkan::VulkanGpuT
601605
const auto& io = ImGui::GetIO();
602606
const float distance = 10.0f;
603607
#if ANDROID
604-
const ImVec2 pos = ImVec2(io.DisplaySize.x * 0.75 - distance, distance);
608+
const ImVec2 pos = ImVec2(io.DisplaySize.x * 0.5 - distance, distance);
605609
const ImVec2 posPivot = ImVec2(1.0f, 0.0f);
606610
#else
607611
const ImVec2 pos = ImVec2(io.DisplaySize.x - distance, distance);

src/Vulkan/SwapChain.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ SwapChain::SwapChain(const class Device& device, const VkPresentModeKHR presentM
3535

3636
#if ANDROID
3737
float aspect = extent.width / static_cast<float>(extent.height);
38-
extent.height = 1920;
39-
extent.width = floorf(1920 * aspect);
38+
extent.height = 1280;
39+
extent.width = floorf(1280 * aspect);
4040
#endif
4141

4242
VkSwapchainCreateInfoKHR createInfo = {};
@@ -233,12 +233,6 @@ VkPresentModeKHR SwapChain::ChooseSwapPresentMode(const std::vector<VkPresentMod
233233

234234
VkExtent2D SwapChain::ChooseSwapExtent(const Window& window, const VkSurfaceCapabilitiesKHR& capabilities)
235235
{
236-
#if ANDROID
237-
__android_log_print(ANDROID_LOG_INFO, "vkdemo",
238-
"curr capabilities res: %d x %d", capabilities.currentExtent.width, capabilities.currentExtent.height);
239-
__android_log_print(ANDROID_LOG_INFO, "vkdemo",
240-
"max capabilities res: %d x %d", capabilities.maxImageExtent.width, capabilities.maxImageExtent.height);
241-
#endif
242236
// Vulkan tells us to match the resolution of the window by setting the width and height in the currentExtent member.
243237
// However, some window managers do allow us to differ here and this is indicated by setting the width and height in
244238
// currentExtent to a special value: the maximum value of uint32_t. In that case we'll pick the resolution that best

0 commit comments

Comments
 (0)