Skip to content

Commit

Permalink
Switching to ezvcpkg build
Browse files Browse the repository at this point in the history
  • Loading branch information
jherico committed Aug 3, 2019
1 parent 2e248db commit 9f47c0a
Show file tree
Hide file tree
Showing 42 changed files with 244 additions and 48,717 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ cmake_policy(VERSION 3.6)
include("cmake/defaults.cmake")
set(NAME VulkanCppExamples)

include("cmake/ezvcpkg.cmake")

ezvcpkg_fetch(
PACKAGES assimp basisu imgui glad glfw3 gli glm vulkan
UPDATE_TOOLCHAIN
)

project(${NAME})

Expand Down
4 changes: 2 additions & 2 deletions base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ file(GLOB_RECURSE COMMON_SOURCE *.c *.cpp *.h *.hpp)
add_library(${TARGET_NAME} STATIC ${COMMON_SOURCE})
set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "common")
add_dependencies(${TARGET_NAME} shaders)
target_link_libraries(${TARGET_NAME} imgui)

target_basisu()
target_glfw3()
target_glm()
target_gli()
Expand All @@ -37,5 +37,5 @@ target_glad()

if (ANDROID)
add_dependencies(${TARGET_NAME} app-glue)
target_link_libraries(${TARGET_NAME} app-glue android log m)
target_link_libraries(${TARGET_NAME} PRIVATE app-glue android log m)
endif()
2 changes: 1 addition & 1 deletion base/gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ static void debugMessageCallback(GLenum source, GLenum type, GLuint id, GLenum s

void gl::setupDebugLogging() {
glDebugMessageCallback(debugMessageCallback, NULL);
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
}
#endif
24 changes: 16 additions & 8 deletions base/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,11 @@ void UIOverlay::update() {
context.trash<vks::Buffer>(vertexBuffer);
vertexBuffer = vks::Buffer();
}
vertexBuffer = context.createBuffer(vk::BufferUsageFlagBits::eVertexBuffer, vk::MemoryPropertyFlagBits::eHostVisible, vertexBufferSize);
vertexBuffer.map();
updateCmdBuffers = true;
if (vertexCount) {
vertexBuffer = context.createBuffer(vk::BufferUsageFlagBits::eVertexBuffer, vk::MemoryPropertyFlagBits::eHostVisible, vertexBufferSize);
vertexBuffer.map();
updateCmdBuffers = true;
}
}

// Index buffer
Expand All @@ -394,9 +396,11 @@ void UIOverlay::update() {
indexBuffer.unmap();
indexBuffer.destroy();
}
indexBuffer = context.createBuffer(vk::BufferUsageFlagBits::eIndexBuffer, vk::MemoryPropertyFlagBits::eHostVisible, indexBufferSize);
indexBuffer.map();
updateCmdBuffers = true;
if (indexCount) {
indexBuffer = context.createBuffer(vk::BufferUsageFlagBits::eIndexBuffer, vk::MemoryPropertyFlagBits::eHostVisible, indexBufferSize);
indexBuffer.map();
updateCmdBuffers = true;
}
}

// Upload data
Expand All @@ -412,8 +416,12 @@ void UIOverlay::update() {
}

// Flush to make writes visible to GPU
vertexBuffer.flush();
indexBuffer.flush();
if (vertexBuffer) {
vertexBuffer.flush();
}
if (indexBuffer) {
indexBuffer.flush();
}

if (updateCmdBuffers) {
updateCommandBuffers();
Expand Down
26 changes: 16 additions & 10 deletions base/vulkanExampleBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,24 @@ ExampleBase::~ExampleBase() {
}

void ExampleBase::run() {
try {
// Android initialization is handled in APP_CMD_INIT_WINDOW event
#if !defined(__ANDROID__)
glfwInit();
setupWindow();
initVulkan();
setupSwapchain();
prepare();
glfwInit();
setupWindow();
initVulkan();
setupSwapchain();
prepare();
#endif

renderLoop();
renderLoop();

// Once we exit the render loop, wait for everything to become idle before proceeding to the descructor.
context.queue.waitIdle();
context.device.waitIdle();
// Once we exit the render loop, wait for everything to become idle before proceeding to the descructor.
context.queue.waitIdle();
context.device.waitIdle();
} catch(const std::system_error& err) {
std::cerr << err.what() << std::endl;
}
}

void ExampleBase::getEnabledFeatures() {
Expand Down Expand Up @@ -258,6 +262,8 @@ void ExampleBase::setupUi() {
overlayCreateInfo.depthformat = depthFormat;
overlayCreateInfo.size = size;

ImGui::SetCurrentContext(ImGui::CreateContext());

// Virtual function call for example to customize overlay creation
OnSetupUIOverlay(overlayCreateInfo);
ui.create(overlayCreateInfo);
Expand Down Expand Up @@ -350,7 +356,7 @@ void ExampleBase::prepareFrame() {
}

void ExampleBase::submitFrame() {
bool submitOverlay = settings.overlay && ui.visible;
bool submitOverlay = settings.overlay && ui.visible && (ui.cmdBuffers.size() > currentBuffer);
if (submitOverlay) {
vk::SubmitInfo submitInfo;
// Wait for color attachment output to finish before rendering the text overlay
Expand Down
100 changes: 0 additions & 100 deletions cmake/externals/LibOVR/CMakeLists.txt

This file was deleted.

16 changes: 0 additions & 16 deletions cmake/externals/LibOVR/LibOVRCMakeLists.txt

This file was deleted.

53 changes: 0 additions & 53 deletions cmake/externals/assimp/CMakeLists.txt

This file was deleted.

37 changes: 0 additions & 37 deletions cmake/externals/glew/CMakeLists.txt

This file was deleted.

30 changes: 0 additions & 30 deletions cmake/externals/glfw3/CMakeLists.txt

This file was deleted.

19 changes: 0 additions & 19 deletions cmake/externals/gli/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit 9f47c0a

Please sign in to comment.