(CXX_BUILD) Some CXX_BUILD fixes

This commit is contained in:
twinaphex 2022-03-30 15:13:28 +02:00
parent 1df0285091
commit c8d57fe667
3 changed files with 25 additions and 32 deletions

View File

@ -813,23 +813,11 @@ static void vulkan_deinit_framebuffers(vk_t *vk)
#ifdef VULKAN_HDR_SWAPCHAIN
static void vulkan_set_hdr_max_nits(void* data, float max_nits)
{
vk_t *vk = (vk_t*)data;
vk_t *vk = (vk_t*)data;
vulkan_hdr_uniform_t* mapped_ubo = (vulkan_hdr_uniform_t*)vk->hdr.ubo.mapped;
vk->hdr.max_output_nits = max_nits;
mapped_ubo->max_nits = max_nits;
/*
vulkan_set_hdr_metadata(
vk->chain.handle,
vk->hdr.support,
vk->chain.bit_depth,
vk->chain.color_space,
vk->hdr.max_output_nits,
vk->hdr.min_output_nits,
vk->hdr.max_cll,
vk->hdr.max_fall);
*/
vk->hdr.max_output_nits = max_nits;
mapped_ubo->max_nits = max_nits;
}
static void vulkan_set_hdr_paper_white_nits(void* data, float paper_white_nits)
@ -845,7 +833,7 @@ static void vulkan_set_hdr_contrast(void* data, float contrast)
vk_t *vk = (vk_t*)data;
vulkan_hdr_uniform_t* mapped_ubo = (vulkan_hdr_uniform_t*)vk->hdr.ubo.mapped;
mapped_ubo->contrast = contrast;
mapped_ubo->contrast = contrast;
}
static void vulkan_set_hdr_expand_gamut(void* data, bool expand_gamut)
@ -858,16 +846,16 @@ static void vulkan_set_hdr_expand_gamut(void* data, bool expand_gamut)
static void vulkan_set_hdr_inverse_tonemap(vk_t* vk, bool inverse_tonemap)
{
vulkan_hdr_uniform_t* mapped_ubo = (vulkan_hdr_uniform_t*)vk->hdr.ubo.mapped;
vulkan_hdr_uniform_t* mapped_ubo = (vulkan_hdr_uniform_t*)vk->hdr.ubo.mapped;
mapped_ubo->inverse_tonemap = inverse_tonemap ? 1.0f : 0.0f;
mapped_ubo->inverse_tonemap = inverse_tonemap ? 1.0f : 0.0f;
}
static void vulkan_set_hdr10(vk_t* vk, bool hdr10)
{
vulkan_hdr_uniform_t* mapped_ubo = (vulkan_hdr_uniform_t*)vk->hdr.ubo.mapped;
vulkan_hdr_uniform_t* mapped_ubo = (vulkan_hdr_uniform_t*)vk->hdr.ubo.mapped;
mapped_ubo->hdr10 = hdr10 ? 1.0f : 0.0f;
mapped_ubo->hdr10 = hdr10 ? 1.0f : 0.0f;
}
#endif /* VULKAN_HDR_SWAPCHAIN */
@ -909,15 +897,16 @@ static bool vulkan_init_default_filter_chain(vk_t *vk)
if (vk->context->hdr_enable)
{
struct video_shader* shader_preset = vulkan_filter_chain_get_preset(vk->filter_chain);
VkFormat rt_format = vulkan_filter_chain_get_pass_rt_format(vk->filter_chain, shader_preset->passes - 1);
if(shader_preset && shader_preset->passes && (vulkan_filter_chain_get_pass_rt_format(vk->filter_chain, shader_preset->passes - 1) == VK_FORMAT_A2B10G10R10_UNORM_PACK32))
if(shader_preset && shader_preset->passes && (rt_format == VK_FORMAT_A2B10G10R10_UNORM_PACK32))
{
/* If the last shader pass uses a RGB10A2 back buffer and hdr has been enabled assume we want to skip the inverse tonemapper and hdr10 conversion */
vulkan_set_hdr_inverse_tonemap(vk, false);
vulkan_set_hdr10(vk, false);
vk->should_resize = true;
}
else if(shader_preset && shader_preset->passes && (vulkan_filter_chain_get_pass_rt_format(vk->filter_chain, shader_preset->passes - 1) == VK_FORMAT_R16G16B16A16_SFLOAT))
else if(shader_preset && shader_preset->passes && (rt_format == VK_FORMAT_R16G16B16A16_SFLOAT))
{
/* If the last shader pass uses a RGBA16 back buffer and hdr has been enabled assume we want to skip the inverse tonemapper */
vulkan_set_hdr_inverse_tonemap(vk, false);
@ -970,15 +959,16 @@ static bool vulkan_init_filter_chain_preset(vk_t *vk, const char *shader_path)
if (vk->context->hdr_enable)
{
struct video_shader* shader_preset = vulkan_filter_chain_get_preset(vk->filter_chain);
VkFormat rt_format = vulkan_filter_chain_get_pass_rt_format(vk->filter_chain, shader_preset->passes - 1);
if(shader_preset && shader_preset->passes && (vulkan_filter_chain_get_pass_rt_format(vk->filter_chain, shader_preset->passes - 1) == VK_FORMAT_A2B10G10R10_UNORM_PACK32))
if(shader_preset && shader_preset->passes && (rt_format == VK_FORMAT_A2B10G10R10_UNORM_PACK32))
{
/* If the last shader pass uses a RGB10A2 back buffer and hdr has been enabled assume we want to skip the inverse tonemapper and hdr10 conversion */
vulkan_set_hdr_inverse_tonemap(vk, false);
vulkan_set_hdr10(vk, false);
vk->should_resize = true;
}
else if(shader_preset && shader_preset->passes && (vulkan_filter_chain_get_pass_rt_format(vk->filter_chain, shader_preset->passes - 1) == VK_FORMAT_R16G16B16A16_SFLOAT))
else if(shader_preset && shader_preset->passes && (rt_format == VK_FORMAT_R16G16B16A16_SFLOAT))
{
/* If the last shader pass uses a RGBA16 back buffer and hdr has been enabled assume we want to skip the inverse tonemapper */
vulkan_set_hdr_inverse_tonemap(vk, false);
@ -1352,6 +1342,9 @@ static void *vulkan_init(const video_info_t *video,
unsigned temp_height = 0;
const gfx_ctx_driver_t *ctx_driver = NULL;
settings_t *settings = config_get_ptr();
#ifdef VULKAN_HDR_SWAPCHAIN
vulkan_hdr_uniform_t* mapped_ubo = NULL;
#endif
vk_t *vk = (vk_t*)calloc(1, sizeof(*vk));
if (!vk)
return NULL;
@ -1451,9 +1444,9 @@ static void *vulkan_init(const video_info_t *video,
vulkan_set_viewport(vk, temp_width, temp_height, false, true);
#ifdef VULKAN_HDR_SWAPCHAIN
vk->hdr.ubo = vulkan_create_buffer(vk->context, sizeof(vulkan_hdr_uniform_t), VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT);
vk->hdr.ubo = vulkan_create_buffer(vk->context, sizeof(vulkan_hdr_uniform_t), VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT);
vulkan_hdr_uniform_t* mapped_ubo = (vulkan_hdr_uniform_t*)vk->hdr.ubo.mapped;
mapped_ubo = (vulkan_hdr_uniform_t*)vk->hdr.ubo.mapped;
mapped_ubo->mvp = vk->mvp_no_rot;
mapped_ubo->max_nits = settings->floats.video_hdr_max_nits;
@ -2315,7 +2308,7 @@ static bool vulkan_frame(void *data, const void *frame,
vulkan_hdr_uniform_t* mapped_ubo = (vulkan_hdr_uniform_t*)vk->hdr.ubo.mapped;
mapped_ubo->mvp = vk->mvp_no_rot;
mapped_ubo->mvp = vk->mvp_no_rot;
rp_info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
rp_info.pNext = NULL;

View File

@ -162,7 +162,7 @@ joypad_connection_entry_t *find_connection_entry(uint16_t vid, uint16_t pid, con
&& pad_map[i].pid == pid)
{
name_match = has_name
? strstr(pad_map[i].name, name)
? (char*)strstr(pad_map[i].name, name)
: NULL;
if (has_name && strlen(name) < 19)
{

View File

@ -5937,7 +5937,7 @@ static void netplay_refresh_rooms_cb(retro_task_t *task,
unsigned menu_type = 0;
enum msg_hash_enums enum_idx = MSG_UNKNOWN;
net_driver_state_t *net_st = networking_state_get_ptr();
http_transfer_data_t *data = task_data;
http_transfer_data_t *data = (http_transfer_data_t*)task_data;
bool refresh = false;
menu_entries_get_last_stack(&path, &label, &menu_type, &enum_idx, NULL);
@ -5961,7 +5961,7 @@ static void netplay_refresh_rooms_cb(retro_task_t *task,
return;
}
new_data = realloc(data->data, data->len + 1);
new_data = (char*)realloc(data->data, data->len + 1);
if (!new_data)
return;
data->data = new_data;
@ -5980,7 +5980,7 @@ static void netplay_refresh_rooms_cb(retro_task_t *task,
netplay_rooms_parse(data->data);
net_st->room_count = netplay_rooms_get_count();
net_st->room_list = calloc(net_st->room_count,
net_st->room_list = (struct netplay_room*)calloc(net_st->room_count,
sizeof(*net_st->room_list));
for (i = 0; i < net_st->room_count; i++)
@ -6043,7 +6043,7 @@ static void netplay_refresh_lan_cb(retro_task_t *task,
int i;
net_st->room_count = hosts->size;
net_st->room_list = calloc(net_st->room_count,
net_st->room_list = (struct netplay_room*)calloc(net_st->room_count,
sizeof(*net_st->room_list));
for (i = 0; i < net_st->room_count; i++)