#include "vk_layer_extension_utils.h"
#include "vk_layer_utils.h"
-typedef struct _layer_data {
+struct layer_data {
debug_report_data *report_data;
// TODO: put instance data here
VkDbgMsgCallback logging_callback;
-} layer_data;
+
+ layer_data() :
+ report_data(nullptr),
+ logging_callback(nullptr)
+ {};
+};
static std::unordered_map<void *, layer_data *> layer_data_map;
static device_table_map device_limits_device_table_map;
#include "vk_layer_logging.h"
#include "vk_layer_extension_utils.h"
-typedef struct _layer_data {
+struct layer_data {
debug_report_data *report_data;
// TODO: put instance data here
VkDbgMsgCallback logging_callback;
-} layer_data;
+
+ layer_data() :
+ report_data(nullptr),
+ logging_callback(nullptr)
+ {};
+};
static std::unordered_map<void *, layer_data *> layer_data_map;
static device_table_map draw_state_device_table_map;
using namespace std;
-typedef struct _layer_data {
+struct layer_data {
debug_report_data *report_data;
VkDbgMsgCallback logging_callback;
VkPhysicalDevice physicalDevice;
unordered_map<uint64_t, unique_ptr<IMAGE_STATE>> imageMap;
-} layer_data;
+
+ layer_data() :
+ report_data(nullptr),
+ logging_callback(nullptr),
+ physicalDevice(0)
+ {};
+};
static unordered_map<void*, layer_data*> layer_data_map;
static device_table_map image_device_table_map;
// Object value will be used to identify them internally.
static const VkDeviceMemory MEMTRACKER_SWAP_CHAIN_IMAGE_KEY = static_cast<VkDeviceMemory>(-1);
-typedef struct _layer_data {
+struct layer_data {
debug_report_data *report_data;
// TODO: put instance data here
VkDbgMsgCallback logging_callback;
bool wsi_enabled;
-} layer_data;
+
+ layer_data() :
+ report_data(nullptr),
+ logging_callback(nullptr),
+ wsi_enabled(false)
+ {};
+};
static unordered_map<void *, layer_data *> layer_data_map;
typedef uint64_t (*OBJ_TRACK_GET_OBJECT_COUNT)(VkDevice);
typedef uint64_t (*OBJ_TRACK_GET_OBJECTS_OF_TYPE_COUNT)(VkDevice, VkDbgObjectType);
-typedef struct _layer_data {
+struct layer_data {
debug_report_data *report_data;
//TODO: put instance data here
VkDbgMsgCallback logging_callback;
bool wsi_enabled;
bool objtrack_extensions_enabled;
-} layer_data;
+
+ layer_data() :
+ report_data(nullptr),
+ logging_callback(nullptr),
+ wsi_enabled(false),
+ objtrack_extensions_enabled(false)
+ {};
+};
struct instExts {
bool wsi_enabled;
#include "vk_layer_logging.h"
#include "vk_layer_extension_utils.h"
-typedef struct _layer_data {
+struct layer_data {
debug_report_data *report_data;
VkDbgMsgCallback logging_callback;
-} layer_data;
+
+ layer_data() :
+ report_data(nullptr),
+ logging_callback(nullptr)
+ {};
+};
static std::unordered_map<void*, layer_data*> layer_data_map;
static device_table_map pc_device_table_map;
#include "spirv/spirv.hpp"
-typedef struct _layer_data {
+struct layer_data {
debug_report_data *report_data;
// TODO: put instance data here
VkDbgMsgCallback logging_callback;
-} layer_data;
+
+ layer_data() :
+ report_data(nullptr),
+ logging_callback(nullptr)
+ {};
+};
static std::unordered_map<void *, layer_data *> layer_data_map;
static device_table_map shader_checker_device_table_map;
// Turn on logging, since it was requested:
option_str = getLayerOption("SwapchainLogFilename");
log_output = getLayerLogOutput(option_str, "Swapchain");
- layer_create_msg_callback(&mydata.report_data, report_flags,
+ layer_create_msg_callback(mydata.report_data, report_flags,
log_callback, (void *) log_output,
&mydata.logging_callback);
}
if (deviceMap[device].pPresentModes) {
free(deviceMap[device].pPresentModes);
}
- deviceMap.erase(device);
if (!pDevice->swapchains.empty()) {
LOG_ERROR(VK_OBJECT_TYPE_DEVICE, device, "VkDevice",
SWAPCHAIN_DEL_DEVICE_BEFORE_SWAPCHAINS,
}
pDevice->swapchains.clear();
}
+ deviceMap.erase(device);
}
}
}
}
// Log the message that we've built up:
- skipCall |= debug_report_log_msg(&mydata.report_data,
+ skipCall |= debug_report_log_msg(mydata.report_data,
VK_DBG_REPORT_ERROR_BIT,
VK_OBJECT_TYPE_DEVICE,
(uint64_t) device, 0,
VK_LAYER_EXPORT VkResult VKAPI vkDbgCreateMsgCallback(VkInstance instance, VkFlags msgFlags, const PFN_vkDbgMsgCallback pfnMsgCallback, void* pUserData, VkDbgMsgCallback* pMsgCallback)
{
- return layer_create_msg_callback(&mydata.report_data, msgFlags, pfnMsgCallback, pUserData, pMsgCallback);
+ return layer_create_msg_callback(mydata.report_data, msgFlags, pfnMsgCallback, pUserData, pMsgCallback);
}
VK_LAYER_EXPORT VkResult VKAPI vkDbgDestroyMsgCallback(VkInstance instance, VkDbgMsgCallback msgCallback)
{
- layer_destroy_msg_callback(&mydata.report_data, msgCallback);
+ layer_destroy_msg_callback(mydata.report_data, msgCallback);
return VK_SUCCESS;
}
// The following is for logging error messages:
-typedef struct _layer_data {
- debug_report_data report_data;
+struct layer_data {
+ debug_report_data *report_data;
VkDbgMsgCallback logging_callback;
-} layer_data;
+
+ layer_data() :
+ report_data(nullptr),
+ logging_callback(nullptr)
+ {};
+};
+
#define LAYER_NAME (char *) "Swapchain"
#define LOG_ERROR_NON_VALID_OBJ(objType, type, obj) \
- log_msg(&mydata.report_data, VK_DBG_REPORT_ERROR_BIT, (objType), \
+ log_msg(mydata.report_data, VK_DBG_REPORT_ERROR_BIT, (objType), \
(uint64_t) (obj), 0, SWAPCHAIN_INVALID_HANDLE, LAYER_NAME, \
"%s() called with a non-valid %s.", __FUNCTION__, (obj))
#define LOG_ERROR(objType, type, obj, enm, fmt, ...) \
- log_msg(&mydata.report_data, VK_DBG_REPORT_ERROR_BIT, (objType), \
+ log_msg(mydata.report_data, VK_DBG_REPORT_ERROR_BIT, (objType), \
(uint64_t) (obj), 0, (enm), LAYER_NAME, (fmt), __VA_ARGS__)
#define LOG_PERF_WARNING(objType, type, obj, enm, fmt, ...) \
- log_msg(&mydata.report_data, VK_DBG_REPORT_PERF_WARN_BIT, (objType), \
+ log_msg(mydata.report_data, VK_DBG_REPORT_PERF_WARN_BIT, (objType), \
(uint64_t) (obj), 0, (enm), LAYER_NAME, (fmt), __VA_ARGS__)
THREADING_CHECKER_SINGLE_THREAD_REUSE, // Object used simultaneously by recursion in single thread
} THREADING_CHECKER_ERROR;
-typedef struct _layer_data {
+struct layer_data {
debug_report_data *report_data;
VkDbgMsgCallback logging_callback;
-} layer_data;
+
+ layer_data() :
+ report_data(nullptr),
+ logging_callback(nullptr)
+ {};
+};
static std::unordered_map<void*, layer_data *> layer_data_map;
static device_table_map Threading_device_table_map;