Skip to content

Commit 42fc441

Browse files
Android changes (SaschaWillems#1194)
* Update to latest MacOS image * Minor android cleanup Removed no longer required std functionality
1 parent 495a135 commit 42fc441

File tree

5 files changed

+20
-32
lines changed

5 files changed

+20
-32
lines changed

base/VulkanAndroid.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Android Vulkan function pointer loader
33
*
4-
* Copyright (C) 2016-2024 by Sascha Willems - www.saschawillems.de
4+
* Copyright (C) 2016-2025 by Sascha Willems - www.saschawillems.de
55
*
66
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
77
*/
@@ -359,7 +359,6 @@ namespace vks
359359
jni->DeleteLocalRef(jmessage);
360360

361361
androidApp->activity->vm->DetachCurrentThread();
362-
return;
363362
}
364363
}
365364
}

base/VulkanAndroid.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Android Vulkan function pointer prototypes
33
*
4-
* Copyright (C) 2016-2024 by Sascha Willems - www.saschawillems.de
4+
* Copyright (C) 2016-2025 by Sascha Willems - www.saschawillems.de
55
*
66
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
77
*/
@@ -29,16 +29,6 @@
2929
#include <memory>
3030
#include <string>
3131

32-
// Missing from the NDK
33-
namespace std
34-
{
35-
template<typename T, typename... Args>
36-
std::unique_ptr<T> make_unique(Args&&... args)
37-
{
38-
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
39-
}
40-
}
41-
4232
// Global reference to android application object
4333
extern android_app* androidApp;
4434

examples/dynamicrenderingmultisampling/dynamicrenderingmultisampling.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class VulkanExample : public VulkanExampleBase
4040
VkDeviceMemory memory{ VK_NULL_HANDLE };
4141
};
4242
Image renderImage;
43-
Image depthStencilRenderImage;
4443

4544
VulkanExample() : VulkanExampleBase()
4645
{
@@ -67,7 +66,7 @@ class VulkanExample : public VulkanExampleBase
6766
deviceCreatepNextChain = &enabledDynamicRenderingFeaturesKHR;
6867
}
6968

