Skip to content

Commit

Permalink
setRequestedOrientation
Browse files Browse the repository at this point in the history
  • Loading branch information
panos-lunarg committed Feb 12, 2025
1 parent 9000211 commit 9ddac77
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
21 changes: 20 additions & 1 deletion framework/application/android_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,28 @@ AndroidWindow::AndroidWindow(AndroidContext* android_context, ANativeWindow* win

width_ = ANativeWindow_getWidth(window_);
height_ = ANativeWindow_getHeight(window_);

GFXRECON_WRITE_CONSOLE("%s()", __func__)
GFXRECON_WRITE_CONSOLE(" width_: %u", width_)
GFXRECON_WRITE_CONSOLE(" height_: %u", height_)
}

void AndroidWindow::SetSize(const uint32_t width, const uint32_t height)
{
GFXRECON_WRITE_CONSOLE("%s(width: %u height %u)", __func__, width, height)
GFXRECON_WRITE_CONSOLE(" width: %u", width)
GFXRECON_WRITE_CONSOLE(" height: %u", height)

SetSizePreTransform(width, height, format::ResizeWindowPreTransform::kPreTransform0);
}

void AndroidWindow::SetSizePreTransform(const uint32_t width, const uint32_t height, const uint32_t pre_transform)
{
GFXRECON_WRITE_CONSOLE("%s(width: %u height %u pre_tranform: %u)", __func__, width, height, pre_transform)
GFXRECON_WRITE_CONSOLE(" width_: %u", width_)
GFXRECON_WRITE_CONSOLE(" height_: %u", height_)
GFXRECON_WRITE_CONSOLE(" pre_transform_: %u", pre_transform_)

if ((width != width_) || (height != height_) || (pre_transform != pre_transform_))
{
width_ = width;
Expand All @@ -62,6 +75,10 @@ void AndroidWindow::SetSizePreTransform(const uint32_t width, const uint32_t hei
int32_t pixel_width = ANativeWindow_getWidth(window_);
int32_t pixel_height = ANativeWindow_getHeight(window_);

GFXRECON_WRITE_CONSOLE(" pixel_width: %d", pixel_width)
GFXRECON_WRITE_CONSOLE(" pixel_height: %d", pixel_height)


// We don't change the current orientation if width == height or if the requested orientation matches the
// current orientation, unless a pre-transform has been applied to the swapchain, in which case the orientation
// will be adjusted to match the pre-transform.
Expand All @@ -86,7 +103,9 @@ void AndroidWindow::SetSizePreTransform(const uint32_t width, const uint32_t hei
orientation_index ^= 1;
}

android_context_->SetOrientation(kOrientations[orientation_index]);
GFXRECON_WRITE_CONSOLE(" orientation_index: %u", orientation_index)

android_context_->SetOrientation(kOrientations[0]);
}

int32_t result = ANativeWindow_setBuffersGeometry(window_, width, height, ANativeWindow_getFormat(window_));
Expand Down
7 changes: 7 additions & 0 deletions framework/decode/vulkan_replay_consumer_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include "util/platform.h"
#include "util/logging.h"
#include "util/linear_hashmap.h"
#include "util/to_string.h"
#include "decode/mark_injected_commands.h"

#include "spirv_reflect.h"
Expand Down Expand Up @@ -450,6 +451,8 @@ void VulkanReplayConsumerBase::ProcessResizeWindowCommand(format::HandleId surfa
// We need to find the surface associated with this ID, and then lookup its window.
const VulkanSurfaceKHRInfo* surface_info = object_info_table_->GetVkSurfaceKHRInfo(surface_id);

GFXRECON_WRITE_CONSOLE("%s(width: %u, height: %u)", __func__, width, height)

if (surface_info != nullptr)
{
Window* window = surface_info->window;
Expand Down Expand Up @@ -488,6 +491,8 @@ void VulkanReplayConsumerBase::ProcessResizeWindowCommand2(format::HandleId surf
// We need to find the surface associated with this ID, and then lookup its window.
const VulkanSurfaceKHRInfo* surface_info = object_info_table_->GetVkSurfaceKHRInfo(surface_id);

GFXRECON_WRITE_CONSOLE("%s(width: %u, height: %u, pre_transform: %u)", __func__, width, height, pre_transform)

if (surface_info != nullptr)
{
Window* window = surface_info->window;
Expand Down Expand Up @@ -2162,6 +2167,8 @@ void VulkanReplayConsumerBase::SetSwapchainWindowSize(const Decoded_VkSwapchainC
const auto surface_info = object_info_table_->GetVkSurfaceKHRInfo(swapchain_info->surface);
if (surface_info && (surface_info->window != nullptr))
{
GFXRECON_WRITE_CONSOLE("%s()", __func__)
GFXRECON_WRITE_CONSOLE(" preTransform: %s", gfxrecon::util::ToString<VkSurfaceTransformFlagBitsKHR>(create_info->preTransform).c_str())
uint32_t pre_transform = 0;
switch (create_info->preTransform)
{
Expand Down

0 comments on commit 9ddac77

Please sign in to comment.