Skip to content

Commit cc7c305

Browse files
committed
repo: Clang-format LVL source files using Google
Switch clang-format standard from the LLVM style to the Google style for more consistency. Change-Id: I247c4abc275d7873a91522e1e234198adaa24033
1 parent ead2ba6 commit cc7c305

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+7127
-7659
lines changed

common/android_util.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ char **get_args(struct android_app *app, const char *intent_extra_data_key, cons
3131
std::vector<std::string> args;
3232
JavaVM &vm = *app->activity->vm;
3333
JNIEnv *p_env;
34-
if (vm.AttachCurrentThread(&p_env, nullptr) != JNI_OK)
35-
return nullptr;
34+
if (vm.AttachCurrentThread(&p_env, nullptr) != JNI_OK) return nullptr;
3635

3736
JNIEnv &env = *p_env;
3837
jobject activity = app->activity->clazz;
@@ -60,8 +59,7 @@ char **get_args(struct android_app *app, const char *intent_extra_data_key, cons
6059
std::stringstream ss(args_str);
6160
std::string arg;
6261
while (std::getline(ss, arg, ' ')) {
63-
if (!arg.empty())
64-
args.push_back(arg);
62+
if (!arg.empty()) args.push_back(arg);
6563
}
6664

6765
// Convert our STL results to C friendly constructs
@@ -81,4 +79,4 @@ char **get_args(struct android_app *app, const char *intent_extra_data_key, cons
8179
return vector;
8280
}
8381

84-
} // extern "C"
82+
} // extern "C"

common/vulkan_wrapper.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ extern "C" {
2323

2424
int InitVulkan(void) {
2525
void *libvulkan = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL);
26-
if (!libvulkan)
27-
return 0;
26+
if (!libvulkan) return 0;
2827

2928
// Vulkan supported, set function addresses
3029
vkCreateInstance = reinterpret_cast<PFN_vkCreateInstance>(dlsym(libvulkan, "vkCreateInstance"));

common/vulkan_wrapper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,4 +235,4 @@ extern PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR vkGetPhysicalDeviceWin
235235
}
236236
#endif
237237

238-
#endif // VULKAN_WRAPPER_H
238+
#endif // VULKAN_WRAPPER_H

demos/cube.c

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#ifdef _WIN32
3838
#pragma comment(linker, "/subsystem:windows")
3939
#define APP_NAME_STR_LEN 80
40-
#endif // _WIN32
40+
#endif // _WIN32
4141

4242
#if defined(VK_USE_PLATFORM_MIR_KHR)
4343
#warning "Cube does not have code for Mir at this time"
@@ -75,47 +75,45 @@
7575