70-
~VulkanExample()
69+
~VulkanExample() override
7170
{
7271
if (device) {
7372
vkDestroyPipeline(device, pipeline, nullptr);
@@ -160,7 +159,7 @@ class VulkanExample : public VulkanExampleBase
160159
}
161160

162161
// Enable physical device features required for this example
163-
virtual void getEnabledFeatures()
162+
void getEnabledFeatures() override
164163
{
165164
// Enable anisotropic filtering if supported
166165
if (deviceFeatures.samplerAnisotropy) {
@@ -174,7 +173,7 @@ class VulkanExample : public VulkanExampleBase
174173
model.loadFromFile(getAssetPath() + "models/voyager.gltf", vulkanDevice, queue, glTFLoadingFlags);
175174
}
176175

177-
void buildCommandBuffers()
176+
void buildCommandBuffers() override
178177
{
179178
VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo();
180179

@@ -365,7 +364,7 @@ class VulkanExample : public VulkanExampleBase
365364
memcpy(uniformBuffer.mapped, &uniformData, sizeof(uniformData));
366365
}
367366

368-
void prepare()
367+
void prepare() override
369368
{
370369
VulkanExampleBase::prepare();
371370

@@ -390,7 +389,7 @@ class VulkanExample : public VulkanExampleBase
390389
VulkanExampleBase::submitFrame();
391390
}
392391

393-
virtual void render()
392+
void render() override
394393
{
395394
if (!prepared)
396395
return;

examples/triangle/triangle.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Contrary to the other examples, this one won't make use of helper functions or initializers
77
* Except in a few cases (swap chain setup e.g.)
88
*
9-
* Copyright (C) 2016-2024 by Sascha Willems - www.saschawillems.de
9+
* Copyright (C) 2016-2025 by Sascha Willems - www.saschawillems.de
1010
*
1111
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
1212
*/
@@ -126,7 +126,7 @@ class VulkanExample : public VulkanExampleBase
126126
// Values not set here are initialized in the base class constructor
127127
}
128128

129-
~VulkanExample()
129+
~VulkanExample() override
130130
{
131131
// Clean up used Vulkan resources
132132
// Note: Inherited destructor cleans up resources stored in base class
@@ -452,7 +452,7 @@ class VulkanExample : public VulkanExampleBase
452452

453453
// Create the depth (and stencil) buffer attachments used by our framebuffers
454454
// Note: Override of virtual function in the base class and called from within VulkanExampleBase::prepare
455-
void setupDepthStencil()
455+
void setupDepthStencil() override
456456
{
457457
// Create an optimal image used as the depth stencil attachment
458458
VkImageCreateInfo imageCI{};
@@ -502,7 +502,7 @@ class VulkanExample : public VulkanExampleBase
502502

503503
// Create a frame buffer for each swap chain image
504504
// Note: Override of virtual function in the base class and called from within VulkanExampleBase::prepare
505-
void setupFrameBuffer()
505+
void setupFrameBuffer() override
506506
{
507507
// Create a frame buffer for every image in the swapchain
508508
frameBuffers.resize(swapChain.images.size());
@@ -533,7 +533,7 @@ class VulkanExample : public VulkanExampleBase
533533
// This allows the driver to know up-front what the rendering will look like and is a good opportunity to optimize especially on tile-based renderers (with multiple subpasses)
534534
// Using sub pass dependencies also adds implicit layout transitions for the attachment used, so we don't need to add explicit image memory barriers to transform them
535535
// Note: Override of virtual function in the base class and called from within VulkanExampleBase::prepare
536-
void setupRenderPass()
536+
void setupRenderPass() override
537537
{
538538
// This example will use a single render pass with one subpass
539539

@@ -622,7 +622,7 @@ class VulkanExample : public VulkanExampleBase
622622
// Vulkan loads its shaders from an immediate binary representation called SPIR-V
623623
// Shaders are compiled offline from e.g. GLSL using the reference glslang compiler
624624
// This function loads such a shader from a binary file and returns a shader module structure
625-
VkShaderModule loadSPIRVShader(std::string filename)
625+
VkShaderModule loadSPIRVShader(const std::string& filename)
626626
{
627627
size_t shaderSize;
628628
char* shaderCode{ nullptr };
@@ -886,7 +886,7 @@ class VulkanExample : public VulkanExampleBase
886886

887887
}
888888

889-
void prepare()
889+
void prepare() override
890890
{
891891
VulkanExampleBase::prepare();
892892
createSynchronizationPrimitives();
@@ -900,7 +900,7 @@ class VulkanExample : public VulkanExampleBase
900900
prepared = true;
901901
}
902902

903-
virtual void render()
903+
void render() override
904904
{
905905
if (!prepared)
906906
return;

examples/trianglevulkan13/trianglevulkan13.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class VulkanExample : public VulkanExampleBase
117117
deviceCreatepNextChain = &enabledFeatures;
118118
}
119119

120-
~VulkanExample()
120+
~VulkanExample() override
121121
{
122122
// Clean up used Vulkan resources
123123
// Note: Inherited destructor cleans up resources stored in base class
@@ -381,7 +381,7 @@ class VulkanExample : public VulkanExampleBase
381381

382382
// Create the depth (and stencil) buffer attachments
383383
// While we don't do any depth testing in this sample, having depth testing is very common so it's a good idea to learn it from the very start
384-
void setupDepthStencil()
384+
void setupDepthStencil() override
385385
{
386386
// Create an optimal tiled image used as the depth stencil attachment
387387
VkImageCreateInfo imageCI{ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO };
@@ -428,7 +428,7 @@ class VulkanExample : public VulkanExampleBase
428428
// Vulkan loads its shaders from an immediate binary representation called SPIR-V
429429
// Shaders are compiled offline from e.g. GLSL using the reference glslang compiler
430430
// This function loads such a shader from a binary file and returns a shader module structure
431-
VkShaderModule loadSPIRVShader(std::string filename)
431+
VkShaderModule loadSPIRVShader(const std::string& filename)
432432
{
433433
size_t shaderSize;
434434
char* shaderCode{ nullptr };
@@ -661,7 +661,7 @@ class VulkanExample : public VulkanExampleBase
661661

662662
}
663663

664-
void prepare()
664+
void prepare() override
665665
{
666666
VulkanExampleBase::prepare();
667667
createSynchronizationPrimitives();
@@ -673,7 +673,7 @@ class VulkanExample : public VulkanExampleBase
673673
prepared = true;
674674
}
675675

676-
virtual void render() override
676+
void render() override
677677
{
678678
// Use a fence to wait until the command buffer has finished execution before using it again
679679
vkWaitForFences(device, 1, &waitFences[currentFrame], VK_TRUE, UINT64_MAX);

0 commit comments

Comments
 (0)