Skip to content

Commit e0635cf

Browse files
committed
Formatting, typos, etc
1 parent 5c1613c commit e0635cf

File tree

4 files changed

+52
-52
lines changed

4 files changed

+52
-52
lines changed

guide/src/dear_imgui/dear_imgui.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,37 @@ Dear ImGui has its own initialization and loop, which we encapsulate into `class
44

55
```cpp
66
struct DearImGuiCreateInfo {
7-
GLFWwindow* window{};
8-
std::uint32_t api_version{};
9-
vk::Instance instance{};
10-
vk::PhysicalDevice physical_device{};
11-
std::uint32_t queue_family{};
12-
vk::Device device{};
13-
vk::Queue queue{};
14-
vk::Format color_format{}; // single color attachment.
15-
vk::SampleCountFlagBits samples{};
7+
GLFWwindow* window{};
8+
std::uint32_t api_version{};
9+
vk::Instance instance{};
10+
vk::PhysicalDevice physical_device{};
11+
std::uint32_t queue_family{};
12+
vk::Device device{};
13+
vk::Queue queue{};
14+
vk::Format color_format{}; // single color attachment.
15+
vk::SampleCountFlagBits samples{};
1616
};
1717

1818
class DearImGui {
1919
public:
20-
using CreateInfo = DearImGuiCreateInfo;
20+
using CreateInfo = DearImGuiCreateInfo;
2121

22-
explicit DearImGui(CreateInfo const& create_info);
22+
explicit DearImGui(CreateInfo const& create_info);
2323

24-
void new_frame();
25-
void end_frame();
26-
void render(vk::CommandBuffer command_buffer) const;
24+
void new_frame();
25+
void end_frame();
26+
void render(vk::CommandBuffer command_buffer) const;
2727

2828
private:
29-
enum class State : std::int8_t { Ended, Begun };
29+
enum class State : std::int8_t { Ended, Begun };
3030

31-
struct Deleter {
32-
void operator()(vk::Device device) const;
33-
};
31+
struct Deleter {
32+
void operator()(vk::Device device) const;
33+
};
3434

35-
State m_state{};
35+
State m_state{};
3636

37-
Scoped<vk::Device, Deleter> m_device{};
37+
Scoped<vk::Device, Deleter> m_device{};
3838
};
3939
```
4040
@@ -103,35 +103,35 @@ m_device = Scoped<vk::Device, Deleter>{create_info.device};
103103

104104
// ...
105105
void DearImGui::Deleter::operator()(vk::Device const device) const {
106-
device.waitIdle();
107-
ImGui_ImplVulkan_DestroyFontsTexture();
108-
ImGui_ImplVulkan_Shutdown();
109-
ImGui_ImplGlfw_Shutdown();
110-
ImGui::DestroyContext();
106+
device.waitIdle();
107+
ImGui_ImplVulkan_DestroyFontsTexture();
108+
ImGui_ImplVulkan_Shutdown();
109+
ImGui_ImplGlfw_Shutdown();
110+
ImGui::DestroyContext();
111111
}
112112
```
113113

114114
The remaining functions are straightforward:
115115

116116
```cpp
117117
void DearImGui::new_frame() {
118-
if (m_state == State::Begun) { end_frame(); }
119-
ImGui_ImplGlfw_NewFrame();
120-
ImGui_ImplVulkan_NewFrame();
121-
ImGui::NewFrame();
122-
m_state = State::Begun;
118+
if (m_state == State::Begun) { end_frame(); }
119+
ImGui_ImplGlfw_NewFrame();
120+
ImGui_ImplVulkan_NewFrame();
121+
ImGui::NewFrame();
122+
m_state = State::Begun;
123123
}
124124

125125
void DearImGui::end_frame() {
126-
if (m_state == State::Ended) { return; }
127-
ImGui::Render();
128-
m_state = State::Ended;
126+
if (m_state == State::Ended) { return; }
127+
ImGui::Render();
128+
m_state = State::Ended;
129129
}
130130

131131
// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
132132
void DearImGui::render(vk::CommandBuffer const command_buffer) const {
133-
auto* data = ImGui::GetDrawData();
134-
if (data == nullptr) { return; }
135-
ImGui_ImplVulkan_RenderDrawData(data, command_buffer);
133+
auto* data = ImGui::GetDrawData();
134+
if (data == nullptr) { return; }
135+
ImGui_ImplVulkan_RenderDrawData(data, command_buffer);
136136
}
137137
```

