Skip to content

Commit 4b4a243

Browse files
committed
committing requested changes in stages.
1 parent a58b884 commit 4b4a243

7 files changed

Lines changed: 61 additions & 70 deletions

File tree

en/Building_a_Simple_Engine/Mobile_Development/01_introduction.adoc

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
::pp: {plus}{plus}
1+
:pp: {plus}{plus}
22

33
= Mobile Development: Introduction
4-
:doctype: book
5-
:sectnums:
6-
:sectnumlevels: 4
7-
:toc: left
8-
:icons: font
9-
:source-highlighter: highlightjs
10-
:source-language: c++
114

125
== Introduction to Mobile Development
136

@@ -17,23 +10,21 @@ Mobile development presents unique challenges and opportunities for Vulkan appli
1710

1811
=== What We'll Cover
1912

20-
In this chapter, we'll explore:
13+
This chapter will guide you through the complex landscape of mobile Vulkan development, where desktop assumptions often don't apply. We'll start by examining the platform-specific requirements of Android and iOS, which present unique challenges in setup, lifecycle management, and input handling. Mobile applications face constraints that desktop applications rarely encounter—sudden interruptions, battery concerns, and varying hardware capabilities all require careful consideration in your engine design.
2114

22-
* *Platform Considerations for Android and iOS*: We'll discuss the specific requirements and constraints of developing Vulkan applications for Android and iOS, including platform-specific setup, lifecycle management, and input handling.
15+
Performance optimization takes on critical importance in mobile environments where every watt of power consumption and every millisecond of frame time affects user experience. We'll explore essential techniques like power-of-two texture usage and efficient texture formats, along with mobile-specific optimizations that can mean the difference between smooth performance and user frustration.
2316

24-
* *Performance Optimizations for Mobile*: We'll explore techniques for optimizing your engine for mobile hardware, focusing on power-of-two textures, efficient texture formats, and other mobile-specific optimizations.
17+
Understanding the fundamental architectural differences between mobile and desktop GPUs becomes essential for effective optimization. We'll compare Tile-Based Rendering (TBR) and Immediate Mode Rendering (IMR) approaches, helping you understand why techniques that work well on desktop might perform poorly on mobile, and how to design rendering strategies that leverage mobile GPU strengths.
2518

26-
* *Rendering Approaches*: We'll compare Tile-Based Rendering (TBR) and Immediate Mode Rendering (IMR), understanding their implications for mobile GPU architectures.
27-
28-
* *Vulkan Extensions for Mobile*: We'll explore extensions like VK_KHR_dynamic_rendering_local_read, VK_KHR_dynamic_rendering, and VK_EXT_shader_tile_image that can significantly improve performance on mobile devices.
19+
Finally, we'll explore the Vulkan extensions specifically designed for mobile platforms. Extensions like VK_KHR_dynamic_rendering_local_read, VK_KHR_dynamic_rendering, and VK_EXT_shader_tile_image unlock performance opportunities that can dramatically improve your application's efficiency on mobile hardware, transforming acceptable performance into exceptional user experiences.
2920

3021
=== Prerequisites
3122

32-
Before diving into this chapter, you should be familiar with:
23+
This chapter represents the culmination of everything we've built throughout the previous chapters, as mobile development requires deep integration with all engine systems. You'll need solid mastery of Vulkan fundamentals and the engine architecture we've developed, since mobile optimization often requires fine-tuning at every level—from resource management and rendering pipelines to memory allocation and synchronization.
24+
25+
Modern C++ expertise becomes particularly valuable in mobile development, where performance constraints demand efficient code and careful resource management. C++17 and C++20 features like constexpr, structured bindings, and concepts help create mobile-optimized code that performs well under strict power and thermal limitations.
3326

34-
* The basics of Vulkan and our engine architecture from previous chapters
35-
* Modern C++ concepts, particularly those introduced in C++17 and C++20
36-
* Basic understanding of mobile development concepts
27+
Understanding basic mobile development concepts will provide crucial context for the platform-specific decisions we'll make. Mobile applications operate under constraints that desktop applications rarely face—app lifecycle events, varying screen densities, touch input paradigms, and the need to preserve battery life all influence how we design and implement our Vulkan engine for mobile platforms.
3728

