Skip to content

Commit

Permalink
Fix basic triangle example
Browse files Browse the repository at this point in the history
  • Loading branch information
jherico committed Apr 13, 2018
1 parent dafe948 commit 37a3f34
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion base/glfw/glfw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Window {
}

void runWindowLoop(const std::function<void()>& frameHandler) {
while (0 != glfwWindowShouldClose(window)) {
while (0 == glfwWindowShouldClose(window)) {
glfwPollEvents();
frameHandler();
}
Expand Down
8 changes: 7 additions & 1 deletion examples/triangle/triangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,16 @@ class TriangleExample : public glfw::Window {
context.requireDeviceExtensions({ VK_KHR_SWAPCHAIN_EXTENSION_NAME });
context.createInstance();

// The `surface` should be created before the Vulkan `device` because the device selection needs to pick a queue
// that will support presentation to the surface
auto surface = createSurface(context.instance);

context.createDevice(surface);

cmdPool = context.getCommandPool();

swapChain.setup(context.physicalDevice, context.device, context.queue, context.queueIndices.graphics);
swapChain.setSurface(createSurface(context.instance));
swapChain.setSurface(surface);
swapChain.create(size);

setupRenderPass();
Expand Down

0 comments on commit 37a3f34

Please sign in to comment.