mirror of
https://github.com/libretro/RetroArch
synced 2024-07-08 20:25:47 +00:00
Move pix_fmt to video_state
This commit is contained in:
parent
197820c797
commit
d2b76a7d13
|
@ -692,7 +692,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||
return false;
|
||||
}
|
||||
|
||||
global->system.pix_fmt = pix_fmt;
|
||||
video_driver_set_pixel_format(pix_fmt);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -357,7 +357,7 @@ static void *psp_init(const video_info_t *video,
|
|||
psp->bpp_log2 = 1;
|
||||
|
||||
pixel_format =
|
||||
(global->system.pix_fmt == RETRO_PIXEL_FORMAT_0RGB1555)
|
||||
(video_driver_get_pixel_format() == RETRO_PIXEL_FORMAT_0RGB1555)
|
||||
? GU_PSM_5551 : GU_PSM_5650 ;
|
||||
|
||||
lut_pixel_format = GU_PSM_T16;
|
||||
|
|
|
@ -33,6 +33,7 @@ typedef struct video_driver_state
|
|||
retro_time_t frame_time_samples[MEASURE_FRAME_TIME_SAMPLES_COUNT];
|
||||
struct retro_hw_render_callback hw_render_callback;
|
||||
uint64_t frame_time_samples_count;
|
||||
enum retro_pixel_format pix_fmt;
|
||||
|
||||
unsigned video_width;
|
||||
unsigned video_height;
|
||||
|
@ -483,7 +484,7 @@ void init_video(void)
|
|||
struct retro_system_av_info *av_info =
|
||||
video_viewport_get_system_av_info();
|
||||
|
||||
init_video_filter(global->system.pix_fmt);
|
||||
init_video_filter(video_state.pix_fmt);
|
||||
event_command(EVENT_CMD_SHADER_DIR_INIT);
|
||||
|
||||
if (av_info)
|
||||
|
@ -561,7 +562,7 @@ void init_video(void)
|
|||
video.input_scale = scale;
|
||||
video.rgb32 = video_state.filter.filter ?
|
||||
video_state.filter.out_rgb32 :
|
||||
(global->system.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888);
|
||||
(video_state.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888);
|
||||
|
||||
tmp = (const input_driver_t*)driver->input;
|
||||
/* Need to grab the "real" video driver interface on a reinit. */
|
||||
|
@ -1181,3 +1182,13 @@ void *video_driver_frame_filter_get_buf_ptr(void)
|
|||
{
|
||||
return video_state.filter.buffer;
|
||||
}
|
||||
|
||||
enum retro_pixel_format video_driver_get_pixel_format(void)
|
||||
{
|
||||
return video_state.pix_fmt;
|
||||
}
|
||||
|
||||
void video_driver_set_pixel_format(enum retro_pixel_format fmt)
|
||||
{
|
||||
video_state.pix_fmt = fmt;
|
||||
}
|
||||
|
|
|
@ -370,6 +370,10 @@ rarch_softfilter_t *video_driver_frame_filter_get_ptr(void);
|
|||
|
||||
void *video_driver_frame_filter_get_buf_ptr(void);
|
||||
|
||||
enum retro_pixel_format video_driver_get_pixel_format(void);
|
||||
|
||||
void video_driver_set_pixel_format(enum retro_pixel_format fmt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -31,7 +31,6 @@ void deinit_pixel_converter(void)
|
|||
bool init_video_pixel_converter(unsigned size)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
/* This function can be called multiple times
|
||||
* without deiniting first on consoles. */
|
||||
|
@ -39,7 +38,7 @@ bool init_video_pixel_converter(unsigned size)
|
|||
|
||||
/* If pixel format is not 0RGB1555, we don't need to do
|
||||
* any internal pixel conversion. */
|
||||
if (global->system.pix_fmt != RETRO_PIXEL_FORMAT_0RGB1555)
|
||||
if (video_driver_get_pixel_format() != RETRO_PIXEL_FORMAT_0RGB1555)
|
||||
return true;
|
||||
|
||||
RARCH_WARN("0RGB1555 pixel format is deprecated, and will be slower. For 15/16-bit, RGB565 format is preferred.\n");
|
||||
|
|
|
@ -53,7 +53,7 @@ static bool video_frame_scale(const void *data,
|
|||
|
||||
if (!data)
|
||||
return false;
|
||||
if (global->system.pix_fmt != RETRO_PIXEL_FORMAT_0RGB1555)
|
||||
if (video_driver_get_pixel_format() != RETRO_PIXEL_FORMAT_0RGB1555)
|
||||
return false;
|
||||
if (data == RETRO_HW_FRAME_BUFFER_VALID)
|
||||
return false;
|
||||
|
|
|
@ -329,7 +329,7 @@ bool recording_init(void)
|
|||
params.filename = recording_file;
|
||||
params.fps = av_info->timing.fps;
|
||||
params.samplerate = av_info->timing.sample_rate;
|
||||
params.pix_fmt = (global->system.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888) ?
|
||||
params.pix_fmt = (video_driver_get_pixel_format() == RETRO_PIXEL_FORMAT_XRGB8888) ?
|
||||
FFEMU_PIX_ARGB8888 : FFEMU_PIX_RGB565;
|
||||
params.config = NULL;
|
||||
|
||||
|
|
|
@ -156,7 +156,6 @@ typedef struct global
|
|||
unsigned rotation;
|
||||
bool shutdown;
|
||||
unsigned performance_level;
|
||||
enum retro_pixel_format pix_fmt;
|
||||
|
||||
bool block_extract;
|
||||
bool force_nonblock;
|
||||
|
|
|
@ -129,7 +129,6 @@ static void dump_content(FILE *file, const void *frame,
|
|||
{
|
||||
size_t line_size;
|
||||
int i, j;
|
||||
global_t *global = NULL;
|
||||
union
|
||||
{
|
||||
const uint8_t *u8;
|
||||
|
@ -143,7 +142,6 @@ static void dump_content(FILE *file, const void *frame,
|
|||
|
||||
u.u8 = (const uint8_t*)frame;
|
||||
line_size = (width * 3 + 3) & ~3;
|
||||
global = global_get_ptr();
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
|
@ -157,7 +155,7 @@ static void dump_content(FILE *file, const void *frame,
|
|||
for (j = 0; j < height; j++, u.u8 += pitch)
|
||||
dump_line_bgr(lines[j], u.u8, width);
|
||||
}
|
||||
else if (global->system.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888)
|
||||
else if (video_driver_get_pixel_format() == RETRO_PIXEL_FORMAT_XRGB8888)
|
||||
{
|
||||
for (j = 0; j < height; j++, u.u8 += pitch)
|
||||
dump_line_32(lines[j], u.u32, width);
|
||||
|
@ -351,13 +349,11 @@ bool screenshot_dump(const char *folder, const void *frame,
|
|||
FILE *file = NULL;
|
||||
uint8_t *out_buffer = NULL;
|
||||
bool ret = false;
|
||||
global_t *global = global_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
(void)file;
|
||||
(void)out_buffer;
|
||||
(void)scaler;
|
||||
(void)global;
|
||||
(void)driver;
|
||||
|
||||
fill_dated_filename(shotname, IMG_EXT, sizeof(shotname));
|
||||
|
@ -396,7 +392,7 @@ bool screenshot_dump(const char *folder, const void *frame,
|
|||
|
||||
if (bgr24)
|
||||
scaler.in_fmt = SCALER_FMT_BGR24;
|
||||
else if (global->system.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888)
|
||||
else if (video_driver_get_pixel_format() == RETRO_PIXEL_FORMAT_XRGB8888)
|
||||
scaler.in_fmt = SCALER_FMT_ARGB8888;
|
||||
else
|
||||
scaler.in_fmt = SCALER_FMT_RGB565;
|
||||
|
|
Loading…
Reference in New Issue
Block a user