-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update vulkan swapchain recreation examples #3390
Closed
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
65972e1
Update sfml example for best swapchain recreation
RoryO a37c025
Fix updating clear color
RoryO 8eecc01
Update sdl example for best swapchain recreation
RoryO 13657dd
Fix updating clear color on sdl
RoryO 72e2174
Examples: Vulkan: Reworked buffer resize handling, fix for Linux/X11.…
ocornut 8cfc82d
Clean up clear color copying
RoryO 3c839f5
Rebuild swapchain data when viewport out of date
RoryO 91aab1c
Swapchain may become out of date before acquiring image
RoryO 25d7d71
Invalidate draw data if swapchain out of date
RoryO 2f394d6
style fixes
RoryO bfdc9d9
Centralize vulkan viewport resize logic
RoryO 994a86d
Style
RoryO File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -459,6 +459,7 @@ int main(int, char**) | |
bool show_demo_window = true; | ||
bool show_another_window = false; | ||
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); | ||
memcpy(&wd->ClearValue.color.float32[0], &clear_color, 4 * sizeof(float)); | ||
|
||
// Main loop | ||
while (!glfwWindowShouldClose(window)) | ||
|
@@ -505,7 +506,8 @@ int main(int, char**) | |
ImGui::Checkbox("Another Window", &show_another_window); | ||
|
||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f | ||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color | ||
if (ImGui::ColorEdit3("clear color", (float*)&clear_color)) // Edit 3 floats representing a color | ||
memcpy(&wd->ClearValue.color.float32[0], &clear_color, 4 * sizeof(float)); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those changes have been removed in the merged commits, favoring a simpler approach of copying in 1 location below (the removed line). |
||
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) | ||
counter++; | ||
|
@@ -530,7 +532,6 @@ int main(int, char**) | |
ImGui::Render(); | ||
ImDrawData* main_draw_data = ImGui::GetDrawData(); | ||
const bool main_is_minimized = (main_draw_data->DisplaySize.x <= 0.0f || main_draw_data->DisplaySize.y <= 0.0f); | ||
memcpy(&wd->ClearValue.color.float32[0], &clear_color, 4 * sizeof(float)); | ||
if (!main_is_minimized) | ||
FrameRender(wd, main_draw_data); | ||
|
||
|
@@ -541,11 +542,14 @@ int main(int, char**) | |
ImGui::RenderPlatformWindowsDefault(); | ||
} | ||
|
||
if (g_SwapChainRebuild) // Main viewport resized in the middle of this frame, go on to next frame. | ||
continue; | ||
|
||
// Present Main Platform Window | ||
if (!main_is_minimized) | ||
FramePresent(wd); | ||
} | ||
|
||
} | ||
// Cleanup | ||
err = vkDeviceWaitIdle(g_Device); | ||
check_vk_result(err); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is duplicate, it's already above in the changelog.