mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 04:20:27 +00:00
Move frame_cache from global state to video driver state
This commit is contained in:
parent
63aa834414
commit
b363060262
@ -39,6 +39,14 @@ typedef struct video_driver_state
|
|||||||
unsigned video_height;
|
unsigned video_height;
|
||||||
float aspect_ratio;
|
float aspect_ratio;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
const void *data;
|
||||||
|
unsigned width;
|
||||||
|
unsigned height;
|
||||||
|
size_t pitch;
|
||||||
|
} frame_cache;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
rarch_softfilter_t *filter;
|
rarch_softfilter_t *filter;
|
||||||
@ -870,7 +878,6 @@ bool video_driver_frame(const void *frame, unsigned width,
|
|||||||
void video_driver_cached_frame(void)
|
void video_driver_cached_frame(void)
|
||||||
{
|
{
|
||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
global_t *global = global_get_ptr();
|
|
||||||
runloop_t *runloop = rarch_main_get_ptr();
|
runloop_t *runloop = rarch_main_get_ptr();
|
||||||
void *recording = driver ? driver->recording_data : NULL;
|
void *recording = driver ? driver->recording_data : NULL;
|
||||||
|
|
||||||
@ -886,61 +893,50 @@ void video_driver_cached_frame(void)
|
|||||||
*/
|
*/
|
||||||
if (driver->retro_ctx.frame_cb)
|
if (driver->retro_ctx.frame_cb)
|
||||||
driver->retro_ctx.frame_cb(
|
driver->retro_ctx.frame_cb(
|
||||||
(global->frame_cache.data == RETRO_HW_FRAME_BUFFER_VALID)
|
(video_state.frame_cache.data == RETRO_HW_FRAME_BUFFER_VALID)
|
||||||
? NULL : global->frame_cache.data,
|
? NULL : video_state.frame_cache.data,
|
||||||
global->frame_cache.width,
|
video_state.frame_cache.width,
|
||||||
global->frame_cache.height,
|
video_state.frame_cache.height,
|
||||||
global->frame_cache.pitch);
|
video_state.frame_cache.pitch);
|
||||||
|
|
||||||
driver->recording_data = recording;
|
driver->recording_data = recording;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool video_driver_cached_frame_has_valid_fb(void)
|
bool video_driver_cached_frame_has_valid_fb(void)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
if (!video_state.frame_cache.data)
|
||||||
|
|
||||||
if (!global || global->frame_cache.data)
|
|
||||||
return false;
|
return false;
|
||||||
return (global->frame_cache.data == RETRO_HW_FRAME_BUFFER_VALID);
|
return (video_state.frame_cache.data == RETRO_HW_FRAME_BUFFER_VALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void video_driver_cached_frame_set_ptr(const void *data)
|
void video_driver_cached_frame_set_ptr(const void *data)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
if (!data)
|
||||||
|
|
||||||
if (!global || !data)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
global->frame_cache.data = data;
|
video_state.frame_cache.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void video_driver_cached_frame_set(const void *data, unsigned width,
|
void video_driver_cached_frame_set(const void *data, unsigned width,
|
||||||
unsigned height, size_t pitch)
|
unsigned height, size_t pitch)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
video_state.frame_cache.data = data;
|
||||||
|
video_state.frame_cache.width = width;
|
||||||
if (!global)
|
video_state.frame_cache.height = height;
|
||||||
return;
|
video_state.frame_cache.pitch = pitch;
|
||||||
|
|
||||||
global->frame_cache.data = data;
|
|
||||||
|
|
||||||
global->frame_cache.width = width;
|
|
||||||
global->frame_cache.height = height;
|
|
||||||
global->frame_cache.pitch = pitch;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void video_driver_cached_frame_get(const void *data, unsigned *width,
|
void video_driver_cached_frame_get(const void *data, unsigned *width,
|
||||||
unsigned *height, size_t *pitch)
|
unsigned *height, size_t *pitch)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
if (data)
|
||||||
|
data = video_state.frame_cache.data;
|
||||||
if (!global)
|
if (width)
|
||||||
return;
|
*width = video_state.frame_cache.width;
|
||||||
|
if (height)
|
||||||
data = global->frame_cache.data;
|
*height = video_state.frame_cache.height;
|
||||||
*width = global->frame_cache.width;
|
if (pitch)
|
||||||
*height = global->frame_cache.height;
|
*pitch = video_state.frame_cache.pitch;
|
||||||
*pitch = global->frame_cache.pitch;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void video_driver_get_size(unsigned *width, unsigned *height)
|
void video_driver_get_size(unsigned *width, unsigned *height)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user