mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 04:20:27 +00:00
Cleanups - turn some functions static, some variable removals
This commit is contained in:
parent
3c1e64129e
commit
4aa2ac3945
@ -81,13 +81,13 @@ static bool trigger_spurious_error(void)
|
|||||||
|
|
||||||
#ifdef VULKAN_DEBUG
|
#ifdef VULKAN_DEBUG
|
||||||
static VKAPI_ATTR VkBool32 VKAPI_CALL vulkan_debug_cb(
|
static VKAPI_ATTR VkBool32 VKAPI_CALL vulkan_debug_cb(
|
||||||
VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
VkDebugUtilsMessageSeverityFlagBitsEXT msg_severity,
|
||||||
VkDebugUtilsMessageTypeFlagsEXT messageType,
|
VkDebugUtilsMessageTypeFlagsEXT msg_type,
|
||||||
const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData,
|
const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData,
|
||||||
void *pUserData)
|
void *pUserData)
|
||||||
{
|
{
|
||||||
if ( (messageSeverity == VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT)
|
if ( (msg_severity == VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT)
|
||||||
&& (messageType == VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT))
|
&& (msg_type == VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT))
|
||||||
{
|
{
|
||||||
RARCH_ERR("[Vulkan]: Validation Error: %s\n", pCallbackData->pMessage);
|
RARCH_ERR("[Vulkan]: Validation Error: %s\n", pCallbackData->pMessage);
|
||||||
}
|
}
|
||||||
@ -846,14 +846,11 @@ static VkInstance vulkan_context_create_instance_wrapper(void *opaque, const VkI
|
|||||||
VkResult res;
|
VkResult res;
|
||||||
uint32_t i, layer_count;
|
uint32_t i, layer_count;
|
||||||
VkLayerProperties properties[128];
|
VkLayerProperties properties[128];
|
||||||
const char **instance_extensions;
|
gfx_ctx_vulkan_data_t *vk = (gfx_ctx_vulkan_data_t *)opaque;
|
||||||
const char **instance_layers;
|
VkInstanceCreateInfo info = *create_info;
|
||||||
gfx_ctx_vulkan_data_t *vk = (gfx_ctx_vulkan_data_t *)opaque;
|
VkInstance instance = VK_NULL_HANDLE;
|
||||||
VkInstanceCreateInfo info = *create_info;
|
const char **instance_extensions = (const char**)malloc((info.enabledExtensionCount + 3) * sizeof(const char *));
|
||||||
VkInstance instance = VK_NULL_HANDLE;
|
const char **instance_layers = (const char**)malloc((info.enabledLayerCount + 1) * sizeof(const char *));
|
||||||
|
|
||||||
instance_extensions = (const char **)malloc((info.enabledExtensionCount + 3) * sizeof(const char *));
|
|
||||||
instance_layers = (const char **)malloc((info.enabledLayerCount + 1) * sizeof(const char *));
|
|
||||||
|
|
||||||
memcpy((void*)instance_extensions, info.ppEnabledExtensionNames, info.enabledExtensionCount * sizeof(const char *));
|
memcpy((void*)instance_extensions, info.ppEnabledExtensionNames, info.enabledExtensionCount * sizeof(const char *));
|
||||||
memcpy((void*)instance_layers, info.ppEnabledLayerNames, info.enabledLayerCount * sizeof(const char *));
|
memcpy((void*)instance_layers, info.ppEnabledLayerNames, info.enabledLayerCount * sizeof(const char *));
|
||||||
@ -953,7 +950,6 @@ static bool vulkan_update_display_mode(
|
|||||||
{
|
{
|
||||||
unsigned visible_width = mode->parameters.visibleRegion.width;
|
unsigned visible_width = mode->parameters.visibleRegion.width;
|
||||||
unsigned visible_height = mode->parameters.visibleRegion.height;
|
unsigned visible_height = mode->parameters.visibleRegion.height;
|
||||||
unsigned visible_rate = mode->parameters.refreshRate;
|
|
||||||
|
|
||||||
if (!info->width || !info->height)
|
if (!info->width || !info->height)
|
||||||
{
|
{
|
||||||
@ -968,15 +964,16 @@ static bool vulkan_update_display_mode(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
unsigned visible_rate = mode->parameters.refreshRate;
|
||||||
/* For particular resolutions, find the closest. */
|
/* For particular resolutions, find the closest. */
|
||||||
int delta_x = (int)info->width - (int)visible_width;
|
int delta_x = (int)info->width - (int)visible_width;
|
||||||
int delta_y = (int)info->height - (int)visible_height;
|
int delta_y = (int)info->height - (int)visible_height;
|
||||||
int old_delta_x = (int)info->width - (int)*width;
|
int old_delta_x = (int)info->width - (int)*width;
|
||||||
int old_delta_y = (int)info->height - (int)*height;
|
int old_delta_y = (int)info->height - (int)*height;
|
||||||
int delta_rate = abs((int)info->refresh_rate_x1000 - (int)visible_rate);
|
int delta_rate = abs((int)info->refresh_rate_x1000 - (int)visible_rate);
|
||||||
|
|
||||||
int dist = delta_x * delta_x + delta_y * delta_y;
|
int dist = delta_x * delta_x + delta_y * delta_y;
|
||||||
int old_dist = old_delta_x * old_delta_x + old_delta_y * old_delta_y;
|
int old_dist = old_delta_x * old_delta_x + old_delta_y * old_delta_y;
|
||||||
|
|
||||||
if (dist < old_dist && delta_rate < 1000)
|
if (dist < old_dist && delta_rate < 1000)
|
||||||
{
|
{
|
||||||
@ -1482,21 +1479,21 @@ struct vk_descriptor_pool *vulkan_alloc_descriptor_pool(
|
|||||||
VkDescriptorSet vulkan_descriptor_manager_alloc(
|
VkDescriptorSet vulkan_descriptor_manager_alloc(
|
||||||
VkDevice device, struct vk_descriptor_manager *manager)
|
VkDevice device, struct vk_descriptor_manager *manager)
|
||||||
{
|
{
|
||||||
if (manager->count < VULKAN_DESCRIPTOR_MANAGER_BLOCK_SETS)
|
if (manager->count >= VULKAN_DESCRIPTOR_MANAGER_BLOCK_SETS)
|
||||||
return manager->current->sets[manager->count++];
|
|
||||||
|
|
||||||
while (manager->current->next)
|
|
||||||
{
|
{
|
||||||
|
while (manager->current->next)
|
||||||
|
{
|
||||||
|
manager->current = manager->current->next;
|
||||||
|
manager->count = 0;
|
||||||
|
return manager->current->sets[manager->count++];
|
||||||
|
}
|
||||||
|
|
||||||
|
manager->current->next = vulkan_alloc_descriptor_pool(device, manager);
|
||||||
|
retro_assert(manager->current->next);
|
||||||
|
|
||||||
manager->current = manager->current->next;
|
manager->current = manager->current->next;
|
||||||
manager->count = 0;
|
manager->count = 0;
|
||||||
return manager->current->sets[manager->count++];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
manager->current->next = vulkan_alloc_descriptor_pool(device, manager);
|
|
||||||
retro_assert(manager->current->next);
|
|
||||||
|
|
||||||
manager->current = manager->current->next;
|
|
||||||
manager->count = 0;
|
|
||||||
return manager->current->sets[manager->count++];
|
return manager->current->sets[manager->count++];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,7 +502,7 @@ void win32_get_video_size(void *data,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool win32_load_content_from_gui(const char *szFilename)
|
static bool win32_load_content_from_gui(const char *szFilename)
|
||||||
{
|
{
|
||||||
/* poll list of current cores */
|
/* poll list of current cores */
|
||||||
core_info_list_t *core_info_list = NULL;
|
core_info_list_t *core_info_list = NULL;
|
||||||
@ -565,30 +565,37 @@ bool win32_load_content_from_gui(const char *szFilename)
|
|||||||
bool video_is_fs = settings->bools.video_fullscreen;
|
bool video_is_fs = settings->bools.video_fullscreen;
|
||||||
video_driver_state_t *video_st = video_state_get_ptr();
|
video_driver_state_t *video_st = video_state_get_ptr();
|
||||||
|
|
||||||
/* Fullscreen: Show mouse cursor for dialog */
|
if ( video_is_fs
|
||||||
if (video_is_fs)
|
&& video_st->poke
|
||||||
|
&& video_st->poke->show_mouse)
|
||||||
{
|
{
|
||||||
if ( video_st->poke
|
/* Show mouse cursor for dialog */
|
||||||
&& video_st->poke->show_mouse)
|
video_st->poke->show_mouse(video_st->data, true);
|
||||||
video_st->poke->show_mouse(video_st->data, true);
|
|
||||||
|
/* Pick one core that could be compatible, ew */
|
||||||
|
if (DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_PICKCORE),
|
||||||
|
main_window.hwnd, pick_core_proc, (LPARAM)NULL) == IDOK)
|
||||||
|
{
|
||||||
|
task_push_load_content_with_current_core_from_companion_ui(
|
||||||
|
NULL, &content_info, CORE_TYPE_PLAIN, NULL, NULL);
|
||||||
|
okay = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide mouse cursor after dialog */
|
||||||
|
video_st->poke->show_mouse(video_st->data, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Pick one core that could be compatible, ew */
|
||||||
|
if (DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_PICKCORE),
|
||||||
|
main_window.hwnd, pick_core_proc, (LPARAM)NULL) == IDOK)
|
||||||
|
{
|
||||||
|
task_push_load_content_with_current_core_from_companion_ui(
|
||||||
|
NULL, &content_info, CORE_TYPE_PLAIN, NULL, NULL);
|
||||||
|
okay = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pick one core that could be compatible, ew */
|
|
||||||
if (DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_PICKCORE),
|
|
||||||
main_window.hwnd, pick_core_proc, (LPARAM)NULL) == IDOK)
|
|
||||||
{
|
|
||||||
task_push_load_content_with_current_core_from_companion_ui(
|
|
||||||
NULL, &content_info, CORE_TYPE_PLAIN, NULL, NULL);
|
|
||||||
okay = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fullscreen: Hide mouse cursor after dialog */
|
|
||||||
if (video_is_fs)
|
|
||||||
{
|
|
||||||
if ( video_st->poke
|
|
||||||
&& video_st->poke->show_mouse)
|
|
||||||
video_st->poke->show_mouse(video_st->data, false);
|
|
||||||
}
|
|
||||||
return okay;
|
return okay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1543,18 +1550,17 @@ LRESULT CALLBACK wnd_proc_wgl_common(HWND hwnd, UINT message,
|
|||||||
|
|
||||||
static LRESULT wnd_proc_wm_vk_create(HWND hwnd)
|
static LRESULT wnd_proc_wm_vk_create(HWND hwnd)
|
||||||
{
|
{
|
||||||
|
RECT rect;
|
||||||
extern int win32_vk_interval;
|
extern int win32_vk_interval;
|
||||||
extern gfx_ctx_vulkan_data_t win32_vk;
|
extern gfx_ctx_vulkan_data_t win32_vk;
|
||||||
RECT rect;
|
unsigned width = 0;
|
||||||
HINSTANCE instance;
|
unsigned height = 0;
|
||||||
unsigned width = 0;
|
HINSTANCE instance = GetModuleHandle(NULL);
|
||||||
unsigned height = 0;
|
|
||||||
|
|
||||||
GetClientRect(hwnd, &rect);
|
GetClientRect(hwnd, &rect);
|
||||||
|
|
||||||
instance = GetModuleHandle(NULL);
|
width = rect.right - rect.left;
|
||||||
width = rect.right - rect.left;
|
height = rect.bottom - rect.top;
|
||||||
height = rect.bottom - rect.top;
|
|
||||||
|
|
||||||
if (!vulkan_surface_create(&win32_vk,
|
if (!vulkan_surface_create(&win32_vk,
|
||||||
VULKAN_WSI_WIN32,
|
VULKAN_WSI_WIN32,
|
||||||
@ -1568,7 +1574,6 @@ static LRESULT wnd_proc_wm_vk_create(HWND hwnd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DINPUT
|
#ifdef HAVE_DINPUT
|
||||||
|
|
||||||
LRESULT CALLBACK wnd_proc_vk_dinput(HWND hwnd, UINT message,
|
LRESULT CALLBACK wnd_proc_vk_dinput(HWND hwnd, UINT message,
|
||||||
WPARAM wparam, LPARAM lparam)
|
WPARAM wparam, LPARAM lparam)
|
||||||
{
|
{
|
||||||
@ -2023,7 +2028,7 @@ static unsigned int menu_id_to_meta_key(unsigned int menu_id)
|
|||||||
/* Given a short key (meta key), get its name as a string */
|
/* Given a short key (meta key), get its name as a string */
|
||||||
/* For single character results, may return same pointer
|
/* For single character results, may return same pointer
|
||||||
* with different data inside (modifying the old result) */
|
* with different data inside (modifying the old result) */
|
||||||
static const char *meta_key_to_name(unsigned int meta_key)
|
static const char *win32_meta_key_to_name(unsigned int meta_key)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
const struct retro_keybind* key = &input_config_binds[0][meta_key];
|
const struct retro_keybind* key = &input_config_binds[0][meta_key];
|
||||||
@ -2061,7 +2066,6 @@ static void win32_localize_menu(HMENU menu)
|
|||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
BOOL okay;
|
|
||||||
enum msg_hash_enums label_enum;
|
enum msg_hash_enums label_enum;
|
||||||
memset(&menu_item_info, 0, sizeof(menu_item_info));
|
memset(&menu_item_info, 0, sizeof(menu_item_info));
|
||||||
menu_item_info.cbSize = sizeof(menu_item_info);
|
menu_item_info.cbSize = sizeof(menu_item_info);
|
||||||
@ -2073,12 +2077,12 @@ static void win32_localize_menu(HMENU menu)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef LEGACY_WIN32
|
#ifndef LEGACY_WIN32
|
||||||
okay = GetMenuItemInfoW(menu, index, true, &menu_item_info);
|
if (!GetMenuItemInfoW(menu, index, true, &menu_item_info))
|
||||||
#else
|
|
||||||
okay = GetMenuItemInfoA(menu, index, true, &menu_item_info);
|
|
||||||
#endif
|
|
||||||
if (!okay)
|
|
||||||
break;
|
break;
|
||||||
|
#else
|
||||||
|
if (!GetMenuItemInfoA(menu, index, true, &menu_item_info))
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Recursion - call this on submenu items too */
|
/* Recursion - call this on submenu items too */
|
||||||
if (menu_item_info.hSubMenu)
|
if (menu_item_info.hSubMenu)
|
||||||
@ -2117,7 +2121,7 @@ static void win32_localize_menu(HMENU menu)
|
|||||||
}
|
}
|
||||||
else if (meta_key != 0)
|
else if (meta_key != 0)
|
||||||
{
|
{
|
||||||
meta_key_name = meta_key_to_name(meta_key);
|
meta_key_name = win32_meta_key_to_name(meta_key);
|
||||||
len2 = strlen(meta_key_name);
|
len2 = strlen(meta_key_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,8 +185,6 @@ LRESULT CALLBACK wnd_proc_gdi_common(HWND hwnd, UINT message,
|
|||||||
BOOL IsIconic(HWND hwnd);
|
BOOL IsIconic(HWND hwnd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool win32_load_content_from_gui(const char *szFilename);
|
|
||||||
|
|
||||||
void win32_setup_pixel_format(HDC hdc, bool supports_gl);
|
void win32_setup_pixel_format(HDC hdc, bool supports_gl);
|
||||||
|
|
||||||
void win32_update_title(void);
|
void win32_update_title(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user