Store reference to android app in vulkan base class (#97)
This commit is contained in:
parent
f13614e6d2
commit
333eede595
2 changed files with 8 additions and 2 deletions
|
|
@ -218,7 +218,11 @@ VkPipelineShaderStageCreateInfo VulkanExampleBase::loadShader(const char * fileN
|
||||||
VkPipelineShaderStageCreateInfo shaderStage = {};
|
VkPipelineShaderStageCreateInfo shaderStage = {};
|
||||||
shaderStage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
shaderStage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
||||||
shaderStage.stage = stage;
|
shaderStage.stage = stage;
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
shaderStage.module = vkTools::loadShader(androidApp->activity->assetManager, fileName, device, stage);
|
||||||
|
#else
|
||||||
shaderStage.module = vkTools::loadShader(fileName, device, stage);
|
shaderStage.module = vkTools::loadShader(fileName, device, stage);
|
||||||
|
#endif
|
||||||
shaderStage.pName = "main"; // todo : make param
|
shaderStage.pName = "main"; // todo : make param
|
||||||
assert(shaderStage.module != NULL);
|
assert(shaderStage.module != NULL);
|
||||||
shaderModules.push_back(shaderStage.module);
|
shaderModules.push_back(shaderStage.module);
|
||||||
|
|
@ -1176,7 +1180,7 @@ void VulkanExampleBase::initSwapchain()
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
swapChain.initSurface(windowInstance, window);
|
swapChain.initSurface(windowInstance, window);
|
||||||
#elif defined(__ANDROID__)
|
#elif defined(__ANDROID__)
|
||||||
swapChain.initSurface(window);
|
swapChain.initSurface(androidApp->window);
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
swapChain.initSurface(connection, window);
|
swapChain.initSurface(connection, window);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#elif defined(__ANDROID__)
|
#elif defined(__ANDROID__)
|
||||||
#include <android/native_activity.h>
|
#include <android/native_activity.h>
|
||||||
|
#include <android/asset_manager.h>
|
||||||
|
#include <android_native_app_glue.h>
|
||||||
#include "vulkanandroid.h"
|
#include "vulkanandroid.h"
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
|
|
@ -154,7 +156,7 @@ public:
|
||||||
HWND window;
|
HWND window;
|
||||||
HINSTANCE windowInstance;
|
HINSTANCE windowInstance;
|
||||||
#elif defined(__ANDROID__)
|
#elif defined(__ANDROID__)
|
||||||
ANativeWindow* window;
|
android_app* androidApp;
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
struct {
|
struct {
|
||||||
bool left = false;
|
bool left = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue