Skip to content

Commit f731014

Browse files
authored
Unify vkb::Gui and vkb::HPPGui into vkb::Gui<bindingType> (KhronosGroup#1376)
1 parent 5d014e2 commit f731014

13 files changed

Lines changed: 1283 additions & 2714 deletions

File tree

app/plugins/user_interface_options/user_interface_options.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <algorithm>
2222

2323
#include "gui.h"
24-
#include "hpp_gui.h"
2524

2625
namespace plugins
2726
{
@@ -40,8 +39,8 @@ bool UserInterfaceOptions::handle_option(std::deque<std::string> &arguments)
4039
std::string option = arguments[0].substr(2);
4140
if (option == "hideui")
4241
{
43-
vkb::Gui::visible = false;
44-
vkb::HPPGui::visible = false;
42+
vkb::GuiC::visible = false;
43+
vkb::GuiCpp::visible = false;
4544

4645
arguments.pop_front();
4746
return true;

framework/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,12 @@ set(FRAMEWORK_FILES
4444
hpp_api_vulkan_sample.h
4545
hpp_fence_pool.h
4646
hpp_gltf_loader.h
47-
hpp_gui.h
4847
hpp_resource_binding_state.h
4948
hpp_resource_cache.h
5049
hpp_resource_record.h
5150
hpp_resource_replay.h
5251
hpp_semaphore_pool.h
5352
# Source Files
54-
gui.cpp
5553
drawer.cpp
5654
spirv_reflection.cpp
5755
gltf_loader.cpp
@@ -67,7 +65,6 @@ set(FRAMEWORK_FILES
6765
timer.cpp
6866
camera_core.cpp
6967
hpp_api_vulkan_sample.cpp
70-
hpp_gui.cpp
7168
hpp_resource_cache.cpp)
7269

7370
set(COMMON_FILES

framework/common/hpp_vk_common.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,26 @@ inline void image_layout_transition(vk::CommandBuffer command_buf
152152
static_cast<VkImageSubresourceRange const &>(subresource_range));
153153
}
154154

155+
inline void make_filters_valid(vk::PhysicalDevice physical_device, vk::Format format, vk::Filter *filter, vk::SamplerMipmapMode *mipmapMode = nullptr)
156+
{
157+
// Not all formats support linear filtering, so we need to adjust them if they don't
158+
if (*filter == vk::Filter::eNearest && (mipmapMode == nullptr || *mipmapMode == vk::SamplerMipmapMode::eNearest))
159+
{
160+
return; // These must already be valid
161+
}
162+
163+
vk::FormatProperties properties = physical_device.getFormatProperties(format);
164+
165+
if (!(properties.optimalTilingFeatures & vk::FormatFeatureFlagBits::eSampledImageFilterLinear))
166+
{
167+
*filter = vk::Filter::eNearest;
168+
if (mipmapMode)
169+
{
170+
*mipmapMode = vk::SamplerMipmapMode::eNearest;
171+
}
172+
}
173+
}
174+
155175
inline vk::SurfaceFormatKHR select_surface_format(vk::PhysicalDevice gpu,
156176
vk::SurfaceKHR surface,
157177
std::vector<vk::Format> const &preferred_formats = {

0 commit comments

Comments
 (0)