guide/src/dear_imgui/imgui_integration.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ Update `Swapchain` to expose its image format:
1212

1313
```cpp
1414
void App::create_imgui() {
15-
auto const imgui_ci = DearImGui::CreateInfo{
16-
.window = m_window.get(),
17-
.api_version = vk_version_v,
18-
.instance = *m_instance,
19-
.physical_device = m_gpu.device,
20-
.queue_family = m_gpu.queue_family,
21-
.device = *m_device,
22-
.queue = m_queue,
23-
.color_format = m_swapchain->get_format(),
24-
.samples = vk::SampleCountFlagBits::e1,
25-
};
26-
m_imgui.emplace(imgui_ci);
15+
auto const imgui_ci = DearImGui::CreateInfo{
16+
.window = m_window.get(),
17+
.api_version = vk_version_v,
18+
.instance = *m_instance,
19+
.physical_device = m_gpu.device,
20+
.queue_family = m_gpu.queue_family,
21+
.device = *m_device,
22+
.queue = m_queue,
23+
.color_format = m_swapchain->get_format(),
24+
.samples = vk::SampleCountFlagBits::e1,
25+
};
26+
m_imgui.emplace(imgui_ci);
2727
}
2828
```
2929

guide/src/initialization/swapchain.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Swapchain
22

3-
A [Vulkan Swapchain](https://registry.khronos.org/vulkan/specs/latest/man/html/VkSwapchainKHR.html) is an array of presentable images associated with a Surface, which acts as a bridge between the application and the platform's presentation engine (compositor / display engine). The Swapchain will be continually used in the main loop to acquire and present images. Since failing to create a Swapchain is a fatal error, its creation is part of the initialiation section.
3+
A [Vulkan Swapchain](https://registry.khronos.org/vulkan/specs/latest/man/html/VkSwapchainKHR.html) is an array of presentable images associated with a Surface, which acts as a bridge between the application and the platform's presentation engine (compositor / display engine). The Swapchain will be continually used in the main loop to acquire and present images. Since failing to create a Swapchain is a fatal error, its creation is part of the initialization section.
44

55
We shall wrap the Vulkan Swapchain into our own `class Swapchain`. It will also store the a copy of the Images owned by the Vulkan Swapchain, and create (and own) Image Views for each Image. The Vulkan Swapchain may need to be recreated in the main loop, eg when the framebuffer size changes, or an acquire/present operation returns `vk::ErrorOutOfDateKHR`. This will be encapsulated in a `recreate()` function which can simply be called during initialization as well.
66

77
```cpp
88
// swapchain.hpp
99
class Swapchain {
10-
public:
10+
public:
1111
explicit Swapchain(vk::Device device, Gpu const& gpu,
1212
vk::SurfaceKHR surface, glm::ivec2 size);
1313

@@ -17,7 +17,7 @@ class Swapchain {
1717
return {m_ci.imageExtent.width, m_ci.imageExtent.height};
1818
}
1919

20-
private:
20+
private:
2121
void populate_images();
2222
void create_image_views();
2323

guide/src/shader_objects/shader_program.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ auto const layers = get_layers(layers_v);
6262
instance_ci.setPEnabledLayerNames(layers);
6363
```
6464
65-
## `class ShaderObject`
65+
## `class ShaderProgram`
6666
6767
We will encapsulate both vertex and fragment shaders into a single `ShaderProgram`, which will also bind the shaders before a draw, and expose/set various dynamic states.
6868

0 commit comments

Comments
 (0)