On screen resize: the previous screen width and height are in current extent returned from vkGetPhysicalDeviceSurfaceCapabilitiesKHRSet ImageView width and height programmatically?Get screen width and height in AndroidNative window queueBuffer function not rendering output from Stagefright decoderIs it possible to render to a UWP App using Vulkan?Vulkan swapchain with 0 extentsegfault in vkCmdDrawIndexed when creating command buffers for second timeVulkan - At vkQueuePresentKHR, the validation layer throws an error message regarding the image layoutvulkan x and y switchedphantom images after going from split screen to full screenPhantom images on SurfaceView if app comes to forground again before onPause completes
Do we know the situation in Britain before Sealion (summer 1940)?
How do I set a custom order for folders on Windows 7 and 10?
What is the difference between an astronaut in the ISS and a freediver in perfect neutral buoyancy?
Does wetting a beer glass change the foam characteristics?
Is it more effective to add yeast before or after kneading?
Is it possible to encode a message in such a way that can only be read by someone or something capable of seeing into the very near future?
What is the meaning of word 'crack' in chapter 33 of A Game of Thrones?
Suffocation while cooking under an umbrella?
Under what circumstances would RAM locations 0 and 1 be written and/or read on the C64?
Cut a cake into 3 equal portions with only a knife
What is the meaning of "heutig" in this sentence?
Meaning of 'ran' in German?
Golf (6-card) Golf!
1, 2, 4, 8, 16, ... 33?
How 象【しょう】 ( ≈かたち、 すがた、ようす) and 象【ぞう】 (どうぶつ) got to be written with the same kanji?
Does "as soon as" imply simultaneity?
A food item only made possible by time-freezing storage?
Concrete example of Vertex Cover to Subset Sum reduction
Is it impolite to ask for halal food when traveling to and in Thailand?
Should the average user with no special access rights be worried about SMS-based 2FA being theoretically interceptable?
How do pilots align the HUD with their eyeballs?
Received a package but didn't order it
Strange Sticky Substance on Digital Camera
Seeming violation-wave travelling faster than speed of light
On screen resize: the previous screen width and height are in current extent returned from vkGetPhysicalDeviceSurfaceCapabilitiesKHR
Set ImageView width and height programmatically?Get screen width and height in AndroidNative window queueBuffer function not rendering output from Stagefright decoderIs it possible to render to a UWP App using Vulkan?Vulkan swapchain with 0 extentsegfault in vkCmdDrawIndexed when creating command buffers for second timeVulkan - At vkQueuePresentKHR, the validation layer throws an error message regarding the image layoutvulkan x and y switchedphantom images after going from split screen to full screenPhantom images on SurfaceView if app comes to forground again before onPause completes
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am writing a game for Android using the Java for the user interface and C++ with the NDK for the render thread. It uses Vulkan if available and otherwise uses OpenGL ES. This bug occurs in Vulkan only.
There are a variety of reasons that the surface would be resized in the game. An example is if a user is using the app in split screen mode, then moves to full screen mode. For this case, I do not shut the entire app down and restart, rather I handle the resize myself via a call to SurfaceHolder.Callback.surfaceChanged.
When the surface is resized, I get a call to SurfaceHolder.Callback.surfaceChanged. I pass the event to my C++ render thread. The render thread waits for the device to become idle (by calling vkDeviceWaitIdle), then destroys the swapchain, depth image, render pass, graphics pipeline, frame buffers, and swapchain commands. When it recreates the swapchain, it calls: vkGetPhysicalDeviceSurfaceCapabilitiesKHR to get the current extent for the surface and passes the current extent into the vkCreateSwapchainKHR through VkSwapchainCreateInfoKHR.imageExtent. Immediately after recreating the swapchain, updating the perspective matrix, etc, I draw a frame.
My problem is that the VkSurfaceCapabilitiesKHR.currentExtent comes back from vkGetPhysicalDeviceSurfaceCapabilitiesKHR with the previous surface size. This problem only happens if nothing is going on in the game and no new frame is drawn for a while.
I can fix this problem by passing in the values for the width and height received by SurfaceHolder.Callback.surfaceChanged to the render thread and then down to the swapchain recreation. But I think this is the wrong solution. Why isn't currentExtent the size of the surface like it says in the docs? SurfaceHolder.Callback.surfaceChanged is supposed to get called after all changes to the surface occurred.
I can also fix the issue by drawing a frame before recreating the swapchain. But I feel that this is also the wrong solution unless I understand why this is happening. Do I have to do something other than wait for the device to become idle before recreating the swapchain?
I have the validation layers enabled (and know they are working) and they report nothing.
Let me know if you need any more information. Thanks for all your help.
add a comment
|
I am writing a game for Android using the Java for the user interface and C++ with the NDK for the render thread. It uses Vulkan if available and otherwise uses OpenGL ES. This bug occurs in Vulkan only.
There are a variety of reasons that the surface would be resized in the game. An example is if a user is using the app in split screen mode, then moves to full screen mode. For this case, I do not shut the entire app down and restart, rather I handle the resize myself via a call to SurfaceHolder.Callback.surfaceChanged.
When the surface is resized, I get a call to SurfaceHolder.Callback.surfaceChanged. I pass the event to my C++ render thread. The render thread waits for the device to become idle (by calling vkDeviceWaitIdle), then destroys the swapchain, depth image, render pass, graphics pipeline, frame buffers, and swapchain commands. When it recreates the swapchain, it calls: vkGetPhysicalDeviceSurfaceCapabilitiesKHR to get the current extent for the surface and passes the current extent into the vkCreateSwapchainKHR through VkSwapchainCreateInfoKHR.imageExtent. Immediately after recreating the swapchain, updating the perspective matrix, etc, I draw a frame.
My problem is that the VkSurfaceCapabilitiesKHR.currentExtent comes back from vkGetPhysicalDeviceSurfaceCapabilitiesKHR with the previous surface size. This problem only happens if nothing is going on in the game and no new frame is drawn for a while.
I can fix this problem by passing in the values for the width and height received by SurfaceHolder.Callback.surfaceChanged to the render thread and then down to the swapchain recreation. But I think this is the wrong solution. Why isn't currentExtent the size of the surface like it says in the docs? SurfaceHolder.Callback.surfaceChanged is supposed to get called after all changes to the surface occurred.
I can also fix the issue by drawing a frame before recreating the swapchain. But I feel that this is also the wrong solution unless I understand why this is happening. Do I have to do something other than wait for the device to become idle before recreating the swapchain?
I have the validation layers enabled (and know they are working) and they report nothing.
Let me know if you need any more information. Thanks for all your help.
add a comment
|
I am writing a game for Android using the Java for the user interface and C++ with the NDK for the render thread. It uses Vulkan if available and otherwise uses OpenGL ES. This bug occurs in Vulkan only.
There are a variety of reasons that the surface would be resized in the game. An example is if a user is using the app in split screen mode, then moves to full screen mode. For this case, I do not shut the entire app down and restart, rather I handle the resize myself via a call to SurfaceHolder.Callback.surfaceChanged.
When the surface is resized, I get a call to SurfaceHolder.Callback.surfaceChanged. I pass the event to my C++ render thread. The render thread waits for the device to become idle (by calling vkDeviceWaitIdle), then destroys the swapchain, depth image, render pass, graphics pipeline, frame buffers, and swapchain commands. When it recreates the swapchain, it calls: vkGetPhysicalDeviceSurfaceCapabilitiesKHR to get the current extent for the surface and passes the current extent into the vkCreateSwapchainKHR through VkSwapchainCreateInfoKHR.imageExtent. Immediately after recreating the swapchain, updating the perspective matrix, etc, I draw a frame.
My problem is that the VkSurfaceCapabilitiesKHR.currentExtent comes back from vkGetPhysicalDeviceSurfaceCapabilitiesKHR with the previous surface size. This problem only happens if nothing is going on in the game and no new frame is drawn for a while.
I can fix this problem by passing in the values for the width and height received by SurfaceHolder.Callback.surfaceChanged to the render thread and then down to the swapchain recreation. But I think this is the wrong solution. Why isn't currentExtent the size of the surface like it says in the docs? SurfaceHolder.Callback.surfaceChanged is supposed to get called after all changes to the surface occurred.
I can also fix the issue by drawing a frame before recreating the swapchain. But I feel that this is also the wrong solution unless I understand why this is happening. Do I have to do something other than wait for the device to become idle before recreating the swapchain?
I have the validation layers enabled (and know they are working) and they report nothing.
Let me know if you need any more information. Thanks for all your help.
I am writing a game for Android using the Java for the user interface and C++ with the NDK for the render thread. It uses Vulkan if available and otherwise uses OpenGL ES. This bug occurs in Vulkan only.
There are a variety of reasons that the surface would be resized in the game. An example is if a user is using the app in split screen mode, then moves to full screen mode. For this case, I do not shut the entire app down and restart, rather I handle the resize myself via a call to SurfaceHolder.Callback.surfaceChanged.
When the surface is resized, I get a call to SurfaceHolder.Callback.surfaceChanged. I pass the event to my C++ render thread. The render thread waits for the device to become idle (by calling vkDeviceWaitIdle), then destroys the swapchain, depth image, render pass, graphics pipeline, frame buffers, and swapchain commands. When it recreates the swapchain, it calls: vkGetPhysicalDeviceSurfaceCapabilitiesKHR to get the current extent for the surface and passes the current extent into the vkCreateSwapchainKHR through VkSwapchainCreateInfoKHR.imageExtent. Immediately after recreating the swapchain, updating the perspective matrix, etc, I draw a frame.
My problem is that the VkSurfaceCapabilitiesKHR.currentExtent comes back from vkGetPhysicalDeviceSurfaceCapabilitiesKHR with the previous surface size. This problem only happens if nothing is going on in the game and no new frame is drawn for a while.
I can fix this problem by passing in the values for the width and height received by SurfaceHolder.Callback.surfaceChanged to the render thread and then down to the swapchain recreation. But I think this is the wrong solution. Why isn't currentExtent the size of the surface like it says in the docs? SurfaceHolder.Callback.surfaceChanged is supposed to get called after all changes to the surface occurred.
I can also fix the issue by drawing a frame before recreating the swapchain. But I feel that this is also the wrong solution unless I understand why this is happening. Do I have to do something other than wait for the device to become idle before recreating the swapchain?
I have the validation layers enabled (and know they are working) and they report nothing.
Let me know if you need any more information. Thanks for all your help.
edited Mar 29 at 1:20
shizhen
6,3459 gold badges22 silver badges53 bronze badges
6,3459 gold badges22 silver badges53 bronze badges
asked Mar 28 at 17:28
Cerulean QuasarCerulean Quasar
451 silver badge6 bronze badges
451 silver badge6 bronze badges
add a comment
|
add a comment
|
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55403653%2fon-screen-resize-the-previous-screen-width-and-height-are-in-current-extent-ret%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55403653%2fon-screen-resize-the-previous-screen-width-and-height-are-in-current-extent-ret%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown