Some refactors to make some video driver functions less dependent
on passing around the settings_t pointer
This commit is contained in:
parent
f71181d1c1
commit
f9fa557a95
|
@ -2373,11 +2373,11 @@ static bool d3d12_init_swapchain(d3d12_video_t* d3d12,
|
||||||
|
|
||||||
if (max_latency == 0)
|
if (max_latency == 0)
|
||||||
{
|
{
|
||||||
d3d12->flags |= D3D12_ST_FLAG_WAIT_FOR_VBLANK;
|
d3d12->flags |= D3D12_ST_FLAG_WAIT_FOR_VBLANK;
|
||||||
max_latency = 1;
|
max_latency = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
d3d12->flags &= ~D3D12_ST_FLAG_WAIT_FOR_VBLANK;
|
d3d12->flags &= ~D3D12_ST_FLAG_WAIT_FOR_VBLANK;
|
||||||
|
|
||||||
DXGISetMaximumFrameLatency(d3d12->chain.handle, max_latency);
|
DXGISetMaximumFrameLatency(d3d12->chain.handle, max_latency);
|
||||||
DXGIGetMaximumFrameLatency(d3d12->chain.handle, &cur_latency);
|
DXGIGetMaximumFrameLatency(d3d12->chain.handle, &cur_latency);
|
||||||
|
@ -2911,7 +2911,8 @@ static void *d3d12_gfx_init(const video_info_t* video,
|
||||||
else
|
else
|
||||||
d3d12->flags &= ~D3D12_ST_FLAG_WAITABLE_SWAPCHAINS;
|
d3d12->flags &= ~D3D12_ST_FLAG_WAITABLE_SWAPCHAINS;
|
||||||
|
|
||||||
d3d_input_driver(settings->arrays.input_driver, settings->arrays.input_joypad_driver, input, input_data);
|
d3d_input_driver(settings->arrays.input_driver,
|
||||||
|
settings->arrays.input_joypad_driver, input, input_data);
|
||||||
|
|
||||||
d3d12_init_base(d3d12);
|
d3d12_init_base(d3d12);
|
||||||
d3d12_init_descriptors(d3d12);
|
d3d12_init_descriptors(d3d12);
|
||||||
|
|
|
@ -320,7 +320,8 @@ static const GLfloat white_color[16] = {
|
||||||
*/
|
*/
|
||||||
static void gl2_set_viewport(gl2_t *gl,
|
static void gl2_set_viewport(gl2_t *gl,
|
||||||
unsigned vp_width, unsigned vp_height,
|
unsigned vp_width, unsigned vp_height,
|
||||||
bool force_full, bool allow_rotate);
|
bool force_full, bool allow_rotate,
|
||||||
|
bool video_scale_integer);
|
||||||
|
|
||||||
#ifdef IOS
|
#ifdef IOS
|
||||||
/* There is no default frame buffer on iOS. */
|
/* There is no default frame buffer on iOS. */
|
||||||
|
@ -943,9 +944,10 @@ static void gl2_raster_font_setup_viewport(
|
||||||
gl2_t *gl,
|
gl2_t *gl,
|
||||||
gl2_raster_t *font,
|
gl2_raster_t *font,
|
||||||
unsigned width, unsigned height,
|
unsigned width, unsigned height,
|
||||||
bool full_screen)
|
bool full_screen,
|
||||||
|
bool video_scale_integer)
|
||||||
{
|
{
|
||||||
gl2_set_viewport(gl, width, height, full_screen, true);
|
gl2_set_viewport(gl, width, height, full_screen, true, video_scale_integer);
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
@ -973,6 +975,7 @@ static void gl2_raster_font_render_msg(
|
||||||
gl2_t *gl = (gl2_t*)userdata;
|
gl2_t *gl = (gl2_t*)userdata;
|
||||||
unsigned width = gl->video_width;
|
unsigned width = gl->video_width;
|
||||||
unsigned height = gl->video_height;
|
unsigned height = gl->video_height;
|
||||||
|
bool video_scale_integer = config_get_ptr()->bools.video_scale_integer;
|
||||||
|
|
||||||
if (!font || string_is_empty(msg) || !gl)
|
if (!font || string_is_empty(msg) || !gl)
|
||||||
return;
|
return;
|
||||||
|
@ -1026,7 +1029,8 @@ static void gl2_raster_font_render_msg(
|
||||||
if (font->block)
|
if (font->block)
|
||||||
font->block->fullscreen = full_screen;
|
font->block->fullscreen = full_screen;
|
||||||
else
|
else
|
||||||
gl2_raster_font_setup_viewport(gl, font, width, height, full_screen);
|
gl2_raster_font_setup_viewport(gl, font, width, height, full_screen,
|
||||||
|
config_get_ptr()->bools.video_scale_integer);
|
||||||
|
|
||||||
if ( !string_is_empty(msg)
|
if ( !string_is_empty(msg)
|
||||||
&& font->font_data
|
&& font->font_data
|
||||||
|
@ -1055,7 +1059,7 @@ static void gl2_raster_font_render_msg(
|
||||||
/* Restore viewport */
|
/* Restore viewport */
|
||||||
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
gl2_set_viewport(gl, width, height, false, true);
|
gl2_set_viewport(gl, width, height, false, true, video_scale_integer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1074,18 +1078,20 @@ static void gl2_raster_font_flush_block(unsigned width, unsigned height,
|
||||||
gl2_raster_t *font = (gl2_raster_t*)data;
|
gl2_raster_t *font = (gl2_raster_t*)data;
|
||||||
video_font_raster_block_t *block = font ? font->block : NULL;
|
video_font_raster_block_t *block = font ? font->block : NULL;
|
||||||
gl2_t *gl = font ? font->gl : NULL;
|
gl2_t *gl = font ? font->gl : NULL;
|
||||||
|
bool video_scale_integer = config_get_ptr()->bools.video_scale_integer;
|
||||||
|
|
||||||
if (!font || !block || !block->carr.coords.vertices || !gl)
|
if (!font || !block || !block->carr.coords.vertices || !gl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gl2_raster_font_setup_viewport(gl, font, width, height, block->fullscreen);
|
gl2_raster_font_setup_viewport(gl, font, width, height, block->fullscreen,
|
||||||
|
video_scale_integer);
|
||||||
gl2_raster_font_draw_vertices(gl, font, (video_coords_t*)&block->carr.coords);
|
gl2_raster_font_draw_vertices(gl, font, (video_coords_t*)&block->carr.coords);
|
||||||
|
|
||||||
/* Restore viewport */
|
/* Restore viewport */
|
||||||
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
gl2_set_viewport(gl, width, height, block->fullscreen, true);
|
gl2_set_viewport(gl, width, height, block->fullscreen, true, video_scale_integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gl2_raster_font_bind_block(void *data, void *userdata)
|
static void gl2_raster_font_bind_block(void *data, void *userdata)
|
||||||
|
@ -1268,16 +1274,16 @@ static void gl2_set_projection(gl2_t *gl,
|
||||||
static void gl2_set_viewport(gl2_t *gl,
|
static void gl2_set_viewport(gl2_t *gl,
|
||||||
unsigned vp_width,
|
unsigned vp_width,
|
||||||
unsigned vp_height,
|
unsigned vp_height,
|
||||||
bool force_full, bool allow_rotate)
|
bool force_full, bool allow_rotate,
|
||||||
|
bool video_scale_integer)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
|
||||||
float device_aspect = (float)vp_width / (float)vp_height;
|
float device_aspect = (float)vp_width / (float)vp_height;
|
||||||
|
|
||||||
if (gl->ctx_driver->translate_aspect)
|
if (gl->ctx_driver->translate_aspect)
|
||||||
device_aspect = gl->ctx_driver->translate_aspect(
|
device_aspect = gl->ctx_driver->translate_aspect(
|
||||||
gl->ctx_data, vp_width, vp_height);
|
gl->ctx_data, vp_width, vp_height);
|
||||||
|
|
||||||
if (settings->bools.video_scale_integer && !force_full)
|
if (video_scale_integer && !force_full)
|
||||||
{
|
{
|
||||||
video_viewport_get_scaled_integer(&gl->vp,
|
video_viewport_get_scaled_integer(&gl->vp,
|
||||||
vp_width, vp_height,
|
vp_width, vp_height,
|
||||||
|
@ -1322,7 +1328,8 @@ static void gl2_renderchain_render(
|
||||||
gl2_renderchain_data_t *chain,
|
gl2_renderchain_data_t *chain,
|
||||||
uint64_t frame_count,
|
uint64_t frame_count,
|
||||||
const struct video_tex_info *tex_info,
|
const struct video_tex_info *tex_info,
|
||||||
const struct video_tex_info *feedback_info)
|
const struct video_tex_info *feedback_info,
|
||||||
|
bool video_scale_integer)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
video_shader_ctx_params_t params;
|
video_shader_ctx_params_t params;
|
||||||
|
@ -1379,7 +1386,8 @@ static void gl2_renderchain_render(
|
||||||
|
|
||||||
/* Render to FBO with certain size. */
|
/* Render to FBO with certain size. */
|
||||||
gl2_set_viewport(gl,
|
gl2_set_viewport(gl,
|
||||||
rect->img_width, rect->img_height, true, false);
|
rect->img_width, rect->img_height, true, false,
|
||||||
|
video_scale_integer);
|
||||||
|
|
||||||
params.data = gl;
|
params.data = gl;
|
||||||
params.width = prev_rect->img_width;
|
params.width = prev_rect->img_width;
|
||||||
|
@ -1444,8 +1452,7 @@ static void gl2_renderchain_render(
|
||||||
glGenerateMipmap(GL_TEXTURE_2D);
|
glGenerateMipmap(GL_TEXTURE_2D);
|
||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
gl2_set_viewport(gl,
|
gl2_set_viewport(gl, width, height, false, true, video_scale_integer);
|
||||||
width, height, false, true);
|
|
||||||
|
|
||||||
params.data = gl;
|
params.data = gl;
|
||||||
params.width = prev_rect->img_width;
|
params.width = prev_rect->img_width;
|
||||||
|
@ -1602,20 +1609,13 @@ static GLenum gl2_min_filter_to_mag(GLenum type)
|
||||||
|
|
||||||
static void gl2_create_fbo_texture(gl2_t *gl,
|
static void gl2_create_fbo_texture(gl2_t *gl,
|
||||||
gl2_renderchain_data_t *chain,
|
gl2_renderchain_data_t *chain,
|
||||||
unsigned i, GLuint texture)
|
unsigned i, GLuint texture,
|
||||||
|
bool video_smooth, bool force_srgb_disable)
|
||||||
{
|
{
|
||||||
GLenum mag_filter, wrap_enum;
|
GLenum mag_filter, wrap_enum;
|
||||||
enum gfx_wrap_type wrap_type;
|
enum gfx_wrap_type wrap_type;
|
||||||
bool fp_fbo = false;
|
bool fp_fbo = false;
|
||||||
bool smooth = false;
|
bool smooth = false;
|
||||||
settings_t *settings = config_get_ptr();
|
|
||||||
bool video_smooth = settings->bools.video_smooth;
|
|
||||||
#if HAVE_ODROIDGO2
|
|
||||||
bool video_ctx_scaling = settings->bools.video_ctx_scaling;
|
|
||||||
if (video_ctx_scaling)
|
|
||||||
video_smooth = false;
|
|
||||||
#endif
|
|
||||||
bool force_srgb_disable = settings->bools.video_force_srgb_disable;
|
|
||||||
GLuint base_filt = video_smooth ? GL_LINEAR : GL_NEAREST;
|
GLuint base_filt = video_smooth ? GL_LINEAR : GL_NEAREST;
|
||||||
GLuint base_mip_filt = video_smooth ?
|
GLuint base_mip_filt = video_smooth ?
|
||||||
GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST;
|
GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST;
|
||||||
|
@ -1719,20 +1719,29 @@ static void gl2_create_fbo_textures(gl2_t *gl,
|
||||||
gl2_renderchain_data_t *chain)
|
gl2_renderchain_data_t *chain)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
#if HAVE_ODROIDGO2
|
||||||
|
bool video_smooth = settings->bools.video_ctx_scaling ? false : settings->bools.video_smooth;
|
||||||
|
#else
|
||||||
|
bool video_smooth = settings->bools.video_smooth;
|
||||||
|
#endif
|
||||||
|
bool force_srgb_disable = settings->bools.video_force_srgb_disable;
|
||||||
|
|
||||||
glGenTextures(chain->fbo_pass, chain->fbo_texture);
|
glGenTextures(chain->fbo_pass, chain->fbo_texture);
|
||||||
|
|
||||||
for (i = 0; i < chain->fbo_pass; i++)
|
for (i = 0; i < chain->fbo_pass; i++)
|
||||||
gl2_create_fbo_texture(gl,
|
gl2_create_fbo_texture(gl,
|
||||||
(gl2_renderchain_data_t*)gl->renderchain_data,
|
(gl2_renderchain_data_t*)gl->renderchain_data,
|
||||||
i, chain->fbo_texture[i]);
|
i, chain->fbo_texture[i],
|
||||||
|
video_smooth, force_srgb_disable);
|
||||||
|
|
||||||
if (gl->flags & GL2_FLAG_FBO_FEEDBACK_ENABLE)
|
if (gl->flags & GL2_FLAG_FBO_FEEDBACK_ENABLE)
|
||||||
{
|
{
|
||||||
glGenTextures(1, &gl->fbo_feedback_texture);
|
glGenTextures(1, &gl->fbo_feedback_texture);
|
||||||
gl2_create_fbo_texture(gl,
|
gl2_create_fbo_texture(gl,
|
||||||
(gl2_renderchain_data_t*)gl->renderchain_data,
|
(gl2_renderchain_data_t*)gl->renderchain_data,
|
||||||
gl->fbo_feedback_pass, gl->fbo_feedback_texture);
|
gl->fbo_feedback_pass, gl->fbo_feedback_texture,
|
||||||
|
video_smooth, force_srgb_disable);
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
@ -1842,9 +1851,8 @@ static void gl2_renderchain_recompute_pass_sizes(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gl2_renderchain_start_render(
|
static void gl2_renderchain_start_render(gl2_t *gl,
|
||||||
gl2_t *gl,
|
gl2_renderchain_data_t *chain, bool video_scale_integer)
|
||||||
gl2_renderchain_data_t *chain)
|
|
||||||
{
|
{
|
||||||
/* Used when rendering to an FBO.
|
/* Used when rendering to an FBO.
|
||||||
* Texture coords have to be aligned
|
* Texture coords have to be aligned
|
||||||
|
@ -1860,7 +1868,8 @@ static void gl2_renderchain_start_render(
|
||||||
|
|
||||||
gl2_set_viewport(gl,
|
gl2_set_viewport(gl,
|
||||||
gl->fbo_rect[0].img_width,
|
gl->fbo_rect[0].img_width,
|
||||||
gl->fbo_rect[0].img_height, true, false);
|
gl->fbo_rect[0].img_height, true, false,
|
||||||
|
video_scale_integer);
|
||||||
|
|
||||||
/* Need to preserve the "flipped" state when in FBO
|
/* Need to preserve the "flipped" state when in FBO
|
||||||
* as well to have consistent texture coordinates.
|
* as well to have consistent texture coordinates.
|
||||||
|
@ -2759,7 +2768,10 @@ static void gl2_set_viewport_wrapper(void *data, unsigned vp_width,
|
||||||
unsigned vp_height, bool force_full, bool allow_rotate)
|
unsigned vp_height, bool force_full, bool allow_rotate)
|
||||||
{
|
{
|
||||||
gl2_t *gl = (gl2_t*)data;
|
gl2_t *gl = (gl2_t*)data;
|
||||||
gl2_set_viewport(gl, vp_width, vp_height, force_full, allow_rotate);
|
gl2_set_viewport(gl,
|
||||||
|
vp_width, vp_height, force_full, allow_rotate,
|
||||||
|
config_get_ptr()->bools.video_scale_integer
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Shaders */
|
/* Shaders */
|
||||||
|
@ -3084,7 +3096,7 @@ static void gl2_init_textures(gl2_t *gl)
|
||||||
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE void gl2_set_shader_viewports(gl2_t *gl)
|
static INLINE void gl2_set_shader_viewports(gl2_t *gl, bool video_scale_integer)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned width = gl->video_width;
|
unsigned width = gl->video_width;
|
||||||
|
@ -3093,7 +3105,8 @@ static INLINE void gl2_set_shader_viewports(gl2_t *gl)
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
gl->shader->use(gl, gl->shader_data, i, true);
|
gl->shader->use(gl, gl->shader_data, i, true);
|
||||||
gl2_set_viewport(gl, width, height, false, true);
|
gl2_set_viewport(gl, width, height, false, true,
|
||||||
|
video_scale_integer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3147,7 +3160,7 @@ static void gl2_set_texture_enable(void *data, bool state, bool full_screen)
|
||||||
gl->flags &= ~GL2_FLAG_MENU_TEXTURE_FULLSCREEN;
|
gl->flags &= ~GL2_FLAG_MENU_TEXTURE_FULLSCREEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gl2_render_osd_background(gl2_t *gl, const char *msg)
|
static void gl2_render_osd_background(gl2_t *gl, bool video_scale_integer, const char *msg)
|
||||||
{
|
{
|
||||||
video_coords_t coords;
|
video_coords_t coords;
|
||||||
struct uniform_info uniform_param;
|
struct uniform_info uniform_param;
|
||||||
|
@ -3174,9 +3187,9 @@ static void gl2_render_osd_background(gl2_t *gl, const char *msg)
|
||||||
width += x2;
|
width += x2;
|
||||||
height += y2;
|
height += y2;
|
||||||
|
|
||||||
colors[0] = settings->uints.video_msg_bgcolor_red / 255.0f;
|
colors[0] = settings->uints.video_msg_bgcolor_red / 255.0f;
|
||||||
colors[1] = settings->uints.video_msg_bgcolor_green / 255.0f;
|
colors[1] = settings->uints.video_msg_bgcolor_green / 255.0f;
|
||||||
colors[2] = settings->uints.video_msg_bgcolor_blue / 255.0f;
|
colors[2] = settings->uints.video_msg_bgcolor_blue / 255.0f;
|
||||||
colors[3] = settings->floats.video_msg_bgcolor_opacity;
|
colors[3] = settings->floats.video_msg_bgcolor_opacity;
|
||||||
|
|
||||||
/* triangle 1 */
|
/* triangle 1 */
|
||||||
|
@ -3207,7 +3220,8 @@ static void gl2_render_osd_background(gl2_t *gl, const char *msg)
|
||||||
|
|
||||||
gl2_set_viewport(gl,
|
gl2_set_viewport(gl,
|
||||||
gl->video_width,
|
gl->video_width,
|
||||||
gl->video_height, true, false);
|
gl->video_height, true, false,
|
||||||
|
video_scale_integer);
|
||||||
|
|
||||||
gl->shader->use(gl, gl->shader_data,
|
gl->shader->use(gl, gl->shader_data,
|
||||||
VIDEO_SHADER_STOCK_BLEND, true);
|
VIDEO_SHADER_STOCK_BLEND, true);
|
||||||
|
@ -3255,7 +3269,7 @@ static void gl2_render_osd_background(gl2_t *gl, const char *msg)
|
||||||
|
|
||||||
gl2_set_viewport(gl,
|
gl2_set_viewport(gl,
|
||||||
gl->video_width,
|
gl->video_width,
|
||||||
gl->video_height, false, true);
|
gl->video_height, false, true, video_scale_integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gl2_show_mouse(void *data, bool state)
|
static void gl2_show_mouse(void *data, bool state)
|
||||||
|
@ -3384,6 +3398,7 @@ static bool gl2_frame(void *data, const void *frame,
|
||||||
bool widgets_active = video_info->widgets_active;
|
bool widgets_active = video_info->widgets_active;
|
||||||
#endif
|
#endif
|
||||||
bool overlay_behind_menu = video_info->overlay_behind_menu;
|
bool overlay_behind_menu = video_info->overlay_behind_menu;
|
||||||
|
bool video_scale_integer = config_get_ptr()->bools.video_scale_integer;
|
||||||
|
|
||||||
if (!gl)
|
if (!gl)
|
||||||
return false;
|
return false;
|
||||||
|
@ -3400,7 +3415,7 @@ static bool gl2_frame(void *data, const void *frame,
|
||||||
|
|
||||||
#ifdef IOS
|
#ifdef IOS
|
||||||
/* Apparently the viewport is lost each frame, thanks Apple. */
|
/* Apparently the viewport is lost each frame, thanks Apple. */
|
||||||
gl2_set_viewport(gl, width, height, false, true);
|
gl2_set_viewport(gl, width, height, false, true, video_scale_integer);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Render to texture in first pass. */
|
/* Render to texture in first pass. */
|
||||||
|
@ -3411,7 +3426,7 @@ static bool gl2_frame(void *data, const void *frame,
|
||||||
frame_width, frame_height,
|
frame_width, frame_height,
|
||||||
gl->out_vp_width, gl->out_vp_height);
|
gl->out_vp_width, gl->out_vp_height);
|
||||||
|
|
||||||
gl2_renderchain_start_render(gl, chain);
|
gl2_renderchain_start_render(gl, chain, video_scale_integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gl->flags & GL2_FLAG_SHOULD_RESIZE)
|
if (gl->flags & GL2_FLAG_SHOULD_RESIZE)
|
||||||
|
@ -3472,10 +3487,10 @@ static bool gl2_frame(void *data, const void *frame,
|
||||||
|
|
||||||
/* Go back to what we're supposed to do,
|
/* Go back to what we're supposed to do,
|
||||||
* render to FBO #0. */
|
* render to FBO #0. */
|
||||||
gl2_renderchain_start_render(gl, chain);
|
gl2_renderchain_start_render(gl, chain, video_scale_integer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gl2_set_viewport(gl, width, height, false, true);
|
gl2_set_viewport(gl, width, height, false, true, video_scale_integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame)
|
if (frame)
|
||||||
|
@ -3509,7 +3524,7 @@ static bool gl2_frame(void *data, const void *frame,
|
||||||
if (!(gl->flags & GL2_FLAG_FBO_INITED))
|
if (!(gl->flags & GL2_FLAG_FBO_INITED))
|
||||||
{
|
{
|
||||||
gl2_renderchain_bind_backbuffer();
|
gl2_renderchain_bind_backbuffer();
|
||||||
gl2_set_viewport(gl, width, height, false, true);
|
gl2_set_viewport(gl, width, height, false, true, video_scale_integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
gl2_renderchain_restore_default_state(gl);
|
gl2_renderchain_restore_default_state(gl);
|
||||||
|
@ -3573,7 +3588,8 @@ static bool gl2_frame(void *data, const void *frame,
|
||||||
if (gl->flags & GL2_FLAG_FBO_INITED)
|
if (gl->flags & GL2_FLAG_FBO_INITED)
|
||||||
gl2_renderchain_render(gl,
|
gl2_renderchain_render(gl,
|
||||||
chain,
|
chain,
|
||||||
frame_count, &gl->tex_info, &feedback_info);
|
frame_count, &gl->tex_info, &feedback_info,
|
||||||
|
video_scale_integer);
|
||||||
|
|
||||||
/* Set prev textures. */
|
/* Set prev textures. */
|
||||||
gl2_renderchain_bind_prev_texture(gl,
|
gl2_renderchain_bind_prev_texture(gl,
|
||||||
|
@ -3613,7 +3629,7 @@ static bool gl2_frame(void *data, const void *frame,
|
||||||
if (!string_is_empty(msg))
|
if (!string_is_empty(msg))
|
||||||
{
|
{
|
||||||
if (msg_bgcolor_enable)
|
if (msg_bgcolor_enable)
|
||||||
gl2_render_osd_background(gl, msg);
|
gl2_render_osd_background(gl, video_scale_integer, msg);
|
||||||
font_driver_render_msg(gl, msg, NULL, NULL);
|
font_driver_render_msg(gl, msg, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4193,6 +4209,7 @@ static void *gl2_init(const video_info_t *video,
|
||||||
unsigned shader_info_num;
|
unsigned shader_info_num;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
bool video_gpu_record = settings->bools.video_gpu_record;
|
bool video_gpu_record = settings->bools.video_gpu_record;
|
||||||
|
bool video_scale_integer = settings->bools.video_scale_integer;
|
||||||
int interval = 0;
|
int interval = 0;
|
||||||
unsigned mip_level = 0;
|
unsigned mip_level = 0;
|
||||||
unsigned mode_width = 0;
|
unsigned mode_width = 0;
|
||||||
|
@ -4501,7 +4518,7 @@ static void *gl2_init(const video_info_t *video,
|
||||||
#endif
|
#endif
|
||||||
/* Apparently need to set viewport for passes
|
/* Apparently need to set viewport for passes
|
||||||
* when we aren't using FBOs. */
|
* when we aren't using FBOs. */
|
||||||
gl2_set_shader_viewports(gl);
|
gl2_set_shader_viewports(gl, video_scale_integer);
|
||||||
|
|
||||||
mip_level = 1;
|
mip_level = 1;
|
||||||
if (gl->shader->mipmap_input(gl->shader_data, mip_level))
|
if (gl->shader->mipmap_input(gl->shader_data, mip_level))
|
||||||
|
@ -4657,20 +4674,13 @@ static bool gl2_suppress_screensaver(void *data, bool enable)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gl2_update_tex_filter_frame(gl2_t *gl)
|
static void gl2_update_tex_filter_frame(gl2_t *gl, bool video_smooth)
|
||||||
{
|
{
|
||||||
unsigned i, mip_level;
|
unsigned i, mip_level;
|
||||||
GLenum wrap_mode;
|
GLenum wrap_mode;
|
||||||
GLuint new_filt;
|
GLuint new_filt;
|
||||||
enum gfx_wrap_type wrap_type;
|
enum gfx_wrap_type wrap_type;
|
||||||
bool smooth = false;
|
bool smooth = false;
|
||||||
settings_t *settings = config_get_ptr();
|
|
||||||
bool video_smooth = settings->bools.video_smooth;
|
|
||||||
#ifdef HAVE_ODROIDGO2
|
|
||||||
bool video_ctx_scaling = settings->bools.video_ctx_scaling;
|
|
||||||
if (video_ctx_scaling)
|
|
||||||
video_smooth = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (gl->flags & GL2_FLAG_SHARED_CONTEXT_USE)
|
if (gl->flags & GL2_FLAG_SHARED_CONTEXT_USE)
|
||||||
gl->ctx_driver->bind_hw_render(gl->ctx_data, false);
|
gl->ctx_driver->bind_hw_render(gl->ctx_data, false);
|
||||||
|
@ -4719,7 +4729,14 @@ static bool gl2_set_shader(void *data,
|
||||||
unsigned textures;
|
unsigned textures;
|
||||||
video_shader_ctx_init_t init_data;
|
video_shader_ctx_init_t init_data;
|
||||||
enum rarch_shader_type fallback;
|
enum rarch_shader_type fallback;
|
||||||
gl2_t *gl = (gl2_t*)data;
|
gl2_t *gl = (gl2_t*)data;
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
bool video_scale_integer = settings->bools.video_scale_integer;
|
||||||
|
#ifdef HAVE_ODROIDGO2
|
||||||
|
bool video_smooth = settings->bools.video_ctx_scaling ? false : settings->bools.video_smooth;
|
||||||
|
#else
|
||||||
|
bool video_smooth = settings->bools.video_smooth;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!gl)
|
if (!gl)
|
||||||
return false;
|
return false;
|
||||||
|
@ -4777,7 +4794,7 @@ static bool gl2_set_shader(void *data,
|
||||||
gl->shader = init_data.shader;
|
gl->shader = init_data.shader;
|
||||||
gl->shader_data = init_data.shader_data;
|
gl->shader_data = init_data.shader_data;
|
||||||
|
|
||||||
gl2_update_tex_filter_frame(gl);
|
gl2_update_tex_filter_frame(gl, video_smooth);
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned texture_info_id = gl->shader->get_prev_textures(gl->shader_data);
|
unsigned texture_info_id = gl->shader->get_prev_textures(gl->shader_data);
|
||||||
|
@ -4812,7 +4829,7 @@ static bool gl2_set_shader(void *data,
|
||||||
gl->tex_w, gl->tex_h);
|
gl->tex_w, gl->tex_h);
|
||||||
|
|
||||||
/* Apparently need to set viewport for passes when we aren't using FBOs. */
|
/* Apparently need to set viewport for passes when we aren't using FBOs. */
|
||||||
gl2_set_shader_viewports(gl);
|
gl2_set_shader_viewports(gl, video_scale_integer);
|
||||||
if (gl->flags & GL2_FLAG_SHARED_CONTEXT_USE)
|
if (gl->flags & GL2_FLAG_SHARED_CONTEXT_USE)
|
||||||
gl->ctx_driver->bind_hw_render(gl->ctx_data, true);
|
gl->ctx_driver->bind_hw_render(gl->ctx_data, true);
|
||||||
|
|
||||||
|
|
|
@ -3257,19 +3257,15 @@ static void vulkan_init_hw_render(vk_t *vk)
|
||||||
iface->get_instance_proc_addr = vulkan_symbol_wrapper_instance_proc_addr();
|
iface->get_instance_proc_addr = vulkan_symbol_wrapper_instance_proc_addr();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vulkan_init_readback(vk_t *vk, settings_t *settings)
|
static void vulkan_init_readback(vk_t *vk, bool video_gpu_record)
|
||||||
{
|
{
|
||||||
/* Only bother with this if we're doing GPU recording.
|
/* Only bother with this if we're doing GPU recording.
|
||||||
* Check recording_st->enable and not
|
* Check rec_st->enable and not driver.recording_data,
|
||||||
* driver.recording_data, because recording is
|
* because recording is not initialized yet.
|
||||||
* not initialized yet.
|
|
||||||
*/
|
*/
|
||||||
recording_state_t
|
recording_state_t *rec_st = recording_state_get_ptr();
|
||||||
*recording_st = recording_state_get_ptr();
|
|
||||||
bool recording_enabled = recording_st->enable;
|
|
||||||
bool video_gpu_record = settings->bools.video_gpu_record;
|
|
||||||
|
|
||||||
if (!(video_gpu_record && recording_enabled))
|
if (!(video_gpu_record && rec_st->enable))
|
||||||
{
|
{
|
||||||
vk->flags &= ~VK_FLAG_READBACK_STREAMED;
|
vk->flags &= ~VK_FLAG_READBACK_STREAMED;
|
||||||
return;
|
return;
|
||||||
|
@ -3335,10 +3331,10 @@ static void *vulkan_init(const video_info_t *video,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VULKAN_HDR_SWAPCHAIN
|
#ifdef VULKAN_HDR_SWAPCHAIN
|
||||||
vk->hdr.max_output_nits = settings->floats.video_hdr_max_nits;
|
vk->hdr.max_output_nits = settings->floats.video_hdr_max_nits;
|
||||||
vk->hdr.min_output_nits = 0.001f;
|
vk->hdr.min_output_nits = 0.001f;
|
||||||
vk->hdr.max_cll = 0.0f;
|
vk->hdr.max_cll = 0.0f;
|
||||||
vk->hdr.max_fall = 0.0f;
|
vk->hdr.max_fall = 0.0f;
|
||||||
#endif /* VULKAN_HDR_SWAPCHAIN */
|
#endif /* VULKAN_HDR_SWAPCHAIN */
|
||||||
|
|
||||||
vk->video = *video;
|
vk->video = *video;
|
||||||
|
@ -3552,7 +3548,7 @@ static void *vulkan_init(const video_info_t *video,
|
||||||
is the simplest solution unless reinit tracking is done */
|
is the simplest solution unless reinit tracking is done */
|
||||||
vk->flags |= VK_FLAG_SHOULD_RESIZE;
|
vk->flags |= VK_FLAG_SHOULD_RESIZE;
|
||||||
|
|
||||||
vulkan_init_readback(vk, settings);
|
vulkan_init_readback(vk, settings->bools.video_gpu_record);
|
||||||
return vk;
|
return vk;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
@ -3830,8 +3826,7 @@ static void vulkan_set_viewport(void *data, unsigned vp_width,
|
||||||
{
|
{
|
||||||
float device_aspect = (float)vp_width / vp_height;
|
float device_aspect = (float)vp_width / vp_height;
|
||||||
struct video_ortho ortho = {0, 1, 0, 1, -1, 1};
|
struct video_ortho ortho = {0, 1, 0, 1, -1, 1};
|
||||||
settings_t *settings = config_get_ptr();
|
bool video_scale_integer = config_get_ptr()->bools.video_scale_integer;
|
||||||
bool video_scale_integer = settings->bools.video_scale_integer;
|
|
||||||
vk_t *vk = (vk_t*)data;
|
vk_t *vk = (vk_t*)data;
|
||||||
|
|
||||||
if (vk->ctx_driver->translate_aspect)
|
if (vk->ctx_driver->translate_aspect)
|
||||||
|
|
Loading…
Reference in New Issue