mirror of
https://github.com/libretro/RetroArch
synced 2025-01-29 18:32:44 +00:00
Don't reference driver->video_data outside of gx/video_driver.c anymore
This commit is contained in:
parent
09d6897c2f
commit
389cf13db5
16
driver.c
16
driver.c
@ -236,7 +236,7 @@ static void driver_adjust_system_rates(void)
|
||||
audio_driver_ctl(RARCH_AUDIO_CTL_MONITOR_ADJUST_SYSTEM_RATES, NULL);
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_MONITOR_ADJUST_SYSTEM_RATES, NULL);
|
||||
|
||||
if (!driver->video_data)
|
||||
if (!video_driver_get_ptr(false))
|
||||
return;
|
||||
|
||||
if (system->force_nonblock)
|
||||
@ -276,7 +276,7 @@ void driver_set_nonblock_state(bool enable)
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
/* Only apply non-block-state for video if we're using vsync. */
|
||||
if (driver->video_active && driver->video_data)
|
||||
if (driver->video_active && video_driver_get_ptr(false))
|
||||
{
|
||||
bool video_nonblock = enable;
|
||||
|
||||
@ -464,18 +464,6 @@ void uninit_drivers(int flags)
|
||||
if (flags & DRIVERS_VIDEO_INPUT)
|
||||
video_driver_ctl(RARCH_DISPLAY_CTL_DEINIT, NULL);
|
||||
|
||||
if (flags & DRIVER_VIDEO)
|
||||
{
|
||||
const struct retro_hw_render_callback *hw_render =
|
||||
(const struct retro_hw_render_callback*)video_driver_callback();
|
||||
|
||||
if (hw_render->context_destroy && !driver->video_cache_context)
|
||||
hw_render->context_destroy();
|
||||
}
|
||||
|
||||
if ((flags & DRIVER_VIDEO) && !driver->video_data_own)
|
||||
driver->video_data = NULL;
|
||||
|
||||
if ((flags & DRIVER_INPUT) && !driver->input_data_own)
|
||||
driver->input_data = NULL;
|
||||
|
||||
|
@ -730,7 +730,6 @@ static const gfx_ctx_driver_t *d3d_get_context(void *data)
|
||||
/* Default to Direct3D9 for now.
|
||||
TODO: GL core contexts through ANGLE? */
|
||||
unsigned minor = 0;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
#if defined(HAVE_D3D8)
|
||||
unsigned major = 8;
|
||||
@ -739,7 +738,7 @@ static const gfx_ctx_driver_t *d3d_get_context(void *data)
|
||||
unsigned major = 9;
|
||||
enum gfx_ctx_api api = GFX_CTX_DIRECT3D9_API;
|
||||
#endif
|
||||
return gfx_ctx_init_first(driver->video_data,
|
||||
return gfx_ctx_init_first(video_driver_get_ptr(false),
|
||||
settings->video.context_driver,
|
||||
api, major, minor, false);
|
||||
}
|
||||
@ -748,13 +747,12 @@ static void *d3d_init(const video_info_t *info,
|
||||
const input_driver_t **input, void **input_data)
|
||||
{
|
||||
d3d_video_t *vid = NULL;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const gfx_ctx_driver_t *ctx = NULL;
|
||||
|
||||
#ifdef _XBOX
|
||||
if (driver->video_data)
|
||||
if (video_driver_get_ptr(false))
|
||||
{
|
||||
d3d_video_t *vid = (d3d_video_t*)driver->video_data;
|
||||
d3d_video_t *vid = (d3d_video_t*)video_driver_get_ptr(false);
|
||||
|
||||
/* Reinitialize renderchain as we
|
||||
* might have changed pixel formats.*/
|
||||
@ -771,7 +769,7 @@ static void *d3d_init(const video_info_t *info,
|
||||
|
||||
driver->video_data_own = true;
|
||||
driver->input_data_own = true;
|
||||
return driver->video_data;
|
||||
return vid;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -186,8 +186,7 @@ void texture_image_free(struct texture_image *img)
|
||||
bool texture_image_load(struct texture_image *out_img, const char *path)
|
||||
{
|
||||
D3DXIMAGE_INFO m_imageInfo;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
d3d_video_t *d3d = (d3d_video_t*)driver->video_data;
|
||||
d3d_video_t *d3d = (d3d_video_t*)video_driver_get_ptr(false);
|
||||
LPDIRECT3DTEXTURE d3dt = (LPDIRECT3DTEXTURE)out_img->texture_buf;
|
||||
LPDIRECT3DVERTEXBUFFER d3dv = (LPDIRECT3DVERTEXBUFFER)out_img->vertex_buf;
|
||||
|
||||
|
@ -505,6 +505,8 @@ static void deinit_pixel_converter(void)
|
||||
static bool uninit_video_input(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const struct retro_hw_render_callback *hw_render =
|
||||
(const struct retro_hw_render_callback*)video_driver_callback();
|
||||
|
||||
event_command(EVENT_CMD_OVERLAY_DEINIT);
|
||||
|
||||
@ -529,8 +531,14 @@ static bool uninit_video_input(void)
|
||||
event_command(EVENT_CMD_SHADER_DIR_DEINIT);
|
||||
video_monitor_compute_fps_statistics();
|
||||
|
||||
if (hw_render->context_destroy && !driver->video_cache_context)
|
||||
hw_render->context_destroy();
|
||||
|
||||
current_video = NULL;
|
||||
|
||||
if (!driver->video_data_own)
|
||||
driver->video_data = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -72,14 +72,15 @@ const shader_backend_t *shader_ctx_init_first(void)
|
||||
|
||||
struct video_shader *video_shader_driver_get_current_shader(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
void *video_driver = video_driver_get_ptr(true);
|
||||
if (!driver->video_poke)
|
||||
return NULL;
|
||||
if (!driver->video_data)
|
||||
if (!video_driver)
|
||||
return NULL;
|
||||
if (!driver->video_poke->get_current_shader)
|
||||
return NULL;
|
||||
return driver->video_poke->get_current_shader(driver->video_data);
|
||||
return driver->video_poke->get_current_shader(video_driver);
|
||||
}
|
||||
|
||||
void video_shader_scale(unsigned idx,
|
||||
|
@ -1131,8 +1131,7 @@ bool rarch_threaded_video_init(const video_driver_t **out_driver,
|
||||
**/
|
||||
void *rarch_threaded_video_get_ptr(const video_driver_t **drv)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const thread_video_t *thr = (const thread_video_t*)driver->video_data;
|
||||
const thread_video_t *thr = (const thread_video_t*)video_driver_get_ptr(true);
|
||||
|
||||
if (drv)
|
||||
*drv = thr->driver;
|
||||
@ -1144,9 +1143,7 @@ void *rarch_threaded_video_get_ptr(const video_driver_t **drv)
|
||||
|
||||
const char *rarch_threaded_video_get_ident(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const thread_video_t *thr = driver ? (const thread_video_t*)
|
||||
driver->video_data : NULL;
|
||||
const thread_video_t *thr = (const thread_video_t*)video_driver_get_ptr(true);
|
||||
|
||||
if (!thr || !thr->driver)
|
||||
return NULL;
|
||||
|
@ -299,12 +299,11 @@ static void sdl_grab_mouse(void *data, bool state)
|
||||
struct temp{
|
||||
SDL_Window *w;
|
||||
};
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
if (!strcmp(video_driver_get_ident(), "sdl2"))
|
||||
{
|
||||
/* First member of sdl2_video_t is the window */
|
||||
SDL_SetWindowGrab(((struct temp*)driver->video_data)->w,
|
||||
SDL_SetWindowGrab(((struct temp*)video_driver_get_ptr(false))->w,
|
||||
state ? SDL_TRUE : SDL_FALSE);
|
||||
}
|
||||
#endif
|
||||
|
@ -252,11 +252,6 @@ static void menu_action_setting_disp_set_label_shader_parameter(
|
||||
const struct video_shader_parameter *param = NULL;
|
||||
struct video_shader *shader = NULL;
|
||||
#endif
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
if (!driver->video_poke || !driver->video_data)
|
||||
return;
|
||||
|
||||
*s = '\0';
|
||||
*w = 19;
|
||||
strlcpy(s2, path, len2);
|
||||
|
@ -140,11 +140,6 @@ static void menu_display_d3d_draw(
|
||||
d3d_set_viewport(d3d->dev, &vp);
|
||||
d3d_set_texture(d3d->dev, 0, (LPDIRECT3DTEXTURE)texture);
|
||||
|
||||
#if 0
|
||||
gl->shader->set_coords(coords);
|
||||
gl->shader->set_mvp(driver->video_data, mat);
|
||||
#endif
|
||||
|
||||
d3d_draw_primitive(d3d->dev, (D3DPRIMITIVETYPE)menu_display_prim_to_d3d_enum(prim_type), 0, coords->vertices);
|
||||
|
||||
#if 0
|
||||
@ -254,8 +249,7 @@ static bool menu_display_d3d_font_init_first(const void **font_driver,
|
||||
if (settings->video.threaded && !hw_render->context_type)
|
||||
{
|
||||
thread_packet_t pkt;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
thread_video_t *thr = (thread_video_t*)driver->video_data;
|
||||
thread_video_t *thr = (thread_video_t*)video_driver_get_ptr(true);
|
||||
|
||||
if (!thr)
|
||||
return false;
|
||||
|
@ -100,7 +100,6 @@ static void menu_display_gl_draw(
|
||||
enum menu_display_prim_type prim_type
|
||||
)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gl_t *gl = gl_get_ptr();
|
||||
math_matrix_4x4 *mat = (math_matrix_4x4*)matrix_data;
|
||||
|
||||
@ -124,7 +123,7 @@ static void menu_display_gl_draw(
|
||||
glBindTexture(GL_TEXTURE_2D, (GLuint)texture);
|
||||
|
||||
gl->shader->set_coords(coords);
|
||||
gl->shader->set_mvp(driver->video_data, mat);
|
||||
gl->shader->set_mvp(video_driver_get_ptr(false), mat);
|
||||
|
||||
glDrawArrays(menu_display_prim_to_gl_enum(prim_type), 0, coords->vertices);
|
||||
|
||||
@ -226,8 +225,7 @@ static bool menu_display_gl_font_init_first(const void **font_driver,
|
||||
if (settings->video.threaded && !hw_render->context_type)
|
||||
{
|
||||
thread_packet_t pkt;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
thread_video_t *thr = (thread_video_t*)driver->video_data;
|
||||
thread_video_t *thr = (thread_video_t*)video_driver_get_ptr(true);
|
||||
|
||||
if (!thr)
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user