Skip to content

Commit 89074c8

Browse files
Minor fixes and finished up chap10 for now
1 parent c16f60c commit 89074c8

File tree

3 files changed

+33
-11
lines changed

3 files changed

+33
-11
lines changed

chap04/chap04-linux.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ If you're targeting Windows as well, you should surround the include by the `#if
1717
For this chapter, we're going to be writing the contents of these two methods:
1818

1919
```cpp
20-
void initWindow() {}
20+
void createWindow() {}
2121
void renderLoop() {}
2222
```
2323

@@ -35,7 +35,7 @@ xcb_atom_t wmProtocols;
3535
xcb_atom_t wmDeleteWin;
3636
```
3737

38-
to our `VulkanSwapchain` class.
38+
to our `VulkanExample` class.
3939

4040
### Getting a Connection
4141

@@ -326,7 +326,7 @@ xcb_change_property(connection, XCB_PROP_MODE_REPLACE, window,
326326
All we need to do now is write the contents of the `renderLoop` method. Again, I'm not going to be going too far into depth because this is just glue and we're focused on Vulkan here. Anyways, we'll be using the `xcb_wait_for_event` method to do just that: wait for events. In order to convert the server's response to a value we can check in a **switch case** block, we need to use the bitwise `AND` (`&`) operator with the value: `~0x80`. You can see what I'm talking about below:
327327
328328
```cpp
329-
void VulkanSwapchain::renderLoop() {
329+
void VulkanExample::renderLoop() {
330330
bool running = true;
331331
xcb_generic_event_t *event;
332332
xcb_client_message_event_t *cm;

chap04/chap04-windows.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ HWND window;
148148
In this section we'll be writing the body this method:
149149

150150
```cpp
151-
void initWindow(HINSTANCE hInstance) {}
151+
void createWindow(HINSTANCE hInstance) {}
152152
```
153153
154154
Don't worry about `hInstance` for now. It is passed from the `WinMain` method we'll write later on. To setup our window, we'll need to register it with Windows, but first, we need to create a `WNDCLASSEX` object to pass during registration.
@@ -349,7 +349,7 @@ switch (message) {
349349
For this section, we'll write the body of this method:
350350

351351
```cpp
352-
void VulkanSwapchain::renderLoop() {}
352+
void VulkanExample::renderLoop() {}
353353
```
354354

355355
We're calling it `renderLoop` because later we'll make calls to rendering functions within it. For now, however, we're going to:
@@ -374,7 +374,7 @@ while (GetMessage(&message, NULL, 0, 0)) {
374374
This is our application's new entry-point. We will **not** be using your typical `int main()` entry-point. This is because Windows requires GUI applications to enter at `WinMain`. We need to:
375375

376376
- Create an instance of our class
377-
- Call our `initWindow` method
377+
- Call our `createWindow` method
378378
- Call our `renderLoop`
379379

380380
**Definition for `WinMain`**:
@@ -401,7 +401,7 @@ int CALLBACK WinMain(
401401
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
402402
LPSTR lpCmdLine, int nCmdShow) {
403403
VulkanSwapchain ve = VulkanSwapchain();
404-
ve.initWindow(hInstance);
404+
ve.createWindow(hInstance);
405405
ve.renderLoop();
406406
}
407407
```

chap10/chap10.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ For this section, we'll be adding a new variable to our `VulkanExample` class:
5757
VkCommandBuffer initialCmdBuffer;
5858
```
5959

60-
In addition to that, we'll also be writing the body of a new method:
60+
In addition to that, we'll also be writing the body of a new method for the next few sections:
6161

6262
```cpp
6363
void VulkanExample::createInitialCommandBuffer() {}
@@ -121,14 +121,14 @@ VkResult vkAllocateCommandBuffers(
121121
Per usual, in addition to calling the method, we'll also verify it was successful.
122122
123123
```cpp
124-
VkResult result = vkAllocateCommandBuffers(device, &cmdBufAllocInfo,
124+
VkResult result = vkAllocateCommandBuffers(device, &cmdBufAllocInfo,
125125
&initialCmdBuffer);
126126
assert(result == VK_SUCCESS);
127127
```
128128

129129
## Preparing Command Buffer for Recording
130130

131-
Before we can start recording to our command buffer, we'll have to first create a `VkCommandBufferBeginInfo` object.
131+
Before we can start recording to our command buffer, we'll have to first create a `VkCommandBufferBeginInfo` object.
132132

133133
**Definition for `VkCommandBufferBeginInfo`**:
134134

@@ -157,4 +157,26 @@ cmdBufBeginInfo.flags = 0;
157157
cmdBufBeginInfo.pNext = NULL;
158158
```
159159

160-
## Beginning Recording to Command Buffer
160+
## Begin Recording to a Command Buffer
161+
162+
Now that we've allocated a command buffer and readied the information Vulkan needs to begin recording, we can call `vkBeginCommandBuffer`. This method will take a handle to our command buffer and put it in a recording state.
163+
164+
**Definition for `vkBeginCommandBuffer`**:
165+
166+
```cpp
167+
VkResult vkBeginCommandBuffer(
168+
VkCommandBuffer commandBuffer,
169+
const VkCommandBufferBeginInfo* pBeginInfo);
170+
```
171+
172+
**[Documentation](https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#vkBeginCommandBuffer) for `vkBeginCommandBuffer`**:
173+
174+
- `commandBuffer` is the handle of the command buffer which is to be put in the recording state.
175+
- `pBeginInfo` is an instance of the `VkCommandBufferBeginInfo` structure, which defines additional information about how the command buffer begins recording.
176+
177+
**Usage for `vkBeginCommandBuffer`**:
178+
179+
```cpp
180+
result = vkBeginCommandBuffer(initialCmdBuffer, &cmdBufBeginInfo);
181+
assert(result == VK_SUCCESS);
182+
```

0 commit comments

Comments
 (0)