MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / draw_gui

Method draw_gui

samples/performance/msaa/msaa.cpp:773–857  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

771}
772
773void MSAASample::draw_gui()
774{
775 auto msaa_enabled = sample_count != VK_SAMPLE_COUNT_1_BIT;
776 const bool landscape = camera->get_aspect_ratio() > 1.0f;
777 uint32_t lines = landscape ? 3 : 4;
778
779 get_gui().show_options_window(
780 [this, msaa_enabled, landscape]() {
781 ImGui::AlignTextToFramePadding();
782 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.4f);
783 if (ImGui::BeginCombo("##sample_count", to_string(gui_sample_count).c_str()))
784 {
785 for (size_t n = 0; n < supported_sample_count_list.size(); n++)
786 {
787 bool is_selected = (gui_sample_count == supported_sample_count_list[n]);
788 if (ImGui::Selectable(to_string(supported_sample_count_list[n]).c_str(), is_selected))
789 {
790 gui_sample_count = supported_sample_count_list[n];
791 }
792 if (is_selected)
793 {
794 ImGui::SetItemDefaultFocus();
795 }
796 }
797 ImGui::EndCombo();
798 }
799 if (landscape)
800 {
801 ImGui::SameLine();
802 }
803 ImGui::Checkbox("Post-processing (2 renderpasses)", &gui_run_postprocessing);
804
805 ImGui::Text("Resolve color: ");
806 ImGui::SameLine();
807 if (msaa_enabled)
808 {
809 ImGui::RadioButton("On writeback", &gui_color_resolve_method, ColorResolve::OnWriteback);
810 ImGui::SameLine();
811 ImGui::RadioButton("Separate", &gui_color_resolve_method, ColorResolve::SeparatePass);
812 }
813 else
814 {
815 ImGui::Text("n/a");
816 }
817
818 ImGui::Text("Resolve depth: ");
819 ImGui::SameLine();
820 if (msaa_enabled && run_postprocessing)
821 {
822 if (depth_writeback_resolve_supported)
823 {
824 ImGui::Checkbox("##resolve_depth", &gui_resolve_depth_on_writeback);
825 ImGui::SameLine();
826 ImGui::Text("On writeback");
827 ImGui::SameLine();
828 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.3f);
829 if (ImGui::BeginCombo("##resolve_mode", to_string(gui_depth_resolve_mode).c_str()))
830 {

Callers

nothing calls this directly

Calls 4

get_aspect_ratioMethod · 0.80
show_options_windowMethod · 0.80
sizeMethod · 0.80
to_stringFunction · 0.70

Tested by

no test coverage detected