mirror of
https://github.com/libretro/RetroArch
synced 2025-03-18 13:20:57 +00:00
Combine video_renderchain_driver.c and video_driver.c
This commit is contained in:
parent
2496a6287c
commit
c7ac70a923
@ -1033,7 +1033,6 @@ endif
|
||||
|
||||
ifeq ($(HAVE_D3D9), 1)
|
||||
OBJ += gfx/drivers/d3d.o \
|
||||
gfx/video_renderchain_driver.o \
|
||||
gfx/common/d3d_common.o \
|
||||
gfx/drivers_font/d3d_w32_font.o \
|
||||
gfx/drivers_context/d3d_ctx.o
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "../video_coord_array.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../dynamic.h"
|
||||
#include "../video_renderchain_driver.h"
|
||||
#include "../video_driver.h"
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
#include "../video_thread_wrapper.h"
|
||||
|
@ -49,7 +49,6 @@
|
||||
#include "../font_driver.h"
|
||||
#include "../video_driver.h"
|
||||
#include "../common/d3d_common.h"
|
||||
#include "../video_renderchain_driver.h"
|
||||
#ifdef _XBOX
|
||||
#include "../../defines/xdk_defines.h"
|
||||
#endif
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "../drivers/d3d.h"
|
||||
#include "../drivers/d3d_shaders/opaque.cg.d3d9.h"
|
||||
|
||||
#include "../video_renderchain_driver.h"
|
||||
#include "../video_driver.h"
|
||||
#include "../../configuration.h"
|
||||
#include "../../verbosity.h"
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include <gfx/video_frame.h>
|
||||
|
||||
#include "gl_legacy_renderchain.h"
|
||||
#include "../video_renderchain_driver.h"
|
||||
#include "../video_driver.h"
|
||||
#include "../common/gl_common.h"
|
||||
|
||||
#include "../../driver.h"
|
||||
|
@ -17,7 +17,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <retro_inline.h>
|
||||
#include "../video_renderchain_driver.h"
|
||||
|
||||
#include "../video_driver.h"
|
||||
|
||||
typedef struct null_renderchain
|
||||
{
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <retro_inline.h>
|
||||
#include "../../video_renderchain_driver.h"
|
||||
|
||||
#include "../drivers/d3d.h"
|
||||
#include "../common/d3d_common.h"
|
||||
|
@ -390,6 +390,17 @@ static const shader_backend_t *shader_ctx_drivers[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static const renderchain_driver_t *renderchain_drivers[] = {
|
||||
#if defined(_WIN32) && defined(HAVE_D3D9) && defined(HAVE_CG)
|
||||
&cg_d3d9_renderchain,
|
||||
#endif
|
||||
#ifdef _XBOX
|
||||
&xdk_d3d_renderchain,
|
||||
#endif
|
||||
&null_renderchain,
|
||||
NULL
|
||||
};
|
||||
|
||||
/* Stub functions */
|
||||
|
||||
static void update_window_title_null(void *data, void *data2)
|
||||
@ -3352,3 +3363,23 @@ bool video_shader_driver_wrap_type(video_shader_ctx_wrap_t *wrap)
|
||||
wrap->type = current_shader->wrap_type(shader_data, wrap->idx);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool renderchain_init_first(const renderchain_driver_t **renderchain_driver,
|
||||
void **renderchain_handle)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; renderchain_drivers[i]; i++)
|
||||
{
|
||||
void *data = renderchain_drivers[i]->chain_new();
|
||||
|
||||
if (!data)
|
||||
continue;
|
||||
|
||||
*renderchain_driver = renderchain_drivers[i];
|
||||
*renderchain_handle = data;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "video_coord_array.h"
|
||||
#include "video_filter.h"
|
||||
#include "video_shader_parse.h"
|
||||
#include "video_state_tracker.h"
|
||||
|
||||
#include "../input/input_driver.h"
|
||||
|
||||
@ -74,6 +75,20 @@ RETRO_BEGIN_DECLS
|
||||
#define MAX_EGLIMAGE_TEXTURES 32
|
||||
#endif
|
||||
|
||||
#define MAX_VARIABLES 64
|
||||
|
||||
enum
|
||||
{
|
||||
TEXTURES = 8,
|
||||
TEXTURESMASK = TEXTURES - 1
|
||||
};
|
||||
|
||||
struct LinkInfo
|
||||
{
|
||||
unsigned tex_w, tex_h;
|
||||
struct video_shader_pass *pass;
|
||||
};
|
||||
|
||||
enum gfx_ctx_api
|
||||
{
|
||||
GFX_CTX_NONE = 0,
|
||||
@ -632,6 +647,22 @@ typedef struct gfx_ctx_ident
|
||||
const char *ident;
|
||||
} gfx_ctx_ident_t;
|
||||
|
||||
typedef struct video_viewport
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
unsigned full_width;
|
||||
unsigned full_height;
|
||||
} video_viewport_t;
|
||||
|
||||
struct aspect_ratio_elem
|
||||
{
|
||||
char name[64];
|
||||
float value;
|
||||
};
|
||||
|
||||
/* Optionally implemented interface to poke more
|
||||
* deeply into video driver. */
|
||||
|
||||
@ -678,15 +709,6 @@ typedef struct video_poke_interface
|
||||
const struct retro_hw_render_interface **iface);
|
||||
} video_poke_interface_t;
|
||||
|
||||
typedef struct video_viewport
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
unsigned full_width;
|
||||
unsigned full_height;
|
||||
} video_viewport_t;
|
||||
|
||||
/* msg is for showing a message on the screen
|
||||
* along with the video frame. */
|
||||
@ -770,11 +792,35 @@ typedef struct video_driver
|
||||
unsigned (*wrap_type_to_enum)(enum gfx_wrap_type type);
|
||||
} video_driver_t;
|
||||
|
||||
struct aspect_ratio_elem
|
||||
typedef struct renderchain_driver
|
||||
{
|
||||
char name[64];
|
||||
float value;
|
||||
};
|
||||
void (*chain_free)(void *data);
|
||||
void *(*chain_new)(void);
|
||||
bool (*reinit)(void *data, const void *info_data);
|
||||
bool (*init)(void *data,
|
||||
const void *video_info_data,
|
||||
void *dev_data,
|
||||
const void *final_viewport_data,
|
||||
const void *info_data,
|
||||
bool rgb32);
|
||||
void (*set_final_viewport)(void *data,
|
||||
void *renderchain_data, const void *viewport_data);
|
||||
bool (*add_pass)(void *data, const void *info_data);
|
||||
bool (*add_lut)(void *data,
|
||||
const char *id, const char *path,
|
||||
bool smooth);
|
||||
void (*add_state_tracker)(void *data, void *tracker_data);
|
||||
bool (*render)(void *chain_data, const void *data,
|
||||
unsigned width, unsigned height, unsigned pitch, unsigned rotation);
|
||||
void (*convert_geometry)(void *data, const void *info_data,
|
||||
unsigned *out_width, unsigned *out_height,
|
||||
unsigned width, unsigned height,
|
||||
void *final_viewport);
|
||||
void (*set_font_rect)(void *data, const void *param_data);
|
||||
bool (*read_viewport)(void *data, uint8_t *buffer, bool is_idle);
|
||||
void (*viewport_info)(void *data, struct video_viewport *vp);
|
||||
const char *ident;
|
||||
} renderchain_driver_t;
|
||||
|
||||
extern struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END];
|
||||
|
||||
@ -1070,53 +1116,6 @@ void video_driver_get_status(uint64_t *frame_count, bool * is_alive,
|
||||
|
||||
void video_driver_set_resize(unsigned width, unsigned height);
|
||||
|
||||
extern video_driver_t video_gl;
|
||||
extern video_driver_t video_vulkan;
|
||||
extern video_driver_t video_psp1;
|
||||
extern video_driver_t video_vita2d;
|
||||
extern video_driver_t video_ctr;
|
||||
extern video_driver_t video_d3d;
|
||||
extern video_driver_t video_gx;
|
||||
extern video_driver_t video_wiiu;
|
||||
extern video_driver_t video_xenon360;
|
||||
extern video_driver_t video_xvideo;
|
||||
extern video_driver_t video_xdk_d3d;
|
||||
extern video_driver_t video_sdl;
|
||||
extern video_driver_t video_sdl2;
|
||||
extern video_driver_t video_vg;
|
||||
extern video_driver_t video_omap;
|
||||
extern video_driver_t video_exynos;
|
||||
extern video_driver_t video_dispmanx;
|
||||
extern video_driver_t video_sunxi;
|
||||
extern video_driver_t video_drm;
|
||||
extern video_driver_t video_xshm;
|
||||
extern video_driver_t video_caca;
|
||||
extern video_driver_t video_gdi;
|
||||
extern video_driver_t video_vga;
|
||||
extern video_driver_t video_null;
|
||||
|
||||
extern const gfx_ctx_driver_t gfx_ctx_osmesa;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_sdl_gl;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_x_egl;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_wayland;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_x;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_d3d;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_drm;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_mali_fbdev;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_vivante_fbdev;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_android;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_ps3;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_wgl;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_videocore;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_qnx;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_cgl;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_cocoagl;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_emscripten;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_opendingux_fbdev;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_khr_display;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_gdi;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_null;
|
||||
|
||||
/**
|
||||
* video_context_driver_init_first:
|
||||
* @data : Input data.
|
||||
@ -1234,16 +1233,71 @@ bool video_shader_driver_compile_program(struct shader_program_info *program_inf
|
||||
|
||||
bool video_shader_driver_wrap_type(video_shader_ctx_wrap_t *wrap);
|
||||
|
||||
bool renderchain_init_first(const renderchain_driver_t **renderchain_driver,
|
||||
void **renderchain_handle);
|
||||
|
||||
extern bool (*video_driver_cb_has_focus)(void);
|
||||
|
||||
extern shader_backend_t *current_shader;
|
||||
extern void *shader_data;
|
||||
|
||||
extern video_driver_t video_gl;
|
||||
extern video_driver_t video_vulkan;
|
||||
extern video_driver_t video_psp1;
|
||||
extern video_driver_t video_vita2d;
|
||||
extern video_driver_t video_ctr;
|
||||
extern video_driver_t video_d3d;
|
||||
extern video_driver_t video_gx;
|
||||
extern video_driver_t video_wiiu;
|
||||
extern video_driver_t video_xenon360;
|
||||
extern video_driver_t video_xvideo;
|
||||
extern video_driver_t video_xdk_d3d;
|
||||
extern video_driver_t video_sdl;
|
||||
extern video_driver_t video_sdl2;
|
||||
extern video_driver_t video_vg;
|
||||
extern video_driver_t video_omap;
|
||||
extern video_driver_t video_exynos;
|
||||
extern video_driver_t video_dispmanx;
|
||||
extern video_driver_t video_sunxi;
|
||||
extern video_driver_t video_drm;
|
||||
extern video_driver_t video_xshm;
|
||||
extern video_driver_t video_caca;
|
||||
extern video_driver_t video_gdi;
|
||||
extern video_driver_t video_vga;
|
||||
extern video_driver_t video_null;
|
||||
|
||||
extern const gfx_ctx_driver_t gfx_ctx_osmesa;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_sdl_gl;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_x_egl;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_wayland;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_x;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_d3d;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_drm;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_mali_fbdev;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_vivante_fbdev;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_android;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_ps3;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_wgl;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_videocore;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_qnx;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_cgl;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_cocoagl;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_emscripten;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_opendingux_fbdev;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_khr_display;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_gdi;
|
||||
extern const gfx_ctx_driver_t gfx_ctx_null;
|
||||
|
||||
|
||||
extern const shader_backend_t gl_glsl_backend;
|
||||
extern const shader_backend_t hlsl_backend;
|
||||
extern const shader_backend_t gl_cg_backend;
|
||||
extern const shader_backend_t shader_null_backend;
|
||||
|
||||
extern renderchain_driver_t cg_d3d9_renderchain;
|
||||
extern renderchain_driver_t xdk_d3d_renderchain;
|
||||
extern renderchain_driver_t null_renderchain;
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -1,49 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "video_renderchain_driver.h"
|
||||
|
||||
static const renderchain_driver_t *renderchain_drivers[] = {
|
||||
#if defined(_WIN32) && defined(HAVE_D3D9) && defined(HAVE_CG)
|
||||
&cg_d3d9_renderchain,
|
||||
#endif
|
||||
#ifdef _XBOX
|
||||
&xdk_d3d_renderchain,
|
||||
#endif
|
||||
&null_renderchain,
|
||||
NULL
|
||||
};
|
||||
|
||||
bool renderchain_init_first(const renderchain_driver_t **renderchain_driver,
|
||||
void **renderchain_handle)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; renderchain_drivers[i]; i++)
|
||||
{
|
||||
void *data = renderchain_drivers[i]->chain_new();
|
||||
|
||||
if (!data)
|
||||
continue;
|
||||
|
||||
*renderchain_driver = renderchain_drivers[i];
|
||||
*renderchain_handle = data;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __VIDEO_RENDER_CHAIN_H
|
||||
#define __VIDEO_RENDER_CHAIN_H
|
||||
|
||||
#include <retro_common_api.h>
|
||||
#include <libretro.h>
|
||||
|
||||
#include "video_driver.h"
|
||||
#include "video_shader_parse.h"
|
||||
#include "video_state_tracker.h"
|
||||
#include "../defines/d3d_defines.h"
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
struct LinkInfo
|
||||
{
|
||||
unsigned tex_w, tex_h;
|
||||
struct video_shader_pass *pass;
|
||||
};
|
||||
|
||||
#define MAX_VARIABLES 64
|
||||
|
||||
enum
|
||||
{
|
||||
TEXTURES = 8,
|
||||
TEXTURESMASK = TEXTURES - 1
|
||||
};
|
||||
|
||||
typedef struct renderchain_driver
|
||||
{
|
||||
void (*chain_free)(void *data);
|
||||
void *(*chain_new)(void);
|
||||
bool (*reinit)(void *data, const void *info_data);
|
||||
bool (*init)(void *data,
|
||||
const void *video_info_data,
|
||||
void *dev_data,
|
||||
const void *final_viewport_data,
|
||||
const void *info_data,
|
||||
bool rgb32);
|
||||
void (*set_final_viewport)(void *data,
|
||||
void *renderchain_data, const void *viewport_data);
|
||||
bool (*add_pass)(void *data, const void *info_data);
|
||||
bool (*add_lut)(void *data,
|
||||
const char *id, const char *path,
|
||||
bool smooth);
|
||||
void (*add_state_tracker)(void *data, void *tracker_data);
|
||||
bool (*render)(void *chain_data, const void *data,
|
||||
unsigned width, unsigned height, unsigned pitch, unsigned rotation);
|
||||
void (*convert_geometry)(void *data, const void *info_data,
|
||||
unsigned *out_width, unsigned *out_height,
|
||||
unsigned width, unsigned height,
|
||||
void *final_viewport);
|
||||
void (*set_font_rect)(void *data, const void *param_data);
|
||||
bool (*read_viewport)(void *data, uint8_t *buffer, bool is_idle);
|
||||
void (*viewport_info)(void *data, struct video_viewport *vp);
|
||||
const char *ident;
|
||||
} renderchain_driver_t;
|
||||
|
||||
extern renderchain_driver_t cg_d3d9_renderchain;
|
||||
extern renderchain_driver_t xdk_d3d_renderchain;
|
||||
extern renderchain_driver_t null_renderchain;
|
||||
|
||||
bool renderchain_init_first(const renderchain_driver_t **renderchain_driver,
|
||||
void **renderchain_handle);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -301,7 +301,6 @@ VIDEO DRIVER
|
||||
#include "../gfx/drivers/drm_gfx.c"
|
||||
#endif
|
||||
|
||||
#include "../gfx/video_renderchain_driver.c"
|
||||
#include "../gfx/drivers_renderchain/null_renderchain.c"
|
||||
|
||||
#ifdef HAVE_OPENGL
|
||||
|
Loading…
x
Reference in New Issue
Block a user