(Vita) Add get framebuffer

This commit is contained in:
Francisco José García García 2016-09-27 23:39:24 +02:00
parent 731f2c8f2b
commit 8a6625753d

View File

@ -133,14 +133,9 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
settings_t *settings = config_get_ptr();
(void)frame;
(void)width;
(void)height;
(void)pitch;
(void)msg;
if (frame)
{
if(!(vita->texture&&vita2d_texture_get_datap(vita->texture)==frame)){
unsigned i, j;
unsigned int stride;
@ -184,6 +179,7 @@ static bool vita2d_gfx_frame(void *data, const void *frame,
tex16[j + i*stride] = frame16[j + i*pitch];
}
}
}
if (vita->should_resize)
vita2d_gfx_update_viewport(vita);
@ -744,6 +740,36 @@ static void vita_set_osd_msg(void *data, const char *msg,
font_driver_render_msg(font, msg, params);
}
static bool vita_get_current_sw_framebuffer(void *data,
struct retro_framebuffer *framebuffer)
{
vita_video_t *vita = (vita_video_t*)data;
if (!vita->texture || vita->width != framebuffer->width ||
vita->height != framebuffer->height)
{
if(vita->texture){
vita2d_wait_rendering_done();
vita2d_free_texture(vita->texture);
vita->texture = NULL;
}
vita->width = framebuffer->width;
vita->height = framebuffer->height;
vita->texture = vita2d_create_empty_texture_format(vita->width, vita->height, vita->format);
vita2d_texture_set_filters(vita->texture,vita->tex_filter,vita->tex_filter);
}
framebuffer->data = vita2d_texture_get_datap(vita->texture);
framebuffer->pitch = vita2d_texture_get_stride(vita->texture);
framebuffer->format = vita->rgb32
? RETRO_PIXEL_FORMAT_XRGB8888 : RETRO_PIXEL_FORMAT_RGB565;
framebuffer->memory_flags = 0;
return true;
}
static const video_poke_interface_t vita_poke_interface = {
vita_load_texture,
vita_unload_texture,
@ -769,7 +795,7 @@ static const video_poke_interface_t vita_poke_interface = {
NULL,
NULL,
NULL,
NULL,
vita_get_current_sw_framebuffer,
NULL,
};