7676
#ifdef _WIN32
7777
bool in_callback = false;
78-
#define ERR_EXIT(err_msg, err_class) \
79-
do { \
80-
if (!demo->suppress_popups) \
81-
MessageBox(NULL, err_msg, err_class, MB_OK); \
82-
exit(1); \
78+
#define ERR_EXIT(err_msg, err_class) \
79+
do { \
80+
if (!demo->suppress_popups) MessageBox(NULL, err_msg, err_class, MB_OK); \
81+
exit(1); \
8382
} while (0)
8483

8584
#elif defined __ANDROID__
8685
#include <android/log.h>
87-
#define ERR_EXIT(err_msg, err_class) \
88-
do { \
89-
((void)__android_log_print(ANDROID_LOG_INFO, "Cube", err_msg)); \
90-
exit(1); \
86+
#define ERR_EXIT(err_msg, err_class) \
87+
do { \
88+
((void)__android_log_print(ANDROID_LOG_INFO, "Cube", err_msg)); \
89+
exit(1); \
9190
} while (0)
9291
#else
93-
#define ERR_EXIT(err_msg, err_class) \
94-
do { \
95-
printf(err_msg); \
96-
fflush(stdout); \
97-
exit(1); \
92+
#define ERR_EXIT(err_msg, err_class) \
93+
do { \
94+
printf(err_msg); \
95+
fflush(stdout); \
96+
exit(1); \
9897
} while (0)
9998
#endif
10099

101-
#define GET_INSTANCE_PROC_ADDR(inst, entrypoint) \
102-
{ \
103-
demo->fp##entrypoint = (PFN_vk##entrypoint)vkGetInstanceProcAddr(inst, "vk" #entrypoint); \
104-
if (demo->fp##entrypoint == NULL) { \
105-
ERR_EXIT("vkGetInstanceProcAddr failed to find vk" #entrypoint, "vkGetInstanceProcAddr Failure"); \
106-
} \
100+
#define GET_INSTANCE_PROC_ADDR(inst, entrypoint) \
101+
{ \
102+
demo->fp##entrypoint = (PFN_vk##entrypoint)vkGetInstanceProcAddr(inst, "vk" #entrypoint); \
103+
if (demo->fp##entrypoint == NULL) { \
104+
ERR_EXIT("vkGetInstanceProcAddr failed to find vk" #entrypoint, "vkGetInstanceProcAddr Failure"); \
105+
} \
107106
}
108107

109108
static PFN_vkGetDeviceProcAddr g_gdpa = NULL;
110109

111-
#define GET_DEVICE_PROC_ADDR(dev, entrypoint) \
112-
{ \
113-
if (!g_gdpa) \
114-
g_gdpa = (PFN_vkGetDeviceProcAddr)vkGetInstanceProcAddr(demo->inst, "vkGetDeviceProcAddr"); \
115-
demo->fp##entrypoint = (PFN_vk##entrypoint)g_gdpa(dev, "vk" #entrypoint); \
116-
if (demo->fp##entrypoint == NULL) { \
117-
ERR_EXIT("vkGetDeviceProcAddr failed to find vk" #entrypoint, "vkGetDeviceProcAddr Failure"); \
118-
} \
110+
#define GET_DEVICE_PROC_ADDR(dev, entrypoint) \
111+
{ \
112+
if (!g_gdpa) g_gdpa = (PFN_vkGetDeviceProcAddr)vkGetInstanceProcAddr(demo->inst, "vkGetDeviceProcAddr"); \
113+
demo->fp##entrypoint = (PFN_vk##entrypoint)g_gdpa(dev, "vk" #entrypoint); \
114+
if (demo->fp##entrypoint == NULL) { \
115+
ERR_EXIT("vkGetDeviceProcAddr failed to find vk" #entrypoint, "vkGetDeviceProcAddr Failure"); \
116+
} \
119117
}
120118

121119
/*
@@ -282,10 +280,10 @@ typedef struct {
282280
struct demo {
283281
#if defined(VK_USE_PLATFORM_WIN32_KHR)
284282
#define APP_NAME_STR_LEN 80
285-
HINSTANCE connection; // hInstance - Windows Instance
286-
char name[APP_NAME_STR_LEN]; // Name to put on the window/icon
287-
HWND window; // hWnd - window handle
288-
POINT minsize; // minimum window size
283+
HINSTANCE connection; // hInstance - Windows Instance
284+
char name[APP_NAME_STR_LEN]; // Name to put on the window/icon
285+
HWND window; // hWnd - window handle
286+
POINT minsize; // minimum window size
289287
#elif defined(VK_USE_PLATFORM_XLIB_KHR)
290288
Display *display;
291289
Window xlib_window;
@@ -366,7 +364,7 @@ struct demo {
366364
struct texture_object textures[DEMO_TEXTURE_COUNT];
367365
struct texture_object staging_texture;
368366

369-
VkCommandBuffer cmd; // Buffer for initialization commands
367+
VkCommandBuffer cmd; // Buffer for initialization commands
370368
VkPipelineLayout pipeline_layout;
371369
VkDescriptorSetLayout desc_layout;
372370
VkPipelineCache pipelineCache;
@@ -403,7 +401,6 @@ struct demo {
403401

404402
VKAPI_ATTR VkBool32 VKAPI_CALL dbgFunc(VkFlags msgFlags, VkDebugReportObjectTypeEXT objType, uint64_t srcObject, size_t location,
405403
int32_t msgCode, const char *pLayerPrefix, const char *pMsg, void *pUserData) {
406-
407404
// clang-format off
408405
char *message = (char *)malloc(strlen(pMsg) + 100);
409406

0 commit comments

Comments
 (0)