mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
Explicit typecasts to bools for flags
This commit is contained in:
parent
f51b49f213
commit
0a96f9595c
@ -835,7 +835,7 @@ void audio_driver_sample(int16_t left, int16_t right)
|
||||
recording_st->driver->push_audio(recording_st->data, &ffemu_data);
|
||||
}
|
||||
|
||||
if (!( (runloop_flags & RUNLOOP_FLAG_PAUSED)
|
||||
if (!( (runloop_flags & RUNLOOP_FLAG_PAUSED)
|
||||
|| !(audio_st->flags & AUDIO_FLAG_ACTIVE)
|
||||
|| !(audio_st->output_samples_buf)))
|
||||
audio_driver_flush(audio_st,
|
||||
@ -843,8 +843,8 @@ void audio_driver_sample(int16_t left, int16_t right)
|
||||
config_get_ptr()->bools.audio_fastforward_mute,
|
||||
audio_st->output_samples_conv_buf,
|
||||
audio_st->data_ptr,
|
||||
runloop_flags & RUNLOOP_FLAG_SLOWMOTION,
|
||||
runloop_flags & RUNLOOP_FLAG_FASTMOTION);
|
||||
(runloop_flags & RUNLOOP_FLAG_SLOWMOTION) ? true : false,
|
||||
(runloop_flags & RUNLOOP_FLAG_FASTMOTION) ? true : false);
|
||||
|
||||
audio_st->data_ptr = 0;
|
||||
}
|
||||
@ -893,8 +893,8 @@ size_t audio_driver_sample_batch(const int16_t *data, size_t frames)
|
||||
config_get_ptr()->bools.audio_fastforward_mute,
|
||||
data,
|
||||
frames_to_write << 1,
|
||||
runloop_flags & RUNLOOP_FLAG_SLOWMOTION,
|
||||
runloop_flags & RUNLOOP_FLAG_FASTMOTION);
|
||||
(runloop_flags & RUNLOOP_FLAG_SLOWMOTION) ? true : false,
|
||||
(runloop_flags & RUNLOOP_FLAG_FASTMOTION) ? true : false);
|
||||
|
||||
frames_remaining -= frames_to_write;
|
||||
data += frames_to_write << 1;
|
||||
@ -1622,7 +1622,7 @@ bool audio_driver_callback(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
uint32_t runloop_flags = runloop_get_flags();
|
||||
bool runloop_paused = runloop_flags & RUNLOOP_FLAG_PAUSED;
|
||||
bool runloop_paused = (runloop_flags & RUNLOOP_FLAG_PAUSED) ? true : false;
|
||||
#ifdef HAVE_MENU
|
||||
#ifdef HAVE_NETWORKING
|
||||
bool core_paused = runloop_paused
|
||||
@ -1743,8 +1743,8 @@ void audio_driver_frame_is_reverse(void)
|
||||
audio_st->rewind_ptr,
|
||||
audio_st->rewind_size -
|
||||
audio_st->rewind_ptr,
|
||||
runloop_flags & RUNLOOP_FLAG_SLOWMOTION,
|
||||
runloop_flags & RUNLOOP_FLAG_FASTMOTION);
|
||||
(runloop_flags & RUNLOOP_FLAG_SLOWMOTION) ? true : false,
|
||||
(runloop_flags & RUNLOOP_FLAG_FASTMOTION) ? true : false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1908,8 +1908,8 @@ void audio_driver_menu_sample(void)
|
||||
settings->bools.audio_fastforward_mute,
|
||||
samples_buf,
|
||||
1024,
|
||||
runloop_flags & RUNLOOP_FLAG_SLOWMOTION,
|
||||
runloop_flags & RUNLOOP_FLAG_FASTMOTION);
|
||||
(runloop_flags & RUNLOOP_FLAG_SLOWMOTION) ? true : false,
|
||||
(runloop_flags & RUNLOOP_FLAG_FASTMOTION) ? true : false);
|
||||
sample_count -= 1024;
|
||||
}
|
||||
if ( recording_st->data &&
|
||||
@ -1930,7 +1930,7 @@ void audio_driver_menu_sample(void)
|
||||
settings->bools.audio_fastforward_mute,
|
||||
samples_buf,
|
||||
sample_count,
|
||||
runloop_flags & RUNLOOP_FLAG_SLOWMOTION,
|
||||
runloop_flags & RUNLOOP_FLAG_FASTMOTION);
|
||||
(runloop_flags & RUNLOOP_FLAG_SLOWMOTION) ? true : false,
|
||||
(runloop_flags & RUNLOOP_FLAG_FASTMOTION) ? true : false);
|
||||
}
|
||||
#endif
|
||||
|
@ -123,7 +123,7 @@ d3d10_get_closest_match(D3D10Device device,
|
||||
UINT format_support;
|
||||
if (SUCCEEDED(device->lpVtbl->CheckFormatSupport(device, *format,
|
||||
&format_support))
|
||||
&& ((format_support & desired_format_support) ==
|
||||
&& ((format_support & desired_format_support) ==
|
||||
desired_format_support))
|
||||
break;
|
||||
format++;
|
||||
@ -133,9 +133,9 @@ d3d10_get_closest_match(D3D10Device device,
|
||||
|
||||
static void d3d10_init_texture(D3D10Device device, d3d10_texture_t* texture)
|
||||
{
|
||||
bool is_render_target = texture->desc.BindFlags
|
||||
bool is_render_target = texture->desc.BindFlags
|
||||
& D3D10_BIND_RENDER_TARGET;
|
||||
UINT format_support = D3D10_FORMAT_SUPPORT_TEXTURE2D
|
||||
UINT format_support = D3D10_FORMAT_SUPPORT_TEXTURE2D
|
||||
| D3D10_FORMAT_SUPPORT_SHADER_SAMPLE;
|
||||
|
||||
texture->desc.MipLevels = 1;
|
||||
@ -144,8 +144,8 @@ static void d3d10_init_texture(D3D10Device device, d3d10_texture_t* texture)
|
||||
texture->desc.SampleDesc.Quality = 0;
|
||||
texture->desc.BindFlags |= D3D10_BIND_SHADER_RESOURCE;
|
||||
texture->desc.CPUAccessFlags =
|
||||
texture->desc.Usage == D3D10_USAGE_DYNAMIC
|
||||
? D3D10_CPU_ACCESS_WRITE
|
||||
texture->desc.Usage == D3D10_USAGE_DYNAMIC
|
||||
? D3D10_CPU_ACCESS_WRITE
|
||||
: 0;
|
||||
|
||||
if (texture->desc.MiscFlags & D3D10_RESOURCE_MISC_GENERATE_MIPS)
|
||||
@ -388,7 +388,7 @@ static void gfx_display_d3d10_draw(gfx_display_ctx_draw_t *draw,
|
||||
{
|
||||
sprite->pos.x = draw->x / (float)d3d10->viewport.Width;
|
||||
sprite->pos.y =
|
||||
(d3d10->viewport.Height - draw->y - draw->height)
|
||||
(d3d10->viewport.Height - draw->y - draw->height)
|
||||
/ (float)d3d10->viewport.Height;
|
||||
sprite->pos.w = draw->width / (float)d3d10->viewport.Width;
|
||||
sprite->pos.h = draw->height / (float)d3d10->viewport.Height;
|
||||
@ -797,7 +797,7 @@ static void d3d10_font_render_message(
|
||||
float line_height;
|
||||
struct font_line_metrics *line_metrics = NULL;
|
||||
int lines = 0;
|
||||
const struct font_glyph* glyph_q =
|
||||
const struct font_glyph* glyph_q =
|
||||
font->font_driver->get_glyph(font->font_data, '?');
|
||||
int x = roundf(pos_x * width);
|
||||
font->font_driver->get_line_metrics(font->font_data, &line_metrics);
|
||||
@ -1200,7 +1200,7 @@ static void d3d10_gfx_set_rotation(void* data, unsigned rotation)
|
||||
static void d3d10_update_viewport(d3d10_video_t *d3d10, bool force_full)
|
||||
{
|
||||
video_driver_update_viewport(&d3d10->vp, force_full,
|
||||
d3d10->flags & D3D10_ST_FLAG_KEEP_ASPECT);
|
||||
(d3d10->flags & D3D10_ST_FLAG_KEEP_ASPECT) ? true : false);
|
||||
|
||||
d3d10->frame.viewport.TopLeftX = d3d10->vp.x;
|
||||
d3d10->frame.viewport.TopLeftY = d3d10->vp.y;
|
||||
@ -1209,8 +1209,8 @@ static void d3d10_update_viewport(d3d10_video_t *d3d10, bool force_full)
|
||||
d3d10->frame.viewport.MaxDepth = 0.0f;
|
||||
d3d10->frame.viewport.MaxDepth = 1.0f;
|
||||
|
||||
if (d3d10->shader_preset && (d3d10->frame.output_size.x != d3d10->vp.width ||
|
||||
d3d10->frame.output_size.y != d3d10->vp.height))
|
||||
if (d3d10->shader_preset && (d3d10->frame.output_size.x != d3d10->vp.width
|
||||
|| d3d10->frame.output_size.y != d3d10->vp.height))
|
||||
d3d10->flags |= D3D10_ST_FLAG_RESIZE_RTS;
|
||||
|
||||
d3d10->frame.output_size.x = d3d10->vp.width;
|
||||
@ -1936,7 +1936,7 @@ static void *d3d10_gfx_init(const video_info_t* video,
|
||||
{
|
||||
d3d10_fake_context.get_flags = d3d10_get_flags;
|
||||
d3d10_fake_context.get_metrics = win32_get_metrics;
|
||||
video_context_driver_set(&d3d10_fake_context);
|
||||
video_context_driver_set(&d3d10_fake_context);
|
||||
#ifdef HAVE_SLANG
|
||||
const char *shader_preset = video_shader_get_current_shader_preset();
|
||||
enum rarch_shader_type type = video_shader_parse_type(shader_preset);
|
||||
@ -1963,7 +1963,7 @@ static void *d3d10_gfx_init(const video_info_t* video,
|
||||
#else
|
||||
DXGICreateFactory1(&d3d10->factory);
|
||||
#endif
|
||||
|
||||
|
||||
{
|
||||
int i = 0;
|
||||
int gpu_index = settings->ints.d3d10_gpu_index;
|
||||
@ -2059,7 +2059,6 @@ static void d3d10_init_render_targets(d3d10_video_t* d3d10,
|
||||
|
||||
if (pass->fbo.flags & FBO_SCALE_FLAG_VALID)
|
||||
{
|
||||
|
||||
switch (pass->fbo.type_x)
|
||||
{
|
||||
case RARCH_SCALE_INPUT:
|
||||
@ -2110,7 +2109,7 @@ static void d3d10_init_render_targets(d3d10_video_t* d3d10,
|
||||
|
||||
RARCH_LOG("[D3D10]: Updating framebuffer size %ux%u.\n", width, height);
|
||||
|
||||
if ( (i != (d3d10->shader_preset->passes - 1))
|
||||
if ( (i != (d3d10->shader_preset->passes - 1))
|
||||
|| (width != d3d10->vp.width)
|
||||
|| (height != d3d10->vp.height))
|
||||
{
|
||||
@ -2163,7 +2162,7 @@ static bool d3d10_gfx_frame(
|
||||
unsigned video_width = video_info->width;
|
||||
unsigned video_height = video_info->height;
|
||||
bool statistics_show = video_info->statistics_show;
|
||||
struct font_params
|
||||
struct font_params
|
||||
*osd_params = (struct font_params*)
|
||||
&video_info->osd_stat_params;
|
||||
const char *stat_text = video_info->stat_text;
|
||||
@ -2200,7 +2199,7 @@ static bool d3d10_gfx_frame(
|
||||
video_driver_set_size(video_width, video_height);
|
||||
}
|
||||
|
||||
#if 0
|
||||
#if 0
|
||||
/* custom viewport doesn't call apply_state_changes,
|
||||
so we can't rely on this for now */
|
||||
if (d3d10->resize_viewport)
|
||||
@ -2230,7 +2229,7 @@ static bool d3d10_gfx_frame(
|
||||
if (d3d10->flags & D3D10_ST_FLAG_RESIZE_RTS)
|
||||
{
|
||||
int i;
|
||||
/* Release all render targets first to avoid
|
||||
/* Release all render targets first to avoid
|
||||
* memory fragmentation */
|
||||
for (i = 0; i < (int) d3d10->shader_preset->passes; i++)
|
||||
{
|
||||
@ -2258,7 +2257,7 @@ static bool d3d10_gfx_frame(
|
||||
}
|
||||
}
|
||||
|
||||
/* either no history, or we moved a texture of
|
||||
/* either no history, or we moved a texture of
|
||||
* a different size in the front slot */
|
||||
if ( (d3d10->frame.texture[0].desc.Width != width)
|
||||
|| (d3d10->frame.texture[0].desc.Height != height))
|
||||
@ -2314,7 +2313,7 @@ static bool d3d10_gfx_frame(
|
||||
d3d10->pass[i].frame_count = frame_count;
|
||||
|
||||
#ifdef HAVE_REWIND
|
||||
d3d10->pass[i].frame_direction = state_manager_frame_is_reversed()
|
||||
d3d10->pass[i].frame_direction = state_manager_frame_is_reversed()
|
||||
? -1 : 1;
|
||||
#else
|
||||
d3d10->pass[i].frame_direction = 1;
|
||||
@ -2441,7 +2440,7 @@ static bool d3d10_gfx_frame(
|
||||
context->lpVtbl->OMSetBlendState(context, d3d10->blend_enable, NULL,
|
||||
D3D10_DEFAULT_SAMPLE_MASK);
|
||||
|
||||
if ( (d3d10->flags & D3D10_ST_FLAG_MENU_ENABLE)
|
||||
if ( (d3d10->flags & D3D10_ST_FLAG_MENU_ENABLE)
|
||||
&& d3d10->menu.texture.handle)
|
||||
{
|
||||
UINT offset = 0, stride = sizeof(d3d10_vertex_t);
|
||||
@ -2478,8 +2477,8 @@ static bool d3d10_gfx_frame(
|
||||
if (d3d10->flags & D3D10_ST_FLAG_MENU_ENABLE)
|
||||
#endif
|
||||
{
|
||||
UINT offset = 0, stride = 0;
|
||||
stride = sizeof(d3d10_sprite_t);
|
||||
UINT offset = 0;
|
||||
UINT stride = sizeof(d3d10_sprite_t);
|
||||
context->lpVtbl->RSSetViewports(context, 1, &d3d10->viewport);
|
||||
context->lpVtbl->IASetVertexBuffers(
|
||||
context, 0, 1, (D3D10Buffer* const)&d3d10->sprites.vbo,
|
||||
@ -2734,7 +2733,7 @@ static uintptr_t d3d10_gfx_load_texture(
|
||||
|
||||
return (uintptr_t)texture;
|
||||
}
|
||||
static void d3d10_gfx_unload_texture(void* data,
|
||||
static void d3d10_gfx_unload_texture(void* data,
|
||||
bool threaded, uintptr_t handle)
|
||||
{
|
||||
d3d10_texture_t* texture = (d3d10_texture_t*)handle;
|
||||
|
@ -309,7 +309,7 @@ static void d3d11_update_texture(
|
||||
}
|
||||
|
||||
/*
|
||||
* DISPLAY DRIVER
|
||||
* DISPLAY DRIVER
|
||||
*/
|
||||
|
||||
static void gfx_display_d3d11_blend_begin(void *data)
|
||||
@ -1196,7 +1196,7 @@ static void d3d11_render_overlay(d3d11_video_t *d3d11)
|
||||
|
||||
d3d11->context->lpVtbl->OMSetBlendState(d3d11->context, d3d11->blend_enable,
|
||||
NULL, D3D11_DEFAULT_SAMPLE_MASK);
|
||||
{
|
||||
{
|
||||
UINT stride = sizeof(d3d11_sprite_t);
|
||||
UINT offset = 0;
|
||||
d3d11->context->lpVtbl->IASetVertexBuffers(
|
||||
@ -1235,7 +1235,7 @@ static void d3d11_set_hdr_max_nits(void *data, float max_nits)
|
||||
|
||||
dxgi_set_hdr_metadata(
|
||||
d3d11->swapChain,
|
||||
(d3d11->flags & D3D11_ST_FLAG_HDR_SUPPORT),
|
||||
(d3d11->flags & D3D11_ST_FLAG_HDR_SUPPORT) ? true : false,
|
||||
d3d11->chain_bit_depth,
|
||||
d3d11->chain_color_space,
|
||||
d3d11->hdr.max_output_nits,
|
||||
@ -1369,7 +1369,7 @@ static void d3d11_gfx_set_rotation(void* data, unsigned rotation)
|
||||
static void d3d11_update_viewport(d3d11_video_t *d3d11, bool force_full)
|
||||
{
|
||||
video_driver_update_viewport(&d3d11->vp, force_full,
|
||||
d3d11->flags & D3D11_ST_FLAG_KEEP_ASPECT);
|
||||
(d3d11->flags & D3D11_ST_FLAG_KEEP_ASPECT) ? true : false);
|
||||
|
||||
d3d11->frame.viewport.TopLeftX = d3d11->vp.x;
|
||||
d3d11->frame.viewport.TopLeftY = d3d11->vp.y;
|
||||
@ -1446,11 +1446,11 @@ static bool d3d11_gfx_set_shader(void* data, enum rarch_shader_type type, const
|
||||
{
|
||||
#if defined(HAVE_SLANG) && defined(HAVE_SPIRV_CROSS)
|
||||
enum d3d11_feature_level_hint
|
||||
feat_level_hint = D3D11_FEATURE_LEVEL_HINT_DONTCARE;
|
||||
feat_level_hint = D3D11_FEATURE_LEVEL_HINT_DONTCARE;
|
||||
unsigned i;
|
||||
d3d11_texture_t* source = NULL;
|
||||
d3d11_video_t* d3d11 = (d3d11_video_t*)data;
|
||||
unsigned shader_model = 40;
|
||||
unsigned shader_model = 40;
|
||||
|
||||
if (!d3d11)
|
||||
return false;
|
||||
@ -1723,7 +1723,7 @@ static void d3d11_gfx_free(void* data)
|
||||
Release(d3d11->scissor_disabled);
|
||||
Release(d3d11->swapChain);
|
||||
|
||||
video_st_flags = video_st->flags;
|
||||
video_st_flags = video_st->flags;
|
||||
if (video_st_flags & VIDEO_FLAG_CACHE_CONTEXT)
|
||||
{
|
||||
cached_device_d3d11 = d3d11->device;
|
||||
@ -1806,9 +1806,9 @@ static bool d3d11_init_swapchain(d3d11_video_t* d3d11,
|
||||
if (!(d3d11->flags & D3D11_ST_FLAG_HDR_SUPPORT))
|
||||
d3d11->flags &= ~D3D11_ST_FLAG_HDR_ENABLE;
|
||||
|
||||
d3d11->chain_bit_depth =
|
||||
d3d11->chain_bit_depth =
|
||||
(d3d11->flags & D3D11_ST_FLAG_HDR_ENABLE)
|
||||
? DXGI_SWAPCHAIN_BIT_DEPTH_10
|
||||
? DXGI_SWAPCHAIN_BIT_DEPTH_10
|
||||
: DXGI_SWAPCHAIN_BIT_DEPTH_8;
|
||||
#endif
|
||||
|
||||
@ -1913,7 +1913,7 @@ static bool d3d11_init_swapchain(d3d11_video_t* d3d11,
|
||||
#ifdef __WINRT__
|
||||
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
|
||||
/* On phone, no swap effects are supported. */
|
||||
/* TODO/FIXME - need to verify if this is needed and if
|
||||
/* TODO/FIXME - need to verify if this is needed and if
|
||||
* flip model cannot be used here */
|
||||
desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
|
||||
#else
|
||||
@ -1987,9 +1987,9 @@ static bool d3d11_init_swapchain(d3d11_video_t* d3d11,
|
||||
}
|
||||
|
||||
#ifdef HAVE_WINDOW
|
||||
/* Don't let DXGI mess with the full screen state,
|
||||
/* Don't let DXGI mess with the full screen state,
|
||||
* because otherwise we end up with a mismatch
|
||||
* between the window size and the buffers.
|
||||
* between the window size and the buffers.
|
||||
* RetroArch only uses windowed mode (see above). */
|
||||
if (FAILED(dxgiFactory->lpVtbl->MakeWindowAssociation(dxgiFactory, desc.OutputWindow, DXGI_MWA_NO_ALT_ENTER)))
|
||||
{
|
||||
@ -2020,12 +2020,12 @@ static bool d3d11_init_swapchain(d3d11_video_t* d3d11,
|
||||
}
|
||||
|
||||
#ifdef HAVE_DXGI_HDR
|
||||
/* Check display HDR support and
|
||||
initialize ST.2084 support to match
|
||||
/* Check display HDR support and
|
||||
initialize ST.2084 support to match
|
||||
the display's support. */
|
||||
color_space =
|
||||
color_space =
|
||||
(d3d11->flags & D3D11_ST_FLAG_HDR_ENABLE)
|
||||
? DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020
|
||||
? DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020
|
||||
: DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709;
|
||||
|
||||
dxgi_swapchain_color_space(
|
||||
@ -2034,7 +2034,7 @@ static bool d3d11_init_swapchain(d3d11_video_t* d3d11,
|
||||
color_space);
|
||||
dxgi_set_hdr_metadata(
|
||||
d3d11->swapChain,
|
||||
d3d11->flags & D3D11_ST_FLAG_HDR_SUPPORT,
|
||||
(d3d11->flags & D3D11_ST_FLAG_HDR_SUPPORT) ? true : false,
|
||||
d3d11->chain_bit_depth,
|
||||
d3d11->chain_color_space,
|
||||
d3d11->hdr.max_output_nits,
|
||||
@ -2218,13 +2218,13 @@ static void *d3d11_gfx_init(const video_info_t* video,
|
||||
D3D11_SUBRESOURCE_DATA ubo_data;
|
||||
matrix_4x4_ortho(d3d11->mvp_no_rot, 0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f);
|
||||
|
||||
d3d11->hdr.ubo_values.mvp =
|
||||
d3d11->mvp_no_rot;
|
||||
d3d11->hdr.ubo_values.max_nits =
|
||||
d3d11->hdr.ubo_values.mvp =
|
||||
d3d11->mvp_no_rot;
|
||||
d3d11->hdr.ubo_values.max_nits =
|
||||
settings->floats.video_hdr_max_nits;
|
||||
d3d11->hdr.ubo_values.paper_white_nits =
|
||||
settings->floats.video_hdr_paper_white_nits;
|
||||
d3d11->hdr.ubo_values.contrast =
|
||||
d3d11->hdr.ubo_values.contrast =
|
||||
VIDEO_HDR_MAX_CONTRAST - settings->floats.video_hdr_display_contrast;
|
||||
d3d11->hdr.ubo_values.expand_gamut =
|
||||
settings->bools.video_hdr_expand_gamut;
|
||||
@ -2554,7 +2554,7 @@ static void *d3d11_gfx_init(const video_info_t* video,
|
||||
{
|
||||
d3d11_fake_context.get_flags = d3d11_get_flags;
|
||||
d3d11_fake_context.get_metrics = win32_get_metrics;
|
||||
video_context_driver_set(&d3d11_fake_context);
|
||||
video_context_driver_set(&d3d11_fake_context);
|
||||
const char *shader_preset = video_shader_get_current_shader_preset();
|
||||
enum rarch_shader_type type = video_shader_parse_type(shader_preset);
|
||||
d3d11_gfx_set_shader(d3d11, type, shader_preset);
|
||||
@ -2678,7 +2678,6 @@ static void d3d11_init_render_targets(d3d11_video_t* d3d11, unsigned width, unsi
|
||||
|
||||
if (pass->fbo.flags & FBO_SCALE_FLAG_VALID)
|
||||
{
|
||||
|
||||
switch (pass->fbo.type_x)
|
||||
{
|
||||
case RARCH_SCALE_INPUT:
|
||||
@ -2781,8 +2780,8 @@ static bool d3d11_gfx_frame(
|
||||
D3D11RenderTargetView rtv = NULL;
|
||||
d3d11_video_t* d3d11 = (d3d11_video_t*)data;
|
||||
D3D11DeviceContext context = d3d11->context;
|
||||
bool vsync = d3d11->flags & D3D11_ST_FLAG_VSYNC;
|
||||
bool wait_for_vblank = d3d11->flags & D3D11_ST_FLAG_WAIT_FOR_VBLANK;
|
||||
bool vsync = (d3d11->flags & D3D11_ST_FLAG_VSYNC) ? true : false;
|
||||
bool wait_for_vblank = (d3d11->flags & D3D11_ST_FLAG_WAIT_FOR_VBLANK) ? true : false;
|
||||
unsigned present_flags = (vsync || !(d3d11->flags & D3D11_ST_FLAG_HAS_ALLOW_TEARING))
|
||||
? 0 : DXGI_PRESENT_ALLOW_TEARING;
|
||||
const char *stat_text = video_info->stat_text;
|
||||
@ -2796,7 +2795,7 @@ static bool d3d11_gfx_frame(
|
||||
bool widgets_active = video_info->widgets_active;
|
||||
#endif
|
||||
#ifdef HAVE_DXGI_HDR
|
||||
bool d3d11_hdr_enable = d3d11->flags & D3D11_ST_FLAG_HDR_ENABLE;
|
||||
bool d3d11_hdr_enable = (d3d11->flags & D3D11_ST_FLAG_HDR_ENABLE) ? true : false;
|
||||
bool video_hdr_enable = video_info->hdr_enable;
|
||||
DXGI_FORMAT back_buffer_format = d3d11->shader_preset && d3d11->shader_preset->passes ? glslang_format_to_dxgi(d3d11->pass[d3d11->shader_preset->passes - 1].semantics.format) : DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
bool use_back_buffer = back_buffer_format != d3d11->chain_formats[d3d11->chain_bit_depth];
|
||||
@ -2896,7 +2895,7 @@ static bool d3d11_gfx_frame(
|
||||
|
||||
dxgi_set_hdr_metadata(
|
||||
d3d11->swapChain,
|
||||
d3d11->flags & D3D11_ST_FLAG_HDR_SUPPORT,
|
||||
(d3d11->flags & D3D11_ST_FLAG_HDR_SUPPORT) ? true : false,
|
||||
d3d11->chain_bit_depth,
|
||||
d3d11->chain_color_space,
|
||||
d3d11->hdr.max_output_nits,
|
||||
@ -2915,7 +2914,7 @@ static bool d3d11_gfx_frame(
|
||||
Release(back_buffer);
|
||||
}
|
||||
|
||||
#if 0
|
||||
#if 0
|
||||
/* Custom viewport doesn't call apply_state_changes, so we can't rely on this for now */
|
||||
if (d3d11->resize_viewport)
|
||||
#endif
|
||||
@ -2966,7 +2965,7 @@ static bool d3d11_gfx_frame(
|
||||
|
||||
if (d3d11->shader_preset->history_size)
|
||||
{
|
||||
if (d3d11->flags &D3D11_ST_FLAG_INIT_HISTORY)
|
||||
if (d3d11->flags & D3D11_ST_FLAG_INIT_HISTORY)
|
||||
d3d11_init_history(d3d11, width, height);
|
||||
else
|
||||
{
|
||||
@ -3408,7 +3407,7 @@ static bool d3d11_gfx_alive(void* data)
|
||||
&resize_chain,
|
||||
&d3d11->vp.full_width,
|
||||
&d3d11->vp.full_height);
|
||||
|
||||
|
||||
if (resize_chain)
|
||||
d3d11->flags |= D3D11_ST_FLAG_RESIZE_CHAIN;
|
||||
else
|
||||
@ -3565,7 +3564,7 @@ static uintptr_t d3d11_gfx_load_texture(
|
||||
return (uintptr_t)texture;
|
||||
}
|
||||
|
||||
static void d3d11_gfx_unload_texture(void* data,
|
||||
static void d3d11_gfx_unload_texture(void* data,
|
||||
bool threaded, uintptr_t handle)
|
||||
{
|
||||
d3d11_texture_t* texture = (d3d11_texture_t*)handle;
|
||||
@ -3585,7 +3584,7 @@ static bool d3d11_get_hw_render_interface(
|
||||
d3d11_video_t* d3d11 = (d3d11_video_t*)data;
|
||||
*iface = (const struct retro_hw_render_interface*)
|
||||
&d3d11->hw_iface;
|
||||
return d3d11->flags & D3D11_ST_FLAG_HW_IFACE_ENABLE;
|
||||
return ((d3d11->flags & D3D11_ST_FLAG_HW_IFACE_ENABLE) > 0);
|
||||
}
|
||||
|
||||
#ifndef __WINRT__
|
||||
|
@ -481,7 +481,7 @@ static void d3d12_update_texture(
|
||||
}
|
||||
|
||||
/*
|
||||
* DISPLAY DRIVER
|
||||
* DISPLAY DRIVER
|
||||
*/
|
||||
|
||||
static void gfx_display_d3d12_blend_begin(void *data)
|
||||
@ -531,7 +531,7 @@ static void gfx_display_d3d12_draw(gfx_display_ctx_draw_t *draw,
|
||||
if (draw->coords->vertex && draw->coords->tex_coord && draw->coords->color)
|
||||
vertex_count = draw->coords->vertices;
|
||||
|
||||
if ( (!(d3d12->flags & D3D12_ST_FLAG_SPRITES_ENABLE))
|
||||
if ( (!(d3d12->flags & D3D12_ST_FLAG_SPRITES_ENABLE))
|
||||
|| (vertex_count > d3d12->sprites.capacity))
|
||||
return;
|
||||
|
||||
@ -550,7 +550,7 @@ static void gfx_display_d3d12_draw(gfx_display_ctx_draw_t *draw,
|
||||
{
|
||||
|
||||
sprite->pos.x = draw->x / (float)d3d12->chain.viewport.Width;
|
||||
sprite->pos.y =
|
||||
sprite->pos.y =
|
||||
(d3d12->chain.viewport.Height - draw->y - draw->height) /
|
||||
(float)d3d12->chain.viewport.Height;
|
||||
sprite->pos.w = draw->width / (float)d3d12->chain.viewport.Width;
|
||||
@ -773,7 +773,7 @@ gfx_display_ctx_driver_t gfx_display_ctx_d3d12 = {
|
||||
};
|
||||
|
||||
/*
|
||||
* FONT DRIVER
|
||||
* FONT DRIVER
|
||||
*/
|
||||
|
||||
static void * d3d12_font_init(void* data, const char* font_path,
|
||||
@ -986,7 +986,7 @@ static void d3d12_font_render_message(
|
||||
const unsigned int color,
|
||||
float pos_x,
|
||||
float pos_y,
|
||||
unsigned width,
|
||||
unsigned width,
|
||||
unsigned height,
|
||||
unsigned text_align)
|
||||
{
|
||||
@ -1135,7 +1135,7 @@ font_renderer_t d3d12_font = {
|
||||
};
|
||||
|
||||
/*
|
||||
* VIDEO DRIVER
|
||||
* VIDEO DRIVER
|
||||
*/
|
||||
|
||||
static uint32_t d3d12_get_flags(void *data)
|
||||
@ -1348,7 +1348,7 @@ static void d3d12_render_overlay(d3d12_video_t *d3d12)
|
||||
{
|
||||
cmd->lpVtbl->RSSetViewports(cmd, 1, &d3d12->frame.viewport);
|
||||
cmd->lpVtbl->RSSetScissorRects(cmd, 1, &d3d12->frame.scissorRect);
|
||||
|
||||
|
||||
}
|
||||
|
||||
cmd->lpVtbl->IASetVertexBuffers(cmd, 0, 1, &d3d12->overlays.vbo_view);
|
||||
@ -1391,7 +1391,7 @@ static void d3d12_set_hdr_max_nits(void* data, float max_nits)
|
||||
|
||||
dxgi_set_hdr_metadata(
|
||||
d3d12->chain.handle,
|
||||
d3d12->flags & D3D12_ST_FLAG_HDR_SUPPORT,
|
||||
(d3d12->flags & D3D12_ST_FLAG_HDR_SUPPORT) ? true : false,
|
||||
d3d12->chain.bit_depth,
|
||||
d3d12->chain.color_space,
|
||||
d3d12->hdr.max_output_nits,
|
||||
@ -1526,7 +1526,7 @@ static void d3d12_gfx_set_rotation(void* data, unsigned rotation)
|
||||
static void d3d12_update_viewport(d3d12_video_t *d3d12, bool force_full)
|
||||
{
|
||||
video_driver_update_viewport(&d3d12->vp, force_full,
|
||||
d3d12->flags & D3D12_ST_FLAG_KEEP_ASPECT);
|
||||
(d3d12->flags & D3D12_ST_FLAG_KEEP_ASPECT) ? true : false);
|
||||
|
||||
d3d12->frame.viewport.TopLeftX = d3d12->vp.x;
|
||||
d3d12->frame.viewport.TopLeftY = d3d12->vp.y;
|
||||
@ -1780,12 +1780,12 @@ static bool d3d12_gfx_set_shader(void* data, enum rarch_shader_type type, const
|
||||
#ifdef HAVE_DXGI_HDR
|
||||
d3d12->pass[i].rt.rt_view.ptr =
|
||||
d3d12->desc.rtv_heap.cpu.ptr +
|
||||
(countof(d3d12->chain.renderTargets) + 1 + (2 * i))
|
||||
(countof(d3d12->chain.renderTargets) + 1 + (2 * i))
|
||||
* d3d12->desc.rtv_heap.stride;
|
||||
#else
|
||||
d3d12->pass[i].rt.rt_view.ptr =
|
||||
d3d12->desc.rtv_heap.cpu.ptr +
|
||||
(countof(d3d12->chain.renderTargets) + (2 * i))
|
||||
(countof(d3d12->chain.renderTargets) + (2 * i))
|
||||
* d3d12->desc.rtv_heap.stride;
|
||||
#endif
|
||||
|
||||
@ -1831,7 +1831,7 @@ static bool d3d12_gfx_set_shader(void* data, enum rarch_shader_type type, const
|
||||
d3d12_set_hdr_inverse_tonemap(d3d12, true);
|
||||
d3d12_set_hdr10(d3d12, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_DXGI_HDR */
|
||||
|
||||
for (i = 0; i < d3d12->shader_preset->luts; i++)
|
||||
@ -2157,7 +2157,7 @@ static bool d3d12_gfx_init_pipelines(d3d12_video_t* d3d12)
|
||||
|
||||
desc.CS.pShaderBytecode = cs_code->lpVtbl->GetBufferPointer(cs_code);
|
||||
desc.CS.BytecodeLength = cs_code->lpVtbl->GetBufferSize(cs_code);
|
||||
if (FAILED(d3d12->device->lpVtbl->CreateComputePipelineState(d3d12->device, &desc,
|
||||
if (FAILED(d3d12->device->lpVtbl->CreateComputePipelineState(d3d12->device, &desc,
|
||||
uuidof(ID3D12PipelineState), (void**)&d3d12->mipmapgen_pipe)))
|
||||
Release(cs_code);
|
||||
cs_code = NULL;
|
||||
@ -2379,19 +2379,19 @@ static bool d3d12_init_swapchain(d3d12_video_t* d3d12,
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DXGI_HDR
|
||||
/* Check display HDR support and
|
||||
initialize ST.2084 support to match
|
||||
/* Check display HDR support and
|
||||
initialize ST.2084 support to match
|
||||
the display's support. */
|
||||
color_space =
|
||||
color_space =
|
||||
(d3d12->flags & D3D12_ST_FLAG_HDR_ENABLE)
|
||||
? DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020
|
||||
? DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020
|
||||
: DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709;
|
||||
|
||||
dxgi_swapchain_color_space(d3d12->chain.handle,
|
||||
&d3d12->chain.color_space, color_space);
|
||||
dxgi_set_hdr_metadata(
|
||||
d3d12->chain.handle,
|
||||
d3d12->flags & D3D12_ST_FLAG_HDR_SUPPORT,
|
||||
(d3d12->flags & D3D12_ST_FLAG_HDR_SUPPORT) ? true : false,
|
||||
d3d12->chain.bit_depth,
|
||||
d3d12->chain.color_space,
|
||||
d3d12->hdr.max_output_nits,
|
||||
@ -2414,15 +2414,15 @@ static bool d3d12_init_swapchain(d3d12_video_t* d3d12,
|
||||
0, sizeof(d3d12->chain.back_buffer));
|
||||
d3d12->chain.back_buffer.desc.Width = width;
|
||||
d3d12->chain.back_buffer.desc.Height = height;
|
||||
d3d12->chain.back_buffer.desc.Format =
|
||||
d3d12->chain.back_buffer.desc.Format =
|
||||
d3d12->shader_preset && d3d12->shader_preset->passes ? glslang_format_to_dxgi(d3d12->pass[d3d12->shader_preset->passes - 1].semantics.format) : DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
d3d12->chain.back_buffer.desc.Flags =
|
||||
d3d12->chain.back_buffer.desc.Flags =
|
||||
D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
|
||||
d3d12->chain.back_buffer.srv_heap =
|
||||
d3d12->chain.back_buffer.srv_heap =
|
||||
&d3d12->desc.srv_heap;
|
||||
d3d12->chain.back_buffer.rt_view.ptr =
|
||||
d3d12->desc.rtv_heap.cpu.ptr
|
||||
+ (countof(d3d12->chain.renderTargets))
|
||||
d3d12->chain.back_buffer.rt_view.ptr =
|
||||
d3d12->desc.rtv_heap.cpu.ptr
|
||||
+ (countof(d3d12->chain.renderTargets))
|
||||
* d3d12->desc.rtv_heap.stride;
|
||||
d3d12_release_texture(&d3d12->chain.back_buffer);
|
||||
d3d12_init_texture(d3d12->device, &d3d12->chain.back_buffer);
|
||||
@ -2520,7 +2520,7 @@ static void d3d12_init_base(d3d12_video_t* d3d12)
|
||||
RARCH_WARN("[D3D12]: Could not create D3D12 device.\n");
|
||||
}
|
||||
|
||||
#ifdef DEVICE_DEBUG
|
||||
#ifdef DEVICE_DEBUG
|
||||
#ifdef DEBUG
|
||||
if (d3d12->device)
|
||||
{
|
||||
@ -2653,7 +2653,7 @@ static void d3d12_init_descriptors(d3d12_video_t* d3d12)
|
||||
desc.pParameters = cs_root_params;
|
||||
desc.NumStaticSamplers = 1;
|
||||
desc.pStaticSamplers = &static_sampler;
|
||||
desc.Flags =
|
||||
desc.Flags =
|
||||
D3D12_ROOT_SIGNATURE_FLAG_DENY_VERTEX_SHADER_ROOT_ACCESS
|
||||
| D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS
|
||||
| D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS
|
||||
@ -2766,7 +2766,7 @@ static void d3d12_init_samplers(d3d12_video_t* d3d12)
|
||||
|
||||
static void d3d12_init_queue(d3d12_video_t* d3d12)
|
||||
{
|
||||
static const D3D12_COMMAND_QUEUE_DESC desc = {
|
||||
static const D3D12_COMMAND_QUEUE_DESC desc = {
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT,
|
||||
D3D12_COMMAND_QUEUE_PRIORITY_NORMAL,
|
||||
D3D12_COMMAND_QUEUE_FLAG_NONE,
|
||||
@ -2833,7 +2833,7 @@ static void d3d12_set_hw_render_texture(void* data, ID3D12Resource* texture, DXG
|
||||
d3d12->hw_render_texture_format = format;
|
||||
}
|
||||
|
||||
static void *d3d12_gfx_init(const video_info_t* video,
|
||||
static void *d3d12_gfx_init(const video_info_t* video,
|
||||
input_driver_t** input, void** input_data)
|
||||
{
|
||||
#ifdef HAVE_MONITOR
|
||||
@ -2886,9 +2886,9 @@ static void *d3d12_gfx_init(const video_info_t* video,
|
||||
|
||||
#ifdef HAVE_DXGI_HDR
|
||||
if (settings->bools.video_hdr_enable)
|
||||
d3d12->flags |= D3D12_ST_FLAG_HDR_ENABLE;
|
||||
d3d12->flags |= D3D12_ST_FLAG_HDR_ENABLE;
|
||||
else
|
||||
d3d12->flags &= ~D3D12_ST_FLAG_HDR_ENABLE;
|
||||
d3d12->flags &= ~D3D12_ST_FLAG_HDR_ENABLE;
|
||||
d3d12->hdr.max_output_nits = settings->floats.video_hdr_max_nits;
|
||||
d3d12->hdr.min_output_nits = 0.001f;
|
||||
d3d12->hdr.max_cll = 0.0f;
|
||||
@ -2959,7 +2959,7 @@ static void *d3d12_gfx_init(const video_info_t* video,
|
||||
d3d12->hdr.ubo_view.BufferLocation =
|
||||
d3d12_create_buffer(d3d12->device, d3d12->hdr.ubo_view.SizeInBytes, &d3d12->hdr.ubo);
|
||||
|
||||
d3d12->hdr.ubo_values.mvp = d3d12->mvp_no_rot;
|
||||
d3d12->hdr.ubo_values.mvp = d3d12->mvp_no_rot;
|
||||
d3d12->hdr.ubo_values.max_nits = settings->floats.video_hdr_max_nits;
|
||||
d3d12->hdr.ubo_values.paper_white_nits = settings->floats.video_hdr_paper_white_nits;
|
||||
d3d12->hdr.ubo_values.contrast = VIDEO_HDR_MAX_CONTRAST - settings->floats.video_hdr_display_contrast;
|
||||
@ -3016,7 +3016,7 @@ static void *d3d12_gfx_init(const video_info_t* video,
|
||||
{
|
||||
d3d12_fake_context.get_flags = d3d12_get_flags;
|
||||
d3d12_fake_context.get_metrics = win32_get_metrics;
|
||||
video_context_driver_set(&d3d12_fake_context);
|
||||
video_context_driver_set(&d3d12_fake_context);
|
||||
const char *shader_preset = video_shader_get_current_shader_preset();
|
||||
enum rarch_shader_type type = video_shader_parse_type(shader_preset);
|
||||
d3d12_gfx_set_shader(d3d12, type, shader_preset);
|
||||
@ -3201,8 +3201,8 @@ static bool d3d12_gfx_frame(
|
||||
unsigned i;
|
||||
d3d12_texture_t* texture = NULL;
|
||||
d3d12_video_t* d3d12 = (d3d12_video_t*)data;
|
||||
bool vsync = d3d12->flags & D3D12_ST_FLAG_VSYNC;
|
||||
bool wait_for_vblank = d3d12->flags & D3D12_ST_FLAG_WAIT_FOR_VBLANK;
|
||||
bool vsync = (d3d12->flags & D3D12_ST_FLAG_VSYNC) ? true : false;
|
||||
bool wait_for_vblank = (d3d12->flags & D3D12_ST_FLAG_WAIT_FOR_VBLANK) ? true : false;
|
||||
unsigned present_flags = (vsync) ? 0 : DXGI_PRESENT_ALLOW_TEARING;
|
||||
const char *stat_text = video_info->stat_text;
|
||||
bool statistics_show = video_info->statistics_show;
|
||||
@ -3232,7 +3232,7 @@ static bool d3d12_gfx_frame(
|
||||
D3D12_GFX_SYNC();
|
||||
|
||||
#ifdef HAVE_DXGI_HDR
|
||||
d3d12_hdr_enable = d3d12->flags & D3D12_ST_FLAG_HDR_ENABLE;
|
||||
d3d12_hdr_enable = (d3d12->flags & D3D12_ST_FLAG_HDR_ENABLE) ? true : false;
|
||||
if ( (d3d12->flags & D3D12_ST_FLAG_RESIZE_CHAIN)
|
||||
|| (d3d12_hdr_enable != video_hdr_enable))
|
||||
#else
|
||||
@ -3325,12 +3325,12 @@ static bool d3d12_gfx_frame(
|
||||
d3d12->chain.back_buffer.desc.Width = video_width;
|
||||
d3d12->chain.back_buffer.desc.Height = video_height;
|
||||
d3d12->chain.back_buffer.desc.Format = back_buffer_format;
|
||||
d3d12->chain.back_buffer.desc.Flags =
|
||||
d3d12->chain.back_buffer.desc.Flags =
|
||||
D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
|
||||
d3d12->chain.back_buffer.srv_heap = &d3d12->desc.srv_heap;
|
||||
d3d12->chain.back_buffer.rt_view.ptr =
|
||||
d3d12->desc.rtv_heap.cpu.ptr
|
||||
+ countof(d3d12->chain.renderTargets)
|
||||
d3d12->chain.back_buffer.rt_view.ptr =
|
||||
d3d12->desc.rtv_heap.cpu.ptr
|
||||
+ countof(d3d12->chain.renderTargets)
|
||||
* d3d12->desc.rtv_heap.stride;
|
||||
d3d12_release_texture(&d3d12->chain.back_buffer);
|
||||
d3d12_init_texture(d3d12->device, &d3d12->chain.back_buffer);
|
||||
@ -3346,13 +3346,13 @@ static bool d3d12_gfx_frame(
|
||||
dxgi_swapchain_color_space(d3d12->chain.handle,
|
||||
&d3d12->chain.color_space,
|
||||
DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709);
|
||||
|
||||
|
||||
d3d12->chain.bit_depth = DXGI_SWAPCHAIN_BIT_DEPTH_8;
|
||||
}
|
||||
|
||||
dxgi_set_hdr_metadata(
|
||||
d3d12->chain.handle,
|
||||
d3d12->flags & D3D12_ST_FLAG_HDR_SUPPORT,
|
||||
(d3d12->flags & D3D12_ST_FLAG_HDR_SUPPORT) ? true : false,
|
||||
d3d12->chain.bit_depth,
|
||||
d3d12->chain.color_space,
|
||||
d3d12->hdr.max_output_nits,
|
||||
@ -3431,7 +3431,7 @@ static bool d3d12_gfx_frame(
|
||||
int k;
|
||||
/* TODO/FIXME: what about frame-duping ?
|
||||
* maybe clone d3d12_texture_t with AddRef */
|
||||
d3d12_texture_t tmp =
|
||||
d3d12_texture_t tmp =
|
||||
d3d12->frame.texture[d3d12->shader_preset->history_size];
|
||||
for (k = d3d12->shader_preset->history_size; k > 0; k--)
|
||||
d3d12->frame.texture[k] = d3d12->frame.texture[k - 1];
|
||||
@ -3565,8 +3565,8 @@ static bool d3d12_gfx_frame(
|
||||
D3D12Unmap(d3d12->pass[i].buffers[j], 0, NULL);
|
||||
|
||||
cmd->lpVtbl->SetGraphicsRootConstantBufferView(
|
||||
cmd, j == SLANG_CBUFFER_UBO
|
||||
? ROOT_ID_UBO
|
||||
cmd, j == SLANG_CBUFFER_UBO
|
||||
? ROOT_ID_UBO
|
||||
: ROOT_ID_PC,
|
||||
d3d12->pass[i].buffer_view[j].BufferLocation);
|
||||
}
|
||||
@ -3581,18 +3581,18 @@ static bool d3d12_gfx_frame(
|
||||
{
|
||||
{
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE handle = {
|
||||
d3d12->pass[i].textures.ptr
|
||||
d3d12->pass[i].textures.ptr
|
||||
- d3d12->desc.srv_heap.gpu.ptr
|
||||
+ d3d12->desc.srv_heap.cpu.ptr
|
||||
+ texture_sem->binding * d3d12->desc.srv_heap.stride
|
||||
};
|
||||
d3d12_texture_t* tex =
|
||||
d3d12_texture_t* tex =
|
||||
(d3d12_texture_t*)texture_sem->texture_data;
|
||||
D3D12_SHADER_RESOURCE_VIEW_DESC desc = { tex->desc.Format };
|
||||
|
||||
desc.Shader4ComponentMapping =
|
||||
desc.Shader4ComponentMapping =
|
||||
D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
|
||||
desc.ViewDimension =
|
||||
desc.ViewDimension =
|
||||
D3D12_SRV_DIMENSION_TEXTURE2D;
|
||||
desc.Texture2D.MipLevels = tex->desc.MipLevels;
|
||||
|
||||
@ -3603,10 +3603,10 @@ static bool d3d12_gfx_frame(
|
||||
{
|
||||
D3D12_SAMPLER_DESC desc;
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE handle = {
|
||||
d3d12->pass[i].samplers.ptr
|
||||
- d3d12->desc.sampler_heap.gpu.ptr
|
||||
d3d12->pass[i].samplers.ptr
|
||||
- d3d12->desc.sampler_heap.gpu.ptr
|
||||
+ d3d12->desc.sampler_heap.cpu.ptr
|
||||
+ texture_sem->binding
|
||||
+ texture_sem->binding
|
||||
* d3d12->desc.sampler_heap.stride
|
||||
};
|
||||
|
||||
@ -3734,7 +3734,7 @@ static bool d3d12_gfx_frame(
|
||||
cmd, 1,
|
||||
&d3d12->chain.back_buffer.rt_view,
|
||||
FALSE, NULL);
|
||||
/* TODO/FIXME - fix this warning that shows up with Debug logging
|
||||
/* TODO/FIXME - fix this warning that shows up with Debug logging
|
||||
* EXECUTIONWARNING #820: CLEARRENDERTARGETVIEW_MISMATCHINGCLEARVALUE
|
||||
* We need to set clear value during resource creation to NULL for
|
||||
* D3D12_RESOURCE_DIMENSION_BUFFER, yet we get spammed with this
|
||||
@ -3774,7 +3774,7 @@ static bool d3d12_gfx_frame(
|
||||
cmd->lpVtbl->SetPipelineState(cmd, d3d12->pipes[VIDEO_SHADER_STOCK_BLEND]);
|
||||
cmd->lpVtbl->SetGraphicsRootSignature(cmd, d3d12->desc.rootSignature);
|
||||
|
||||
if ( (d3d12->flags & D3D12_ST_FLAG_MENU_ENABLE)
|
||||
if ( (d3d12->flags & D3D12_ST_FLAG_MENU_ENABLE)
|
||||
&& d3d12->menu.texture.handle)
|
||||
{
|
||||
if (d3d12->menu.texture.dirty)
|
||||
@ -3960,7 +3960,7 @@ static bool d3d12_gfx_alive(void* data)
|
||||
else
|
||||
d3d12->flags &= ~D3D12_ST_FLAG_RESIZE_CHAIN;
|
||||
|
||||
if ( (d3d12->flags & D3D12_ST_FLAG_RESIZE_CHAIN)
|
||||
if ( (d3d12->flags & D3D12_ST_FLAG_RESIZE_CHAIN)
|
||||
&& (d3d12->vp.full_width != 0)
|
||||
&& (d3d12->vp.full_height != 0))
|
||||
video_driver_set_size(d3d12->vp.full_width, d3d12->vp.full_height);
|
||||
@ -4128,7 +4128,7 @@ static uintptr_t d3d12_gfx_load_texture(
|
||||
return (uintptr_t)texture;
|
||||
}
|
||||
|
||||
static void d3d12_gfx_unload_texture(void* data,
|
||||
static void d3d12_gfx_unload_texture(void* data,
|
||||
bool threaded, uintptr_t handle)
|
||||
{
|
||||
d3d12_texture_t* texture = (d3d12_texture_t*)handle;
|
||||
@ -4152,7 +4152,7 @@ static bool d3d12_get_hw_render_interface(
|
||||
d3d12_video_t* d3d12 = (d3d12_video_t*)data;
|
||||
*iface = (const struct retro_hw_render_interface*)
|
||||
&d3d12->hw_iface;
|
||||
return d3d12->flags & D3D12_ST_FLAG_HW_IFACE_ENABLE;
|
||||
return ((d3d12->flags & D3D12_ST_FLAG_HW_IFACE_ENABLE) > 0);
|
||||
}
|
||||
|
||||
#ifndef __WINRT__
|
||||
|
@ -419,7 +419,7 @@ static void gfx_display_gl2_blend_end(void *data)
|
||||
}
|
||||
|
||||
#ifdef MALI_BUG
|
||||
static bool
|
||||
static bool
|
||||
gfx_display_gl2_discard_draw_rectangle(gfx_display_ctx_draw_t *draw,
|
||||
unsigned width, unsigned height)
|
||||
{
|
||||
@ -952,7 +952,7 @@ static void gl2_raster_font_setup_viewport(
|
||||
bool full_screen)
|
||||
{
|
||||
gl2_set_viewport(gl, width, height, full_screen, true);
|
||||
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
@ -1035,7 +1035,7 @@ static void gl2_raster_font_render_msg(
|
||||
gl2_raster_font_setup_viewport(gl, font, width, height, full_screen);
|
||||
|
||||
if ( !string_is_empty(msg)
|
||||
&& font->font_data
|
||||
&& font->font_data
|
||||
&& font->font_driver)
|
||||
{
|
||||
if (drop_x || drop_y)
|
||||
@ -1291,7 +1291,7 @@ static void gl2_set_viewport(gl2_t *gl,
|
||||
video_viewport_get_scaled_integer(&gl->vp,
|
||||
viewport_width, viewport_height,
|
||||
video_driver_get_aspect_ratio(),
|
||||
(gl->flags & GL2_FLAG_KEEP_ASPECT));
|
||||
(gl->flags & GL2_FLAG_KEEP_ASPECT) ? true : false);
|
||||
viewport_width = gl->vp.width;
|
||||
viewport_height = gl->vp.height;
|
||||
}
|
||||
@ -1692,7 +1692,7 @@ static void gl2_create_fbo_texture(gl2_t *gl,
|
||||
|
||||
GL2_BIND_TEXTURE(texture, wrap_enum, mag_filter, min_filter);
|
||||
|
||||
fp_fbo = chain->fbo_scale[i].flags & FBO_SCALE_FLAG_FP_FBO;
|
||||
fp_fbo = (chain->fbo_scale[i].flags & FBO_SCALE_FLAG_FP_FBO) ? true : false;
|
||||
|
||||
if (fp_fbo)
|
||||
{
|
||||
@ -1701,7 +1701,7 @@ static void gl2_create_fbo_texture(gl2_t *gl,
|
||||
}
|
||||
|
||||
#if !defined(HAVE_OPENGLES2)
|
||||
if ( fp_fbo
|
||||
if ( fp_fbo
|
||||
&& (chain->flags & GL2_CHAIN_FLAG_HAS_FP_FBO))
|
||||
{
|
||||
RARCH_LOG("[GL]: FBO pass #%d is floating-point.\n", i);
|
||||
@ -1713,7 +1713,7 @@ static void gl2_create_fbo_texture(gl2_t *gl,
|
||||
#endif
|
||||
{
|
||||
#ifndef HAVE_OPENGLES
|
||||
bool srgb_fbo = chain->fbo_scale[i].flags & FBO_SCALE_FLAG_SRGB_FBO;
|
||||
bool srgb_fbo = (chain->fbo_scale[i].flags & FBO_SCALE_FLAG_SRGB_FBO) ? true : false;
|
||||
|
||||
if (!fp_fbo && srgb_fbo)
|
||||
{
|
||||
@ -1724,7 +1724,7 @@ static void gl2_create_fbo_texture(gl2_t *gl,
|
||||
if (force_srgb_disable)
|
||||
srgb_fbo = false;
|
||||
|
||||
if ( srgb_fbo
|
||||
if ( srgb_fbo
|
||||
&& (chain->flags & GL2_CHAIN_FLAG_HAS_SRGB_FBO))
|
||||
{
|
||||
RARCH_LOG("[GL]: FBO pass #%d is sRGB.\n", i);
|
||||
@ -1734,8 +1734,8 @@ static void gl2_create_fbo_texture(gl2_t *gl,
|
||||
glTexImage2D(GL_TEXTURE_2D,
|
||||
0, GL_SRGB_ALPHA_EXT,
|
||||
gl->fbo_rect[i].width, gl->fbo_rect[i].height, 0,
|
||||
(chain->flags & GL2_CHAIN_FLAG_HAS_SRGB_FBO_GLES3)
|
||||
? GL_RGBA
|
||||
(chain->flags & GL2_CHAIN_FLAG_HAS_SRGB_FBO_GLES3)
|
||||
? GL_RGBA
|
||||
: GL_SRGB_ALPHA_EXT,
|
||||
GL_UNSIGNED_BYTE, NULL);
|
||||
#else
|
||||
@ -1962,7 +1962,7 @@ static void gl2_renderchain_init(
|
||||
gl2_shader_scale(gl, &scaler, shader_info_num);
|
||||
|
||||
/* we always want FBO to be at least initialized on startup for consoles */
|
||||
if ( shader_info_num == 1
|
||||
if ( shader_info_num == 1
|
||||
&& (!(scale.flags & FBO_SCALE_FLAG_VALID)))
|
||||
return;
|
||||
|
||||
@ -2613,15 +2613,15 @@ static void gl_load_texture_data(
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
|
||||
glTexImage2D(GL_TEXTURE_2D,
|
||||
0,
|
||||
(use_rgba || !rgb32)
|
||||
? GL_RGBA
|
||||
(use_rgba || !rgb32)
|
||||
? GL_RGBA
|
||||
: RARCH_GL_INTERNAL_FORMAT32,
|
||||
width, height, 0,
|
||||
(use_rgba || !rgb32)
|
||||
? GL_RGBA
|
||||
(use_rgba || !rgb32)
|
||||
? GL_RGBA
|
||||
: RARCH_GL_TEXTURE_TYPE32,
|
||||
(rgb32)
|
||||
? RARCH_GL_FORMAT32
|
||||
(rgb32)
|
||||
? RARCH_GL_FORMAT32
|
||||
: GL_UNSIGNED_SHORT_4_4_4_4,
|
||||
frame);
|
||||
|
||||
@ -2835,7 +2835,7 @@ static void gl2_set_viewport_wrapper(void *data, unsigned viewport_width,
|
||||
*
|
||||
* gl2_get_fallback_shader_type(RARCH_SHADER_NONE) returns a default shader type.
|
||||
* if gl2_get_fallback_shader_type(type) != type, type was not supported.
|
||||
*
|
||||
*
|
||||
* Returns: A supported shader type.
|
||||
* If RARCH_SHADER_NONE is returned, no shader backend is supported.
|
||||
**/
|
||||
@ -2968,7 +2968,7 @@ static bool gl2_shader_init(gl2_t *gl, const gfx_ctx_driver_t *ctx_driver,
|
||||
hwr->version_major, hwr->version_minor);
|
||||
#endif
|
||||
|
||||
init_data.gl.core_context_enabled = gl->flags & GL2_FLAG_CORE_CONTEXT_IN_USE;
|
||||
init_data.gl.core_context_enabled = (gl->flags & GL2_FLAG_CORE_CONTEXT_IN_USE) ? true : false;
|
||||
init_data.shader_type = type;
|
||||
init_data.shader = NULL;
|
||||
init_data.shader_data = NULL;
|
||||
@ -3108,7 +3108,7 @@ static void gl2_init_textures(gl2_t *gl)
|
||||
/* GLES is picky about which format we use here.
|
||||
* Without extensions, we can *only* render to 16-bit FBOs. */
|
||||
|
||||
if ( (gl->flags & GL2_FLAG_HW_RENDER_USE)
|
||||
if ( (gl->flags & GL2_FLAG_HW_RENDER_USE)
|
||||
&& (gl->base_size == sizeof(uint32_t)))
|
||||
{
|
||||
if (gl_check_capability(GL_CAPS_ARGB8))
|
||||
@ -3161,9 +3161,9 @@ static void gl2_set_texture_frame(void *data,
|
||||
float alpha)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
enum texture_filter_type
|
||||
menu_filter = settings->bools.menu_linear_filter
|
||||
? TEXTURE_FILTER_LINEAR
|
||||
enum texture_filter_type
|
||||
menu_filter = settings->bools.menu_linear_filter
|
||||
? TEXTURE_FILTER_LINEAR
|
||||
: TEXTURE_FILTER_NEAREST;
|
||||
unsigned base_size = rgb32 ? sizeof(uint32_t) : sizeof(uint16_t);
|
||||
gl2_t *gl = (gl2_t*)data;
|
||||
@ -3433,7 +3433,7 @@ static bool gl2_frame(void *data, const void *frame,
|
||||
#ifndef EMSCRIPTEN
|
||||
unsigned black_frame_insertion = video_info->black_frame_insertion;
|
||||
#endif
|
||||
bool input_driver_nonblock_state = video_info->input_driver_nonblock_state;
|
||||
bool input_driver_nonblock_state = video_info->input_driver_nonblock_state;
|
||||
bool hard_sync = video_info->hard_sync;
|
||||
unsigned hard_sync_frames = video_info->hard_sync_frames;
|
||||
struct font_params *osd_params = (struct font_params*)
|
||||
@ -3562,7 +3562,7 @@ static bool gl2_frame(void *data, const void *frame,
|
||||
|
||||
/* No point regenerating mipmaps
|
||||
* if there are no new frames. */
|
||||
if ( (gl->flags & GL2_FLAG_TEXTURE_MIPMAP)
|
||||
if ( (gl->flags & GL2_FLAG_TEXTURE_MIPMAP)
|
||||
&& (gl->flags & GL2_FLAG_HAVE_MIPMAP))
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
}
|
||||
@ -3708,9 +3708,9 @@ static bool gl2_frame(void *data, const void *frame,
|
||||
#endif
|
||||
gl2_pbo_async_readback(gl);
|
||||
|
||||
if (gl->ctx_driver->swap_buffers)
|
||||
if (gl->ctx_driver->swap_buffers)
|
||||
gl->ctx_driver->swap_buffers(gl->ctx_data);
|
||||
|
||||
|
||||
/* Emscripten has to do black frame insertion in its main loop */
|
||||
#ifndef EMSCRIPTEN
|
||||
/* Disable BFI during fast forward, slow-motion,
|
||||
@ -3719,7 +3719,7 @@ static bool gl2_frame(void *data, const void *frame,
|
||||
black_frame_insertion
|
||||
&& !input_driver_nonblock_state
|
||||
&& !runloop_is_slowmotion
|
||||
&& !runloop_is_paused
|
||||
&& !runloop_is_paused
|
||||
&& (!(gl->flags & GL2_FLAG_MENU_TEXTURE_ENABLE)))
|
||||
{
|
||||
size_t n;
|
||||
@ -3729,12 +3729,12 @@ static bool gl2_frame(void *data, const void *frame,
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
if (gl->ctx_driver->swap_buffers)
|
||||
gl->ctx_driver->swap_buffers(gl->ctx_data);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
gl->ctx_driver->swap_buffers(gl->ctx_data);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* check if we are fast forwarding or in menu,
|
||||
/* check if we are fast forwarding or in menu,
|
||||
* if we are ignore hard sync */
|
||||
if ( (gl->flags & GL2_FLAG_HAVE_SYNC)
|
||||
&& hard_sync
|
||||
@ -4073,7 +4073,7 @@ static const gfx_ctx_driver_t *gl2_get_context(gl2_t *gl)
|
||||
gfx_ctx = video_context_driver_init_first(gl,
|
||||
settings->arrays.video_context_driver,
|
||||
api, major, minor,
|
||||
gl->flags & GL2_FLAG_SHARED_CONTEXT_USE,
|
||||
(gl->flags & GL2_FLAG_SHARED_CONTEXT_USE) ? true : false,
|
||||
&ctx_data);
|
||||
|
||||
if (ctx_data)
|
||||
@ -4527,7 +4527,7 @@ static void *gl2_init(const video_info_t *video,
|
||||
|
||||
if (gl->shader->filter_type(gl->shader_data,
|
||||
1, &force_smooth))
|
||||
gl->tex_min_filter = (gl->flags & GL2_FLAG_TEXTURE_MIPMAP)
|
||||
gl->tex_min_filter = (gl->flags & GL2_FLAG_TEXTURE_MIPMAP)
|
||||
? (force_smooth ? GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST)
|
||||
: (force_smooth ? GL_LINEAR : GL_NEAREST);
|
||||
else
|
||||
@ -5181,7 +5181,7 @@ static uintptr_t gl2_load_texture(void *video_data, void *data,
|
||||
return id;
|
||||
}
|
||||
|
||||
static void gl2_unload_texture(void *data,
|
||||
static void gl2_unload_texture(void *data,
|
||||
bool threaded, uintptr_t id)
|
||||
{
|
||||
GLuint glid;
|
||||
|
@ -176,7 +176,7 @@ static void gfx_display_gl3_draw_pipeline(
|
||||
case VIDEO_SHADER_MENU_4:
|
||||
case VIDEO_SHADER_MENU_5:
|
||||
draw->backend_data = ubo_scratch_data;
|
||||
draw->backend_data_size = sizeof(math_matrix_4x4)
|
||||
draw->backend_data_size = sizeof(math_matrix_4x4)
|
||||
+ 4 * sizeof(float);
|
||||
|
||||
/* Match UBO layout in shader. */
|
||||
@ -190,9 +190,9 @@ static void gfx_display_gl3_draw_pipeline(
|
||||
if (draw->pipeline_id == VIDEO_SHADER_MENU_5)
|
||||
yflip = 1.0f;
|
||||
|
||||
memcpy(ubo_scratch_data + sizeof(math_matrix_4x4)
|
||||
memcpy(ubo_scratch_data + sizeof(math_matrix_4x4)
|
||||
+ 2 * sizeof(float), &t, sizeof(t));
|
||||
memcpy(ubo_scratch_data + sizeof(math_matrix_4x4)
|
||||
memcpy(ubo_scratch_data + sizeof(math_matrix_4x4)
|
||||
+ 3 * sizeof(float), &yflip, sizeof(yflip));
|
||||
draw->coords = &blank_coords;
|
||||
blank_coords.vertices = 4;
|
||||
@ -212,8 +212,8 @@ static void gfx_display_gl3_draw(gfx_display_ctx_draw_t *draw,
|
||||
const float *color = NULL;
|
||||
GLuint texture = 0;
|
||||
gl3_t *gl = (gl3_t*)data;
|
||||
const struct
|
||||
gl3_buffer_locations
|
||||
const struct
|
||||
gl3_buffer_locations
|
||||
*loc = NULL;
|
||||
|
||||
if (!gl || !draw)
|
||||
@ -296,7 +296,7 @@ static void gfx_display_gl3_draw(gfx_display_ctx_draw_t *draw,
|
||||
else
|
||||
{
|
||||
const math_matrix_4x4 *mat = draw->matrix_data
|
||||
? (const math_matrix_4x4*)draw->matrix_data
|
||||
? (const math_matrix_4x4*)draw->matrix_data
|
||||
: (const math_matrix_4x4*)&gl->mvp_no_rot;
|
||||
if (gl->pipelines.alpha_blend_loc.flat_ubo_vertex >= 0)
|
||||
glUniform4fv(gl->pipelines.alpha_blend_loc.flat_ubo_vertex,
|
||||
@ -430,7 +430,7 @@ static void gl3_raster_font_free(void *data,
|
||||
|
||||
if (is_threaded)
|
||||
if (
|
||||
font->gl &&
|
||||
font->gl &&
|
||||
font->gl->ctx_driver &&
|
||||
font->gl->ctx_driver->make_current)
|
||||
font->gl->ctx_driver->make_current(true);
|
||||
@ -481,7 +481,7 @@ static void *gl3_raster_font_init(void *data,
|
||||
|
||||
if (is_threaded)
|
||||
if (
|
||||
font->gl &&
|
||||
font->gl &&
|
||||
font->gl->ctx_driver &&
|
||||
font->gl->ctx_driver->make_current)
|
||||
font->gl->ctx_driver->make_current(false);
|
||||
@ -1319,7 +1319,7 @@ static const gfx_ctx_driver_t *gl3_get_context(gl3_t *gl)
|
||||
gfx_ctx = video_context_driver_init_first(gl,
|
||||
settings->arrays.video_context_driver,
|
||||
api, major, minor,
|
||||
gl->flags & GL3_FLAG_USE_SHARED_CONTEXT,
|
||||
(gl->flags & GL3_FLAG_USE_SHARED_CONTEXT) ? true : false,
|
||||
&ctx_data);
|
||||
|
||||
if (ctx_data)
|
||||
@ -1327,7 +1327,7 @@ static const gfx_ctx_driver_t *gl3_get_context(gl3_t *gl)
|
||||
|
||||
/* Need to force here since video_context_driver_init also checks for global option. */
|
||||
if (gfx_ctx->bind_hw_render)
|
||||
gfx_ctx->bind_hw_render(ctx_data, gl->flags & GL3_FLAG_USE_SHARED_CONTEXT);
|
||||
gfx_ctx->bind_hw_render(ctx_data, (gl->flags & GL3_FLAG_USE_SHARED_CONTEXT) ? true : false);
|
||||
return gfx_ctx;
|
||||
}
|
||||
|
||||
@ -1396,7 +1396,7 @@ static void gl3_set_viewport(gl3_t *gl,
|
||||
video_viewport_get_scaled_integer(&gl->vp,
|
||||
viewport_width, viewport_height,
|
||||
video_driver_get_aspect_ratio(),
|
||||
gl->flags & GL3_FLAG_KEEP_ASPECT);
|
||||
(gl->flags & GL3_FLAG_KEEP_ASPECT) ? true : false);
|
||||
viewport_width = gl->vp.width;
|
||||
viewport_height = gl->vp.height;
|
||||
}
|
||||
@ -1571,8 +1571,8 @@ static bool gl3_init_default_filter_chain(gl3_t *gl)
|
||||
return false;
|
||||
|
||||
gl->filter_chain = gl3_filter_chain_create_default(
|
||||
gl->video_info.smooth
|
||||
? GLSLANG_FILTER_CHAIN_LINEAR
|
||||
gl->video_info.smooth
|
||||
? GLSLANG_FILTER_CHAIN_LINEAR
|
||||
: GLSLANG_FILTER_CHAIN_NEAREST);
|
||||
|
||||
if (!gl->filter_chain)
|
||||
@ -1589,7 +1589,7 @@ static bool gl3_init_filter_chain_preset(gl3_t *gl, const char *shader_path)
|
||||
gl->filter_chain = gl3_filter_chain_create_from_preset(
|
||||
shader_path,
|
||||
gl->video_info.smooth
|
||||
? GLSLANG_FILTER_CHAIN_LINEAR
|
||||
? GLSLANG_FILTER_CHAIN_LINEAR
|
||||
: GLSLANG_FILTER_CHAIN_NEAREST);
|
||||
|
||||
if (!gl->filter_chain)
|
||||
@ -1948,7 +1948,7 @@ static void *gl3_init(const video_info_t *video,
|
||||
video->is_threaded,
|
||||
FONT_DRIVER_RENDER_OPENGL_CORE_API);
|
||||
|
||||
if (video_gpu_record
|
||||
if (video_gpu_record
|
||||
&& recording_state_get_ptr()->enable)
|
||||
{
|
||||
gl->flags |= GL3_FLAG_PBO_READBACK_ENABLE;
|
||||
@ -2412,8 +2412,8 @@ static void gl3_update_cpu_texture(gl3_t *gl,
|
||||
glGenTextures(1, &streamed->tex);
|
||||
glBindTexture(GL_TEXTURE_2D, streamed->tex);
|
||||
glTexStorage2D(GL_TEXTURE_2D, 1,
|
||||
gl->video_info.rgb32
|
||||
? GL_RGBA8
|
||||
gl->video_info.rgb32
|
||||
? GL_RGBA8
|
||||
: GL_RGB565,
|
||||
width, height);
|
||||
streamed->width = width;
|
||||
@ -2535,7 +2535,7 @@ static bool gl3_frame(void *data, const void *frame,
|
||||
glBindVertexArray(gl->vao);
|
||||
|
||||
if (frame)
|
||||
gl->textures_index = (gl->textures_index + 1)
|
||||
gl->textures_index = (gl->textures_index + 1)
|
||||
& (GL_CORE_NUM_TEXTURES - 1);
|
||||
|
||||
streamed = &gl->textures[gl->textures_index];
|
||||
@ -2604,7 +2604,7 @@ static bool gl3_frame(void *data, const void *frame,
|
||||
gl3_filter_chain_build_viewport_pass(gl->filter_chain,
|
||||
&gl->filter_chain_vp,
|
||||
(gl->flags & GL3_FLAG_HW_RENDER_BOTTOM_LEFT)
|
||||
? gl->mvp.data
|
||||
? gl->mvp.data
|
||||
: gl->mvp_yflip.data);
|
||||
gl3_filter_chain_end_frame(gl->filter_chain);
|
||||
|
||||
@ -2685,20 +2685,20 @@ static bool gl3_frame(void *data, const void *frame,
|
||||
black_frame_insertion
|
||||
&& !input_driver_nonblock_state
|
||||
&& !runloop_is_slowmotion
|
||||
&& !runloop_is_paused
|
||||
&& !runloop_is_paused
|
||||
&& (!(gl->flags & GL3_FLAG_MENU_TEXTURE_ENABLE)))
|
||||
{
|
||||
size_t n;
|
||||
for (n = 0; n < black_frame_insertion; ++n)
|
||||
{
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
if (gl->ctx_driver->swap_buffers)
|
||||
gl->ctx_driver->swap_buffers(gl->ctx_data);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( hard_sync
|
||||
&& !input_driver_nonblock_state
|
||||
@ -2850,7 +2850,7 @@ static void gl3_set_texture_frame(void *data,
|
||||
float alpha)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
GLenum menu_filter = settings->bools.menu_linear_filter
|
||||
GLenum menu_filter = settings->bools.menu_linear_filter
|
||||
? GL_LINEAR : GL_NEAREST;
|
||||
unsigned base_size = rgb32 ? sizeof(uint32_t) : sizeof(uint16_t);
|
||||
gl3_t *gl = (gl3_t*)data;
|
||||
@ -2864,15 +2864,15 @@ static void gl3_set_texture_frame(void *data,
|
||||
glDeleteTextures(1, &gl->menu_texture);
|
||||
glGenTextures(1, &gl->menu_texture);
|
||||
glBindTexture(GL_TEXTURE_2D, gl->menu_texture);
|
||||
glTexStorage2D(GL_TEXTURE_2D, 1, rgb32
|
||||
glTexStorage2D(GL_TEXTURE_2D, 1, rgb32
|
||||
? GL_RGBA8 : GL_RGBA4, width, height);
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, base_size);
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
|
||||
width, height, GL_RGBA, rgb32
|
||||
? GL_UNSIGNED_BYTE
|
||||
width, height, GL_RGBA, rgb32
|
||||
? GL_UNSIGNED_BYTE
|
||||
: GL_UNSIGNED_SHORT_4_4_4_4, frame);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
@ -1253,10 +1253,11 @@ static void gfx_display_vk_draw(gfx_display_ctx_draw_t *draw,
|
||||
| (((vk->flags & VK_FLAG_DISPLAY_BLEND) > 0) << 0);
|
||||
call.pipeline = vk->display.pipelines[disp_pipeline];
|
||||
call.texture = texture;
|
||||
call.sampler = (texture->flags & VK_TEX_FLAG_MIPMAP) ?
|
||||
vk->samplers.mipmap_linear :
|
||||
((texture->flags & VK_TEX_FLAG_DEFAULT_SMOOTH) ? vk->samplers.linear
|
||||
: vk->samplers.nearest);
|
||||
call.sampler = (texture->flags & VK_TEX_FLAG_MIPMAP)
|
||||
? vk->samplers.mipmap_linear
|
||||
: ((texture->flags & VK_TEX_FLAG_DEFAULT_SMOOTH)
|
||||
? vk->samplers.linear
|
||||
: vk->samplers.nearest);
|
||||
call.uniform = draw->matrix_data
|
||||
? draw->matrix_data : &vk->mvp_no_rot;
|
||||
call.uniform_size = sizeof(math_matrix_4x4);
|
||||
@ -1902,7 +1903,7 @@ static const gfx_ctx_driver_t *vk_context_driver_init_first(
|
||||
if (i >= 0)
|
||||
{
|
||||
const gfx_ctx_driver_t *ctx = video_context_driver_init(
|
||||
runloop_flags & RUNLOOP_FLAG_CORE_SET_SHARED_CONTEXT,
|
||||
(runloop_flags & RUNLOOP_FLAG_CORE_SET_SHARED_CONTEXT) ? true : false,
|
||||
settings,
|
||||
data,
|
||||
gfx_ctx_vk_drivers[i], ident,
|
||||
@ -1918,7 +1919,7 @@ static const gfx_ctx_driver_t *vk_context_driver_init_first(
|
||||
{
|
||||
const gfx_ctx_driver_t *ctx =
|
||||
video_context_driver_init(
|
||||
runloop_flags & RUNLOOP_FLAG_CORE_SET_SHARED_CONTEXT,
|
||||
(runloop_flags & RUNLOOP_FLAG_CORE_SET_SHARED_CONTEXT) ? true : false,
|
||||
settings,
|
||||
data,
|
||||
gfx_ctx_vk_drivers[i], ident,
|
||||
@ -4296,8 +4297,8 @@ static bool vulkan_frame(void *data, const void *frame,
|
||||
/* Upload menu texture. */
|
||||
if (vk->flags & VK_FLAG_MENU_ENABLE)
|
||||
{
|
||||
if (vk->menu.textures[vk->menu.last_index].image != VK_NULL_HANDLE ||
|
||||
vk->menu.textures[vk->menu.last_index].buffer != VK_NULL_HANDLE)
|
||||
if ( vk->menu.textures[vk->menu.last_index].image != VK_NULL_HANDLE
|
||||
|| vk->menu.textures[vk->menu.last_index].buffer != VK_NULL_HANDLE)
|
||||
{
|
||||
struct vk_texture *optimal = &vk->menu.textures_optimal[vk->menu.last_index];
|
||||
struct vk_texture *texture = &vk->menu.textures[vk->menu.last_index];
|
||||
@ -4385,11 +4386,11 @@ static bool vulkan_frame(void *data, const void *frame,
|
||||
quad.texture = optimal;
|
||||
|
||||
if (menu_linear_filter)
|
||||
quad.sampler = (optimal->flags & VK_TEX_FLAG_MIPMAP) ?
|
||||
vk->samplers.mipmap_linear : vk->samplers.linear;
|
||||
quad.sampler = (optimal->flags & VK_TEX_FLAG_MIPMAP)
|
||||
? vk->samplers.mipmap_linear : vk->samplers.linear;
|
||||
else
|
||||
quad.sampler = (optimal->flags & VK_TEX_FLAG_MIPMAP) ?
|
||||
vk->samplers.mipmap_nearest : vk->samplers.nearest;
|
||||
quad.sampler = (optimal->flags & VK_TEX_FLAG_MIPMAP)
|
||||
? vk->samplers.mipmap_nearest : vk->samplers.nearest;
|
||||
|
||||
quad.mvp = &vk->mvp_no_rot;
|
||||
quad.color.r = 1.0f;
|
||||
@ -5594,7 +5595,7 @@ static bool vulkan_overlay_load(void *data,
|
||||
const void *image_data, unsigned num_images)
|
||||
{
|
||||
int i;
|
||||
bool old_enabled;
|
||||
bool old_enabled = false;
|
||||
const struct texture_image *images =
|
||||
(const struct texture_image*)image_data;
|
||||
vk_t *vk = (vk_t*)data;
|
||||
@ -5612,13 +5613,14 @@ static bool vulkan_overlay_load(void *data,
|
||||
#ifdef HAVE_THREADS
|
||||
slock_unlock(vk->context->queue_lock);
|
||||
#endif
|
||||
old_enabled = vk->flags & VK_FLAG_OVERLAY_ENABLE;
|
||||
if (vk->flags & VK_FLAG_OVERLAY_ENABLE)
|
||||
old_enabled = true;
|
||||
vulkan_overlay_free(vk);
|
||||
|
||||
if (!(vk->overlay.images = (struct vk_texture*)
|
||||
calloc(num_images, sizeof(*vk->overlay.images))))
|
||||
goto error;
|
||||
vk->overlay.count = num_images;
|
||||
vk->overlay.count = num_images;
|
||||
|
||||
if (!(vk->overlay.vertex = (struct vk_vertex*)
|
||||
calloc(4 * num_images, sizeof(*vk->overlay.vertex))))
|
||||
|
@ -115,7 +115,7 @@ static void android_gfx_ctx_vk_check_window(void *data, bool *quit,
|
||||
|
||||
/* Swapchains are recreated in set_resize as a
|
||||
* central place, so use that to trigger swapchain reinit. */
|
||||
*resize = and->vk.flags & VK_DATA_FLAG_NEED_NEW_SWAPCHAIN;
|
||||
*resize = (and->vk.flags & VK_DATA_FLAG_NEED_NEW_SWAPCHAIN) ? true : false;
|
||||
new_width = android_app->content_rect.width;
|
||||
new_height = android_app->content_rect.height;
|
||||
|
||||
|
@ -372,29 +372,31 @@ static void qnx_process_keyboard_event(
|
||||
qnx_input_t *qnx,
|
||||
screen_event_t event, int type)
|
||||
{
|
||||
/* Get key properties from screen event */
|
||||
int flags = 0, cap = 0, mod = 0;
|
||||
screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_FLAGS, &flags);
|
||||
screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_CAP, &cap);
|
||||
screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_MODIFIERS, &mod);
|
||||
unsigned keycode;
|
||||
bool keydown, keyrepeat;
|
||||
/* Get key properties from screen event */
|
||||
int flags = 0, cap = 0, mod = 0;
|
||||
screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_FLAGS, &flags);
|
||||
screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_CAP, &cap);
|
||||
screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_MODIFIERS, &mod);
|
||||
|
||||
/* Calculate state */
|
||||
unsigned keycode = input_keymaps_translate_keysym_to_rk(cap);
|
||||
bool keydown = flags & KEY_DOWN;
|
||||
bool keyrepeat = flags & KEY_REPEAT;
|
||||
/* Fire keyboard event */
|
||||
if (!keyrepeat)
|
||||
input_keyboard_event(keydown, keycode, 0, mod, RETRO_DEVICE_KEYBOARD);
|
||||
/* Calculate state */
|
||||
keycode = input_keymaps_translate_keysym_to_rk(cap);
|
||||
keydown = (flags & KEY_DOWN) ? true : false;
|
||||
keyrepeat = (flags & KEY_REPEAT) ? true : false;
|
||||
/* Fire keyboard event */
|
||||
if (!keyrepeat)
|
||||
input_keyboard_event(keydown, keycode, 0, mod, RETRO_DEVICE_KEYBOARD);
|
||||
|
||||
/* Apply keyboard state */
|
||||
if (keydown && !keyrepeat)
|
||||
{
|
||||
BIT_SET(qnx->keyboard_state, cap);
|
||||
}
|
||||
else if (!keydown && !keyrepeat)
|
||||
{
|
||||
BIT_CLEAR(qnx->keyboard_state, cap);
|
||||
}
|
||||
/* Apply keyboard state */
|
||||
if (keydown && !keyrepeat)
|
||||
{
|
||||
BIT_SET(qnx->keyboard_state, cap);
|
||||
}
|
||||
else if (!keydown && !keyrepeat)
|
||||
{
|
||||
BIT_CLEAR(qnx->keyboard_state, cap);
|
||||
}
|
||||
}
|
||||
|
||||
static void qnx_process_touch_event(
|
||||
@ -803,8 +805,8 @@ static int16_t qnx_input_state(
|
||||
if (binds[port][id].valid)
|
||||
{
|
||||
if (
|
||||
((id == RARCH_GAME_FOCUS_TOGGLE) ||
|
||||
!keyboard_mapping_blocked) &&
|
||||
((id == RARCH_GAME_FOCUS_TOGGLE) ||
|
||||
!keyboard_mapping_blocked) &&
|
||||
qnx_keyboard_pressed(qnx, key)
|
||||
)
|
||||
return 1;
|
||||
|
@ -91,7 +91,7 @@ void *glkitview_init(void);
|
||||
ui_window_cocoa_t cocoa_view;
|
||||
cocoa_view.data = (CocoaView*)self;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(OSX)
|
||||
video_driver_display_type_set(RARCH_DISPLAY_OSX);
|
||||
video_driver_display_set(0);
|
||||
@ -114,15 +114,15 @@ void *glkitview_init(void);
|
||||
- (bool)menuIsAtTop
|
||||
{
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
if (!(menu_st->flags & MENU_ST_FLAG_ALIVE)) // content
|
||||
if (!(menu_st->flags & MENU_ST_FLAG_ALIVE)) /* content */
|
||||
return false;
|
||||
if (menu_st->flags & MENU_ST_FLAG_INP_DLG_KB_DISPLAY) // search
|
||||
if (menu_st->flags & MENU_ST_FLAG_INP_DLG_KB_DISPLAY) /* search */
|
||||
return false;
|
||||
if (menu_st->selection_ptr != 0) // not the first item
|
||||
if (menu_st->selection_ptr != 0) /* not the first item */
|
||||
return false;
|
||||
if (menu_st->entries.list->menu_stack[0]->size != 1) // submenu
|
||||
if (menu_st->entries.list->menu_stack[0]->size != 1) /* submenu */
|
||||
return false;
|
||||
if (!string_is_equal(menu_st->entries.list->menu_stack[0]->list->label, // not on the main menu
|
||||
if (!string_is_equal(menu_st->entries.list->menu_stack[0]->list->label, /* not on the main menu */
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU)))
|
||||
return false;
|
||||
return true;
|
||||
@ -134,7 +134,7 @@ void *glkitview_init(void);
|
||||
if ([controllers count] == 1)
|
||||
return !controllers[0].extendedGamepad;
|
||||
|
||||
// are these presses that controllers send?
|
||||
/* Are these presses that controllers send? */
|
||||
if (@available(tvOS 14.3, *))
|
||||
if (type == UIPressTypePageUp || type == UIPressTypePageDown)
|
||||
return true;
|
||||
@ -216,7 +216,7 @@ void *glkitview_init(void);
|
||||
{
|
||||
for (UIPress *press in presses)
|
||||
{
|
||||
// if we're at the top it doesn't matter who pressed it, we want to leave
|
||||
/* If we're at the top it doesn't matter who pressed it, we want to leave */
|
||||
if (press.type == UIPressTypeMenu && [self menuIsAtTop])
|
||||
[super pressesBegan:presses withEvent:event];
|
||||
else if ([self didMicroGamepadPress:press.type])
|
||||
@ -368,7 +368,7 @@ void *glkitview_init(void);
|
||||
|
||||
-(void)adjustViewFrameForSafeArea
|
||||
{
|
||||
/* This is for adjusting the view frame to account for
|
||||
/* This is for adjusting the view frame to account for
|
||||
* the notch in iPhone X phones */
|
||||
if (@available(iOS 11, *))
|
||||
{
|
||||
@ -424,7 +424,7 @@ void *glkitview_init(void);
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
|
||||
{
|
||||
unsigned orientation_flags = apple_frontend_settings.orientation_flags;
|
||||
|
||||
|
||||
switch (interfaceOrientation)
|
||||
{
|
||||
case UIInterfaceOrientationPortrait:
|
||||
@ -583,7 +583,7 @@ void *glkitview_init(void);
|
||||
[servers appendString:@"\n\n"];
|
||||
if (server.bonjourServerURL != nil)
|
||||
[servers appendString:[NSString stringWithFormat:@"%@",server.bonjourServerURL]];
|
||||
|
||||
|
||||
#if TARGET_OS_TV || TARGET_OS_IOS
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (!settings->bools.gcdwebserver_alert)
|
||||
@ -626,9 +626,9 @@ void *cocoa_screen_get_chosen(void)
|
||||
NSArray *screens = [RAScreen screens];
|
||||
if (!screens || !settings)
|
||||
return NULL;
|
||||
|
||||
|
||||
monitor_index = settings->uints.video_monitor_index;
|
||||
|
||||
|
||||
if (monitor_index >= screens.count)
|
||||
return (BRIDGE void*)screens;
|
||||
return ((BRIDGE void*)[screens objectAtIndex:monitor_index]);
|
||||
@ -693,14 +693,14 @@ float cocoa_screen_get_native_scale(void)
|
||||
SEL selector;
|
||||
static CGFloat ret = 0.0f;
|
||||
RAScreen *screen = NULL;
|
||||
|
||||
|
||||
if (ret != 0.0f)
|
||||
return ret;
|
||||
if (!(screen = (BRIDGE RAScreen*)cocoa_screen_get_chosen()))
|
||||
return 0.0f;
|
||||
|
||||
|
||||
selector = NSSelectorFromString(BOXSTRING("nativeScale"));
|
||||
|
||||
|
||||
if ([screen respondsToSelector:selector])
|
||||
ret = (float)get_from_selector(
|
||||
[screen class], screen, selector, &ret);
|
||||
@ -711,7 +711,7 @@ float cocoa_screen_get_native_scale(void)
|
||||
if ([screen respondsToSelector:selector])
|
||||
ret = screen.scale;
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
@ -4838,7 +4838,7 @@ static void ui_companion_qt_toggle(void *data, bool force)
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool ui_companion_toggle = settings->bools.ui_companion_toggle;
|
||||
bool video_fullscreen = settings->bools.video_fullscreen;
|
||||
bool mouse_grabbed = input_state_get_ptr()->flags & INP_FLAG_GRAB_MOUSE_STATE;
|
||||
bool mouse_grabbed = (input_state_get_ptr()->flags & INP_FLAG_GRAB_MOUSE_STATE) ? true : false;
|
||||
|
||||
if (ui_companion_toggle || force)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user