Skip to content

Commit

Permalink
Added parentheses to the parameterless lambda functions (MSVC does no…
Browse files Browse the repository at this point in the history
…t support it yet)
  • Loading branch information
stripe2933 committed Oct 1, 2024
1 parent 6a3e359 commit c8ff61f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions impl/control/ImGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ auto vk_gltf_viewer::control::imgui::assetBufferViews(AppState &appState) -> voi
if (ImGui::BeginItemTooltip()) {
ImGui::TextUnformatted(visit_as<cstring_view>(nonempty_or(
appState.gltfAsset->asset.buffers[bufferView.bufferIndex].name,
[&] { return std::format("<Unnamed buffer {}>", bufferView.bufferIndex); })));
[&]() { return std::format("<Unnamed buffer {}>", bufferView.bufferIndex); })));
ImGui::EndTooltip();
}
}, ImGuiTableColumnFlags_WidthFixed },
Expand Down Expand Up @@ -503,7 +503,7 @@ auto vk_gltf_viewer::control::imgui::assetMaterials(AppState &appState, std::spa
else if (gltfAsset.assetInspectorMaterialIndex) {
return ImGui::BeginCombo("Material", visit_as<cstring_view>(nonempty_or(
gltfAsset.asset.materials[*gltfAsset.assetInspectorMaterialIndex].name,
[&] { return std::format("<Unnamed material {}>", *gltfAsset.assetInspectorMaterialIndex); })).c_str());
[&]() { return std::format("<Unnamed material {}>", *gltfAsset.assetInspectorMaterialIndex); })).c_str());
}
else {
return ImGui::BeginCombo("Material", "<select...>");
Expand All @@ -512,7 +512,7 @@ auto vk_gltf_viewer::control::imgui::assetMaterials(AppState &appState, std::spa
if (isComboBoxOpened) {
for (const auto &[i, material] : gltfAsset.asset.materials | ranges::views::enumerate) {
const bool isSelected = i == gltfAsset.assetInspectorMaterialIndex;
if (ImGui::Selectable(visit_as<cstring_view>(nonempty_or(material.name, [&] { return std::format("<Unnamed material {}>", i); })).c_str(), isSelected)) {
if (ImGui::Selectable(visit_as<cstring_view>(nonempty_or(material.name, [&]() { return std::format("<Unnamed material {}>", i); })).c_str(), isSelected)) {
gltfAsset.assetInspectorMaterialIndex = i;
}
if (isSelected) {
Expand Down Expand Up @@ -662,12 +662,12 @@ auto vk_gltf_viewer::control::imgui::assetSceneHierarchies(AppState &appState) -
AppState::GltfAsset &gltfAsset = *appState.gltfAsset;
if (ImGui::BeginCombo("Scene", visit_as<cstring_view>(nonempty_or(
gltfAsset.getScene().name,
[&] { return std::format("<Unnamed scene {}>", gltfAsset.getSceneIndex()); })).c_str())) {
[&]() { return std::format("<Unnamed scene {}>", gltfAsset.getSceneIndex()); })).c_str())) {
for (const auto &[i, scene] : gltfAsset.asset.scenes | ranges::views::enumerate) {
const bool isSelected = i == gltfAsset.getSceneIndex();
if (ImGui::Selectable(visit_as<cstring_view>(nonempty_or(
scene.name,
[&] { return std::format("<Unnamed scene {}>", i); })).c_str(), isSelected)) {
[&]() { return std::format("<Unnamed scene {}>", i); })).c_str(), isSelected)) {
gltfAsset.setScene(i);
}
if (isSelected) {
Expand Down Expand Up @@ -844,7 +844,7 @@ auto vk_gltf_viewer::control::imgui::assetSceneHierarchies(AppState &appState) -
ImGui::TableSetColumnIndex(3);
if (ImGui::TextLink(visit_as<cstring_view>(nonempty_or(
gltfAsset.asset.meshes[*meshIndex].name,
[&] { return std::format("<Unnamed mesh {}>", *meshIndex); })).c_str())) {
[&]() { return std::format("<Unnamed mesh {}>", *meshIndex); })).c_str())) {
// TODO
}
}
Expand All @@ -853,7 +853,7 @@ auto vk_gltf_viewer::control::imgui::assetSceneHierarchies(AppState &appState) -
ImGui::TableSetColumnIndex(4);
if (ImGui::TextLink(visit_as<cstring_view>(nonempty_or(
gltfAsset.asset.lights[*lightIndex].name,
[&] { return std::format("<Unnamed light {}>", *lightIndex); })).c_str())) {
[&]() { return std::format("<Unnamed light {}>", *lightIndex); })).c_str())) {
// TODO
}
}
Expand All @@ -862,7 +862,7 @@ auto vk_gltf_viewer::control::imgui::assetSceneHierarchies(AppState &appState) -
ImGui::TableSetColumnIndex(5);
if (ImGui::TextLink(visit_as<cstring_view>(nonempty_or(
gltfAsset.asset.cameras[*cameraIndex].name,
[&] { return std::format("<Unnamed camera {}>", *cameraIndex); })).c_str())) {
[&]() { return std::format("<Unnamed camera {}>", *cameraIndex); })).c_str())) {
// TODO
}
}
Expand Down Expand Up @@ -977,7 +977,7 @@ auto vk_gltf_viewer::control::imgui::nodeInspector(
if (ImGui::WithLabel("Material"sv, [&]() {
return ImGui::TextLink(visit_as<cstring_view>(nonempty_or(
gltfAsset.asset.materials[*primitive.materialIndex].name,
[&] { return std::format("<Unnamed material {}>", *primitive.materialIndex); })).c_str());
[&]() { return std::format("<Unnamed material {}>", *primitive.materialIndex); })).c_str());
})) {
// TODO.
}
Expand Down
2 changes: 1 addition & 1 deletion interface/vulkan/Gpu.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace vk_gltf_viewer::vulkan {
QueueFamilies(vk::PhysicalDevice physicalDevice, vk::SurfaceKHR surface) {
const std::vector queueFamilyProperties = physicalDevice.getQueueFamilyProperties();
compute = vku::getComputeSpecializedQueueFamily(queueFamilyProperties)
.or_else([&] { return vku::getComputeQueueFamily(queueFamilyProperties); })
.or_else([&]() { return vku::getComputeQueueFamily(queueFamilyProperties); })
.value();
graphicsPresent = vku::getGraphicsPresentQueueFamily(physicalDevice, surface, queueFamilyProperties).value();
transfer = vku::getTransferSpecializedQueueFamily(queueFamilyProperties).value_or(compute);
Expand Down

0 comments on commit c8ff61f

Please sign in to comment.