(video_driver.c) Cleanups
This commit is contained in:
parent
176fa2dcaf
commit
f067ecce50
|
@ -382,6 +382,7 @@ static void deinit_video_filter(void)
|
||||||
static void init_video_filter(enum retro_pixel_format colfmt)
|
static void init_video_filter(enum retro_pixel_format colfmt)
|
||||||
{
|
{
|
||||||
unsigned width, height, pow2_x, pow2_y, maxsize;
|
unsigned width, height, pow2_x, pow2_y, maxsize;
|
||||||
|
void *buf = NULL;
|
||||||
struct retro_game_geometry *geom = NULL;
|
struct retro_game_geometry *geom = NULL;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
struct retro_system_av_info *av_info =
|
struct retro_system_av_info *av_info =
|
||||||
|
@ -437,15 +438,15 @@ static void init_video_filter(enum retro_pixel_format colfmt)
|
||||||
|
|
||||||
/* TODO: Aligned output. */
|
/* TODO: Aligned output. */
|
||||||
#ifdef _3DS
|
#ifdef _3DS
|
||||||
video_driver_state_buffer = linearMemAlign(width
|
buf = linearMemAlign(width * height * video_driver_state_out_bpp, 0x80);
|
||||||
* height * video_driver_state_out_bpp, 0x80);
|
|
||||||
#else
|
#else
|
||||||
video_driver_state_buffer = malloc(width
|
buf = malloc(width * height * video_driver_state_out_bpp);
|
||||||
* height * video_driver_state_out_bpp);
|
|
||||||
#endif
|
#endif
|
||||||
if (!video_driver_state_buffer)
|
if (!buf)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
video_driver_state_buffer = buf;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
@ -569,6 +570,9 @@ static bool init_video_pixel_converter(unsigned size)
|
||||||
{
|
{
|
||||||
struct retro_hw_render_callback *hwr =
|
struct retro_hw_render_callback *hwr =
|
||||||
video_driver_get_hw_context();
|
video_driver_get_hw_context();
|
||||||
|
void *scalr_out = NULL;
|
||||||
|
video_pixel_scaler_t *scalr = NULL;
|
||||||
|
struct scaler_ctx *scalr_ctx = NULL;
|
||||||
|
|
||||||
/* If pixel format is not 0RGB1555, we don't need to do
|
/* If pixel format is not 0RGB1555, we don't need to do
|
||||||
* any internal pixel conversion. */
|
* any internal pixel conversion. */
|
||||||
|
@ -581,33 +585,35 @@ static bool init_video_pixel_converter(unsigned size)
|
||||||
|
|
||||||
RARCH_WARN("0RGB1555 pixel format is deprecated, and will be slower. For 15/16-bit, RGB565 format is preferred.\n");
|
RARCH_WARN("0RGB1555 pixel format is deprecated, and will be slower. For 15/16-bit, RGB565 format is preferred.\n");
|
||||||
|
|
||||||
video_driver_scaler_ptr = (video_pixel_scaler_t*)
|
scalr = (video_pixel_scaler_t*)calloc(1, sizeof(*scalr));
|
||||||
calloc(1, sizeof(*video_driver_scaler_ptr));
|
|
||||||
|
|
||||||
if (!video_driver_scaler_ptr)
|
if (!scalr)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
video_driver_scaler_ptr->scaler = (struct scaler_ctx*)
|
video_driver_scaler_ptr = scalr;
|
||||||
calloc(1, sizeof(*video_driver_scaler_ptr->scaler));
|
|
||||||
|
|
||||||
if (!video_driver_scaler_ptr->scaler)
|
scalr_ctx = (struct scaler_ctx*)calloc(1, sizeof(*scalr_ctx));
|
||||||
|
|
||||||
|
if (!scalr_ctx)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
video_driver_scaler_ptr->scaler = scalr_ctx;
|
||||||
video_driver_scaler_ptr->scaler->scaler_type = SCALER_TYPE_POINT;
|
video_driver_scaler_ptr->scaler->scaler_type = SCALER_TYPE_POINT;
|
||||||
video_driver_scaler_ptr->scaler->in_fmt = SCALER_FMT_0RGB1555;
|
video_driver_scaler_ptr->scaler->in_fmt = SCALER_FMT_0RGB1555;
|
||||||
|
|
||||||
/* TODO: Pick either ARGB8888 or RGB565 depending on driver. */
|
/* TODO: Pick either ARGB8888 or RGB565 depending on driver. */
|
||||||
video_driver_scaler_ptr->scaler->out_fmt = SCALER_FMT_RGB565;
|
video_driver_scaler_ptr->scaler->out_fmt = SCALER_FMT_RGB565;
|
||||||
|
|
||||||
if (!scaler_ctx_gen_filter(video_driver_scaler_ptr->scaler))
|
if (!scaler_ctx_gen_filter(scalr_ctx))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
video_driver_scaler_ptr->scaler_out =
|
scalr_out = calloc(sizeof(uint16_t), size * size);
|
||||||
calloc(sizeof(uint16_t), size * size);
|
|
||||||
|
|
||||||
if (!video_driver_scaler_ptr->scaler_out)
|
if (!scalr_out)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
video_driver_scaler_ptr->scaler_out = scalr_out;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
|
Loading…
Reference in New Issue