mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-05 12:20:07 +00:00
Added source files to project: Common.*, Tests.*, VmaUsage.*.
This commit is contained in:
parent
ba335cf8c0
commit
f1a793cadd
5
src/Common.cpp
Normal file
5
src/Common.cpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#include "Common.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
#endif // #ifdef _WIN32
|
29
src/Common.h
Normal file
29
src/Common.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#ifndef COMMON_H_
|
||||||
|
#define COMMON_H_
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
#define MATHFU_COMPILE_WITHOUT_SIMD_SUPPORT
|
||||||
|
#include <mathfu/glsl_mappings.h>
|
||||||
|
#include <mathfu/constants.h>
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <memory>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <numeric>
|
||||||
|
#include <array>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
#define ERR_GUARD_VULKAN(Expr) do { VkResult res__ = (Expr); if (res__ < 0) assert(0); } while(0)
|
||||||
|
|
||||||
|
#endif // #ifdef _WIN32
|
||||||
|
|
||||||
|
#endif
|
7
src/Tests.cpp
Normal file
7
src/Tests.cpp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include "Tests.h"
|
||||||
|
#include "VmaUsage.h"
|
||||||
|
#include "Common.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
#endif // #ifdef _WIN32
|
9
src/Tests.h
Normal file
9
src/Tests.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#ifndef TESTS_H_
|
||||||
|
#define TESTS_H_
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
|
||||||
|
#endif // #ifdef _WIN32
|
||||||
|
|
||||||
|
#endif
|
8
src/VmaUsage.cpp
Normal file
8
src/VmaUsage.cpp
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/*
|
||||||
|
In exactly one CPP file define macro VMA_IMPLEMENTATION and then include
|
||||||
|
vk_mem_alloc.h to include definitions of its internal implementation
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define VMA_IMPLEMENTATION
|
||||||
|
|
||||||
|
#include "VmaUsage.h"
|
39
src/VmaUsage.h
Normal file
39
src/VmaUsage.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#ifndef VMA_USAGE_H_
|
||||||
|
#define VMA_USAGE_H_
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
#define NOMINMAX
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <Windows.h>
|
||||||
|
#define VK_USE_PLATFORM_WIN32_KHR
|
||||||
|
|
||||||
|
#include <vulkan/vulkan.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
In every place where you want to use Vulkan Memory Allocator, define appropriate
|
||||||
|
macros if you want to configure the library and then include its header to
|
||||||
|
include all public interface declarations. Example:
|
||||||
|
*/
|
||||||
|
|
||||||
|
//#define VMA_USE_STL_CONTAINERS 1
|
||||||
|
|
||||||
|
//#define VMA_HEAVY_ASSERT(expr)
|
||||||
|
|
||||||
|
#pragma warning(push, 4)
|
||||||
|
#pragma warning(disable: 4127) // conditional expression is constant
|
||||||
|
#pragma warning(disable: 4100) // unreferenced formal parameter
|
||||||
|
#pragma warning(disable: 4189) // local variable is initialized but not referenced
|
||||||
|
|
||||||
|
#include "vk_mem_alloc.h"
|
||||||
|
|
||||||
|
#pragma warning(pop)
|
||||||
|
|
||||||
|
#else // #ifdef _WIN32
|
||||||
|
|
||||||
|
#include <vulkan/vulkan.h>
|
||||||
|
#include "vk_mem_alloc.h"
|
||||||
|
|
||||||
|
#endif // #ifdef _WIN32
|
||||||
|
|
||||||
|
#endif
|
@ -20,50 +20,18 @@
|
|||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#define NOMINMAX
|
#include "Tests.h"
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#include "VmaUsage.h"
|
||||||
#include <Windows.h>
|
#include "Common.h"
|
||||||
|
|
||||||
#define VK_USE_PLATFORM_WIN32_KHR
|
|
||||||
#include <vulkan/vulkan.h>
|
|
||||||
|
|
||||||
#pragma warning(push, 4)
|
|
||||||
#pragma warning(disable: 4127) // warning C4127: conditional expression is constant
|
|
||||||
#pragma warning(disable: 4100) // warning C4100: '...': unreferenced formal parameter
|
|
||||||
#pragma warning(disable: 4189) // warning C4189: '...': local variable is initialized but not referenced
|
|
||||||
#define VMA_IMPLEMENTATION
|
|
||||||
#include "vk_mem_alloc.h"
|
|
||||||
#pragma warning(pop)
|
|
||||||
|
|
||||||
#define MATHFU_COMPILE_WITHOUT_SIMD_SUPPORT
|
|
||||||
#include <mathfu/glsl_mappings.h>
|
|
||||||
#include <mathfu/constants.h>
|
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
#include <memory>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <numeric>
|
|
||||||
#include <array>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
#include <cassert>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
#define ERR_GUARD_VULKAN(Expr) do { VkResult res__ = (Expr); if (res__ < 0) assert(0); } while(0)
|
|
||||||
|
|
||||||
static const char* const SHADER_PATH1 = "./";
|
static const char* const SHADER_PATH1 = "./";
|
||||||
static const char* const SHADER_PATH2 = "../bin/";
|
static const char* const SHADER_PATH2 = "../bin/";
|
||||||
static const wchar_t* const WINDOW_CLASS_NAME = L"VULKAN_MEMORY_ALLOCATOR_SAMPLE";
|
static const wchar_t* const WINDOW_CLASS_NAME = L"VULKAN_MEMORY_ALLOCATOR_SAMPLE";
|
||||||
static const char* const VALIDATION_LAYER_NAME = "VK_LAYER_LUNARG_standard_validation";
|
static const char* const VALIDATION_LAYER_NAME = "VK_LAYER_LUNARG_standard_validation";
|
||||||
static const char* const APP_TITLE_A = "Vulkan Memory Allocator Sample 1.0";
|
static const char* const APP_TITLE_A = "Vulkan Memory Allocator Sample 2.0";
|
||||||
static const wchar_t* const APP_TITLE_W = L"Vulkan Memory Allocator Sample 1.0";
|
static const wchar_t* const APP_TITLE_W = L"Vulkan Memory Allocator Sample 2.0";
|
||||||
|
|
||||||
static const bool VSYNC = true;
|
static const bool VSYNC = true;
|
||||||
static const uint32_t COMMAND_BUFFER_COUNT = 2;
|
static const uint32_t COMMAND_BUFFER_COUNT = 2;
|
||||||
@ -1689,14 +1657,12 @@ int main()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // #ifdef WIN32
|
#else // #ifdef _WIN32
|
||||||
|
|
||||||
#define VMA_IMPLEMENTATION
|
#include "VmaUsage.h"
|
||||||
#include "vk_mem_alloc.h"
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // #ifdef WIN32
|
#endif // #ifdef _WIN32
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user