3829
Let's begin by exploring the platform considerations for Android and iOS.
3930

en/Building_a_Simple_Engine/Mobile_Development/02_platform_considerations.adoc

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
::pp: {plus}{plus}
1+
:pp: {plus}{plus}
22

33
= Mobile Development: Platform Considerations
4-
:doctype: book
5-
:sectnums:
6-
:sectnumlevels: 4
7-
:toc: left
8-
:icons: font
9-
:source-highlighter: highlightjs
10-
:source-language: c++
114

125
== Platform Considerations for Android and iOS
136

en/Building_a_Simple_Engine/Mobile_Development/03_performance_optimizations.adoc

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1-
::pp: {plus}{plus}
1+
:pp: {plus}{plus}
22

33
= Mobile Development: Performance Optimizations
4-
:doctype: book
5-
:sectnums:
6-
:sectnumlevels: 4
7-
:toc: left
8-
:icons: font
9-
:source-highlighter: highlightjs
10-
:source-language: c++
114

125
== Performance Optimizations for Mobile
136

147
Mobile devices have significantly different hardware constraints compared to desktop systems. In this section, we'll explore key performance optimizations that are essential for achieving good performance on mobile platforms.
158

169
=== Texture Optimizations
1710

11+
To keep the workflow concrete and digestible, think of texture optimization in three steps:
12+
13+
1) Step 1: Ensure power‑of‑two (POT) dimensions (resize if needed)
14+
2) Step 2: Pick a hardware‑compressed format supported by the device (ASTC → ETC2 → BC → fallback)
15+
3) Step 3: Upload/update the Vulkan image and clean up staging resources
16+
17+
[NOTE]
18+
====
19+
We focus on mobile‑specific decisions here. For general Vulkan image creation, staging uploads, and descriptor setup, refer back to earlier chapters in the engine series—link:../Engine_Architecture/04_resource_management.adoc[Resource Management], link:../Engine_Architecture/05_rendering_pipeline.adoc[Rendering Pipeline]—or the Vulkan Guide (https://docs.vulkan.org/guide/latest/).
20+
====
21+
1822
Textures are often the largest consumers of memory in a graphics application. Optimizing them is crucial for mobile performance.
1923

2024
==== Power-of-Two Textures

en/Building_a_Simple_Engine/Mobile_Development/04_rendering_approaches.adoc

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
::pp: {plus}{plus}
1+
:pp: {plus}{plus}
22

33
= Mobile Development: Rendering Approaches
4-
:doctype: book
5-
:sectnums:
6-
:sectnumlevels: 4
7-
:toc: left
8-
:icons: font
9-
:source-highlighter: highlightjs
10-
:source-language: c++
114

125
== Rendering Approaches for Mobile GPUs
136

en/Building_a_Simple_Engine/Mobile_Development/05_vulkan_extensions.adoc

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
::pp: {plus}{plus}
1+
:pp: {plus}{plus}
22

33
= Mobile Development: Vulkan Extensions
4-
:doctype: book
5-
:sectnums:
6-
:sectnumlevels: 4
7-
:toc: left
8-
:icons: font
9-
:source-highlighter: highlightjs
10-
:source-language: c++
114

125
== Vulkan Extensions for Mobile
136

@@ -25,9 +18,13 @@ The `VK_KHR_dynamic_rendering` extension (now part of Vulkan 1.3 core) allows yo
2518
2. *Enables More Flexible Rendering*: Makes it easier to implement techniques that don't fit well into the traditional render pass model.
2619
3. *Reduces API Overhead*: Fewer objects to create and manage means less CPU overhead.
2720

28-
==== Implementation
21+
==== Implementation (Step-by-step)
22+
23+
Let's break the setup into a few small, focused steps.
24+
25+
===== Enable the extension and load entry points
2926

30-
Here's how to use dynamic rendering:
27+
We first enable the device extension and, if you're not on Vulkan 1.3 core, load the function pointers.
3128

3229
[source,cpp]
3330
----
@@ -44,8 +41,16 @@ PFN_vkCmdBeginRenderingKHR vkCmdBeginRenderingKHR =
4441
PFN_vkCmdEndRenderingKHR vkCmdEndRenderingKHR =
4542
reinterpret_cast<PFN_vkCmdEndRenderingKHR>(
4643
vkGetDeviceProcAddr(device, "vkCmdEndRenderingKHR"));
44+
----
45+
46+
This prepares your device to use dynamic rendering and gives access to the commands needed to begin/end a rendering scope without a traditional render pass.
47+
48+
===== Describe attachments for this rendering scope
4749

48-
// Begin rendering
50+
We define the color and depth attachments and package them into a VkRenderingInfoKHR. Think of this as an inline, one-off description of what would normally be baked into render pass/framebuffer objects.
51+
52+
[source,cpp]
53+
----
4954
VkRenderingAttachmentInfoKHR color_attachment{};
5055
color_attachment.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO_KHR;
5156
color_attachment.imageView = color_image_view;
@@ -69,7 +74,16 @@ rendering_info.layerCount = 1;
6974
rendering_info.colorAttachmentCount = 1;
7075
rendering_info.pColorAttachments = &color_attachment;
7176
rendering_info.pDepthAttachment = &depth_attachment;
77+
----
78+
79+
Each frame (or subpass-equivalent), you can tweak these descriptors directly (e.g., swapchain views after resize), avoiding pipeline-wide re-creation.
7280

81+
===== Begin rendering, draw, end rendering
82+
83+
With the attachments described, we open the rendering scope, record draws, then close the scope.
84+
85+
[source,cpp]
86+
----
7387
vkCmdBeginRenderingKHR(command_buffer, &rendering_info);
7488
7589
// Record drawing commands
@@ -80,7 +94,11 @@ vkCmdDraw(command_buffer, vertex_count, 1, 0, 0);
8094
vkCmdEndRenderingKHR(command_buffer);
8195
----
8296

83-
When using C++ bindings:
97+
The begin/end pair replaces vkCmdBeginRenderPass/vkCmdEndRenderPass while providing more flexibility for modern rendering flows.
98+
99+
===== C++ bindings (vulkan.hpp) variant
100+
101+
If you're using vulkan.hpp (vk::), the structure population is more ergonomic but follows the same steps.
84102

85103
[source,cpp]
86104
----
@@ -104,7 +122,12 @@ rendering_info.setRenderArea(render_area);
104122
rendering_info.setLayerCount(1);
105123
rendering_info.setColorAttachments(color_attachment);
106124
rendering_info.setPDepthAttachment(&depth_attachment);
125+
----
126+
127+
Once the description is assembled, begin the rendering scope, submit draws, and end the scope.
107128

129+
[source,cpp]
130+
----
108131
command_buffer.beginRenderingKHR(rendering_info);
109132
110133
// Record drawing commands

en/Building_a_Simple_Engine/Mobile_Development/06_conclusion.adoc

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
::pp: {plus}{plus}
1+
:pp: {plus}{plus}
22

33
= Mobile Development: Conclusion
4-
:doctype: book
5-
:sectnums:
6-
:sectnumlevels: 4
7-
:toc: left
8-
:icons: font
9-
:source-highlighter: highlightjs
10-
:source-language: c++
114

125
== Conclusion
136

en/Building_a_Simple_Engine/Mobile_Development/index.adoc

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
::pp: {plus}{plus}
1+
:pp: {plus}{plus}
22

33
= Mobile Development
4-
:doctype: book
5-
:sectnums:
6-
:sectnumlevels: 4
7-
:toc: left
8-
:icons: font
9-
:source-highlighter: highlightjs
10-
:source-language: c++
4+
115

126
This chapter covers the essential aspects of adapting your Vulkan engine for mobile platforms, focusing on Android and iOS development, performance optimizations, rendering approaches, and mobile-specific Vulkan extensions.
137

0 commit comments

Comments
 (0)