mirror of
https://github.com/libretro/RetroArch
synced 2025-04-24 06:02:36 +00:00
(video_driver.c) Turn some variables into local static variables
This commit is contained in:
parent
8e0fcc663b
commit
830b3052e5
@ -75,19 +75,6 @@ typedef struct video_pixel_scaler
|
|||||||
void *scaler_out;
|
void *scaler_out;
|
||||||
} video_pixel_scaler_t;
|
} video_pixel_scaler_t;
|
||||||
|
|
||||||
static bool video_driver_active;
|
|
||||||
|
|
||||||
/* Last message given to the video driver */
|
|
||||||
static char video_driver_current_msg[PATH_MAX_LENGTH];
|
|
||||||
|
|
||||||
/* If set during context deinit, the driver should keep
|
|
||||||
* graphics context alive to avoid having to reset all
|
|
||||||
* context state. */
|
|
||||||
static bool video_driver_cache_context;
|
|
||||||
|
|
||||||
/* Set to true by driver if context caching succeeded. */
|
|
||||||
static bool video_driver_cache_context_ack;
|
|
||||||
|
|
||||||
/* Opaque handles to currently running window.
|
/* Opaque handles to currently running window.
|
||||||
* Used by e.g. input drivers which bind to a window.
|
* Used by e.g. input drivers which bind to a window.
|
||||||
* Drivers are responsible for setting these if an input driver
|
* Drivers are responsible for setting these if an input driver
|
||||||
@ -96,24 +83,14 @@ static uintptr_t video_driver_display;
|
|||||||
static uintptr_t video_driver_window;
|
static uintptr_t video_driver_window;
|
||||||
static enum rarch_display_type video_driver_display_type;
|
static enum rarch_display_type video_driver_display_type;
|
||||||
|
|
||||||
/* Graphics driver requires RGBA byte order data (ABGR on little-endian)
|
|
||||||
* for 32-bit.
|
|
||||||
* This takes effect for overlay and shader cores that wants to load
|
|
||||||
* data into graphics driver. Kinda hackish to place it here, it is only
|
|
||||||
* used for GLES.
|
|
||||||
* TODO: Refactor this better. */
|
|
||||||
static bool video_driver_use_rgba;
|
|
||||||
|
|
||||||
static uint64_t video_driver_frame_count;
|
static uint64_t video_driver_frame_count;
|
||||||
|
|
||||||
static void *video_driver_data;
|
static void *video_driver_data;
|
||||||
static bool video_driver_data_own;
|
|
||||||
static const video_driver_t *current_video;
|
static const video_driver_t *current_video;
|
||||||
|
|
||||||
/* Interface for "poking". */
|
/* Interface for "poking". */
|
||||||
static const video_poke_interface_t *video_driver_poke;
|
static const video_poke_interface_t *video_driver_poke;
|
||||||
|
|
||||||
static struct retro_system_av_info video_viewport_av_info;
|
|
||||||
static video_driver_state_t video_driver_state;
|
static video_driver_state_t video_driver_state;
|
||||||
|
|
||||||
/* Used for 16-bit -> 16-bit conversions that take place before
|
/* Used for 16-bit -> 16-bit conversions that take place before
|
||||||
@ -546,9 +523,10 @@ static bool uninit_video_input(void)
|
|||||||
input_driver_ctl(RARCH_INPUT_CTL_DEINIT, NULL);
|
input_driver_ctl(RARCH_INPUT_CTL_DEINIT, NULL);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!video_driver_data_own &&
|
!video_driver_ctl(RARCH_DISPLAY_CTL_OWNS_DRIVER, NULL)
|
||||||
video_driver_data &&
|
&& video_driver_data
|
||||||
current_video->free)
|
&& current_video->free
|
||||||
|
)
|
||||||
current_video->free(video_driver_data);
|
current_video->free(video_driver_data);
|
||||||
|
|
||||||
deinit_pixel_converter();
|
deinit_pixel_converter();
|
||||||
@ -559,13 +537,13 @@ static bool uninit_video_input(void)
|
|||||||
event_command(EVENT_CMD_SHADER_DIR_DEINIT);
|
event_command(EVENT_CMD_SHADER_DIR_DEINIT);
|
||||||
video_monitor_compute_fps_statistics();
|
video_monitor_compute_fps_statistics();
|
||||||
|
|
||||||
if (hw_render->context_destroy && !video_driver_cache_context)
|
if (hw_render->context_destroy && !video_driver_ctl(RARCH_DISPLAY_CTL_IS_VIDEO_CACHE_CONTEXT, NULL))
|
||||||
hw_render->context_destroy();
|
hw_render->context_destroy();
|
||||||
|
|
||||||
video_driver_ctl(RARCH_DISPLAY_CTL_UNSET_RGBA, NULL);
|
video_driver_ctl(RARCH_DISPLAY_CTL_UNSET_RGBA, NULL);
|
||||||
current_video = NULL;
|
current_video = NULL;
|
||||||
|
|
||||||
if (!video_driver_data_own)
|
if (!video_driver_ctl(RARCH_DISPLAY_CTL_OWNS_DRIVER, NULL))
|
||||||
video_driver_data = NULL;
|
video_driver_data = NULL;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1412,6 +1390,21 @@ static bool video_viewport_set_config(void)
|
|||||||
|
|
||||||
bool video_driver_ctl(enum rarch_display_ctl_state state, void *data)
|
bool video_driver_ctl(enum rarch_display_ctl_state state, void *data)
|
||||||
{
|
{
|
||||||
|
/* Graphics driver requires RGBA byte order data (ABGR on little-endian)
|
||||||
|
* for 32-bit.
|
||||||
|
* This takes effect for overlay and shader cores that wants to load
|
||||||
|
* data into graphics driver. Kinda hackish to place it here, it is only
|
||||||
|
* used for GLES.
|
||||||
|
* TODO: Refactor this better. */
|
||||||
|
static bool video_driver_use_rgba = false;
|
||||||
|
static bool video_driver_data_own = false;
|
||||||
|
static bool video_driver_active = false;
|
||||||
|
/* If set during context deinit, the driver should keep
|
||||||
|
* graphics context alive to avoid having to reset all
|
||||||
|
* context state. */
|
||||||
|
static bool video_driver_cache_context = false;
|
||||||
|
/* Set to true by driver if context caching succeeded. */
|
||||||
|
static bool video_driver_cache_context_ack = false;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
const struct retro_hw_render_callback *hw_render =
|
const struct retro_hw_render_callback *hw_render =
|
||||||
(const struct retro_hw_render_callback*)video_driver_callback();
|
(const struct retro_hw_render_callback*)video_driver_callback();
|
||||||
@ -1765,7 +1758,9 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
|
|||||||
|
|
||||||
struct retro_system_av_info *video_viewport_get_system_av_info(void)
|
struct retro_system_av_info *video_viewport_get_system_av_info(void)
|
||||||
{
|
{
|
||||||
return (struct retro_system_av_info*)&video_viewport_av_info;
|
static struct retro_system_av_info av_info;
|
||||||
|
|
||||||
|
return &av_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct video_viewport *video_viewport_get_custom(void)
|
struct video_viewport *video_viewport_get_custom(void)
|
||||||
@ -1827,6 +1822,8 @@ static bool video_pixel_frame_scale(const void *data,
|
|||||||
void video_driver_frame(const void *data, unsigned width,
|
void video_driver_frame(const void *data, unsigned width,
|
||||||
unsigned height, size_t pitch)
|
unsigned height, size_t pitch)
|
||||||
{
|
{
|
||||||
|
/* Last message given to the video driver */
|
||||||
|
static char video_driver_current_msg[PATH_MAX_LENGTH];
|
||||||
unsigned output_width = 0;
|
unsigned output_width = 0;
|
||||||
unsigned output_height = 0;
|
unsigned output_height = 0;
|
||||||
unsigned output_pitch = 0;
|
unsigned output_pitch = 0;
|
||||||
@ -1834,7 +1831,7 @@ void video_driver_frame(const void *data, unsigned width,
|
|||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
if (!video_driver_active)
|
if (!video_driver_ctl(RARCH_DISPLAY_CTL_IS_ACTIVE, NULL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (video_driver_scaler_ptr &&
|
if (video_driver_scaler_ptr &&
|
||||||
@ -1879,7 +1876,7 @@ void video_driver_frame(const void *data, unsigned width,
|
|||||||
if (!current_video || !current_video->frame(
|
if (!current_video || !current_video->frame(
|
||||||
video_driver_data, data, width, height, video_driver_frame_count,
|
video_driver_data, data, width, height, video_driver_frame_count,
|
||||||
pitch, video_driver_current_msg))
|
pitch, video_driver_current_msg))
|
||||||
video_driver_active = false;
|
video_driver_ctl(RARCH_DISPLAY_CTL_UNSET_ACTIVE, NULL);
|
||||||
|
|
||||||
video_driver_frame_count++;
|
video_driver_frame_count++;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user