Skip to content

Comments

Feature/por android#84

Open
psjuan97 wants to merge 4 commits intoTry:masterfrom
psjuan97:feature/por_android
Open

Feature/por android#84
psjuan97 wants to merge 4 commits intoTry:masterfrom
psjuan97:feature/por_android

Conversation

@psjuan97
Copy link

No description provided.

@psjuan97 psjuan97 marked this pull request as ready for review February 17, 2026 21:35
Copy link
Owner

@Try Try left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And one bug elephant: project-file generation supposed to be handle in engine, not in opengothic

}

void VSwapchain::reset() {
Tempest::Log::i("VSwapchain::reset() called - possible screen rotation detected");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug leftovers?

if(vkCreateWin32SurfaceKHR(instance,&createInfo,nullptr,&ret)!=VK_SUCCESS)
throw std::system_error(Tempest::GraphicsErrc::NoDevice);
#elif defined(__ANDROID__)
ANativeWindow* window = tempest_android_get_native_window();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All other platforms get window handle from hwnd:
ANativeWindow* window = reinterpret_cast<ANativeWindow*>(hwnd)

Detail::vkAssert(code);
#else
if(code==VK_SUBOPTIMAL_KHR) {
Tempest::Log::i("VSwapchain::present: SUBOPTIMAL - rotation change during present");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rotation?! This part of code is disabled on android.

#include <condition_variable>
#include <queue>

#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "Tempest", __VA_ARGS__))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be Tempest::Log:: not a custom macro

static std::atomic_bool g_hasWindow{false};

// Gamepad state tracking (uses struct from SystemApi)
static GamepadState g_gamepad;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not mix things in a single PR. Get it running first - game-pad after as different PR

set(TEMPEST_BUILD_DIRECTX12 OFF CACHE INTERNAL "")

# Add android_native_app_glue
set(ANDROID_NATIVE_APP_GLUE_DIR "${ANDROID_NDK}/sources/android/native_app_glue")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same native_app_glue linked in OpenGothic pr, wasn't it?


createInfo.preTransform = swapChainSupport.capabilities.currentTransform;
// Determine the correct transform based on window dimensions for Android
VkSurfaceTransformFlagBitsKHR selectedTransform = swapChainSupport.capabilities.currentTransform;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just set prerotation to auto

break;

case APP_CMD_TERM_WINDOW:
g_hasWindow.store(false);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How termination handled in Android? Is it possible that OS queues APP_CMD_TERM_WINDOW, destroys window, but we may get some swapchain operation, before it is processed?


static void pushEvent(const AppEvent& evt) {
std::lock_guard<std::mutex> lock(g_eventMutex);
g_eventQueue.push(evt);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is a threading model here? How many threads are involved?

}

// The application entry point - calls user's main() after setup
int main(int argc, const char** argv);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C11 allows multiple flavors of main function - that just one of them. You need to use dlsym to dynamically acquire address of the main(int,char**) and call it as cdecl - it should be compatible with all other kinds of main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants