Skip to content

Commit

Permalink
add more helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Nisal Dissanayake committed Jun 16, 2024
1 parent 726a55a commit c0cbede
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
15 changes: 9 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,20 @@ message(STATUS "CMAKE_CXX_COMPILER " + ${CMAKE_CXX_COMPILER})
message(STATUS "CMAKE_CXX_COMPILER_ID " + ${CMAKE_CXX_COMPILER_ID})
message(STATUS "CMAKE_CXX_COMPILER_VERSION " + ${CMAKE_CXX_COMPILER_VERSION})
message(STATUS "CMAKE_CXX_COMPILER_LOADED " + ${CMAKE_CXX_COMPILER_LOADED})
message("-- CMAKE_BUILD_TYPE=" "${CMAKE_BUILD_TYPE}")

if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'Debug' as none was specified.")
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
else()
message("-- CMAKE_BUILD_TYPE=" "${CMAKE_BUILD_TYPE}")
set(CMAKE_BUILD_TYPE "Debug")
endif()

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Setting _DEBUG")
add_compile_definitions(_DEBUG)
endif()



message(STATUS "CMake Source Dir " + ${CMAKE_SOURCE_DIR})
message(STATUS "CMake Binary Dir " + ${CMAKE_BINARY_DIR})

Expand Down Expand Up @@ -125,4 +129,3 @@ endif()


add_subdirectory(WalnutApp)
add_subdirectory(Examples)
21 changes: 13 additions & 8 deletions Walnut/src/Walnut/GraphicsAPI/Vulkan/VulkanGraphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,11 @@ void Vulkan::SubmitResourceFree(std::function<void()> func)
s_ResourceFreeQueue[s_CurrentFrameIndex].emplace_back(func);
}

VkInstance Vulkan::GetInstance()
{
return g_Instance;
}

VkDevice Vulkan::GetDevice()
{
return g_Device;
Expand All @@ -543,15 +548,15 @@ VkPhysicalDevice Vulkan::GetPhysicalDevice()
return g_PhysicalDevice;
}

uint32_t Vulkan::GetQueueFamilyIndex()
{
return g_QueueFamily;
}









VkQueue Vulkan::GetDeviceQueue()
{
return g_Queue;
}

// IMAGE

Expand Down
5 changes: 4 additions & 1 deletion Walnut/src/Walnut/GraphicsAPI/Vulkan/VulkanGraphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ class Vulkan
static void SetClearColor(ImVec4 clear_color);
static void FreeGraphicsResources();
static void SubmitResourceFree(std::function<void()> func);

static VkInstance GetInstance();
static VkDevice GetDevice();
static VkPhysicalDevice GetPhysicalDevice();

static uint32_t GetQueueFamilyIndex();
static VkQueue GetDeviceQueue();
};


Expand Down

0 comments on commit c0cbede

Please sign in to comment.