mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
Start getting rid of HAVE_FBO ifdefs
This commit is contained in:
parent
0100e7b673
commit
3ccf8c19f1
@ -47,13 +47,11 @@ typedef struct gl
|
|||||||
|
|
||||||
bool vsync;
|
bool vsync;
|
||||||
bool tex_mipmap;
|
bool tex_mipmap;
|
||||||
#ifdef HAVE_FBO
|
|
||||||
bool fbo_inited;
|
bool fbo_inited;
|
||||||
bool fbo_feedback_enable;
|
bool fbo_feedback_enable;
|
||||||
bool hw_render_fbo_init;
|
bool hw_render_fbo_init;
|
||||||
bool hw_render_depth_init;
|
bool hw_render_depth_init;
|
||||||
bool has_srgb_fbo_gles3;
|
bool has_srgb_fbo_gles3;
|
||||||
#endif
|
|
||||||
bool has_fp_fbo;
|
bool has_fp_fbo;
|
||||||
bool has_srgb_fbo;
|
bool has_srgb_fbo;
|
||||||
bool hw_render_use;
|
bool hw_render_use;
|
||||||
@ -92,10 +90,8 @@ typedef struct gl
|
|||||||
|
|
||||||
GLuint tex_mag_filter;
|
GLuint tex_mag_filter;
|
||||||
GLuint tex_min_filter;
|
GLuint tex_min_filter;
|
||||||
#ifdef HAVE_FBO
|
|
||||||
GLuint fbo_feedback;
|
GLuint fbo_feedback;
|
||||||
GLuint fbo_feedback_texture;
|
GLuint fbo_feedback_texture;
|
||||||
#endif
|
|
||||||
GLuint pbo;
|
GLuint pbo;
|
||||||
#ifdef HAVE_OVERLAY
|
#ifdef HAVE_OVERLAY
|
||||||
GLuint *overlay_tex;
|
GLuint *overlay_tex;
|
||||||
@ -108,18 +104,14 @@ typedef struct gl
|
|||||||
GLuint pbo_readback[4];
|
GLuint pbo_readback[4];
|
||||||
#endif
|
#endif
|
||||||
GLuint texture[GFX_MAX_TEXTURES];
|
GLuint texture[GFX_MAX_TEXTURES];
|
||||||
#ifdef HAVE_FBO
|
|
||||||
GLuint fbo[GFX_MAX_SHADERS];
|
GLuint fbo[GFX_MAX_SHADERS];
|
||||||
GLuint fbo_texture[GFX_MAX_SHADERS];
|
GLuint fbo_texture[GFX_MAX_SHADERS];
|
||||||
GLuint hw_render_fbo[GFX_MAX_TEXTURES];
|
GLuint hw_render_fbo[GFX_MAX_TEXTURES];
|
||||||
GLuint hw_render_depth[GFX_MAX_TEXTURES];
|
GLuint hw_render_depth[GFX_MAX_TEXTURES];
|
||||||
#endif
|
|
||||||
|
|
||||||
unsigned tex_index; /* For use with PREV. */
|
unsigned tex_index; /* For use with PREV. */
|
||||||
unsigned textures;
|
unsigned textures;
|
||||||
#ifdef HAVE_FBO
|
|
||||||
unsigned fbo_feedback_pass;
|
unsigned fbo_feedback_pass;
|
||||||
#endif
|
|
||||||
unsigned rotation;
|
unsigned rotation;
|
||||||
unsigned vp_out_width;
|
unsigned vp_out_width;
|
||||||
unsigned vp_out_height;
|
unsigned vp_out_height;
|
||||||
@ -163,10 +155,8 @@ typedef struct gl
|
|||||||
struct scaler_ctx scaler;
|
struct scaler_ctx scaler;
|
||||||
video_info_t video_info;
|
video_info_t video_info;
|
||||||
struct video_tex_info prev_info[GFX_MAX_TEXTURES];
|
struct video_tex_info prev_info[GFX_MAX_TEXTURES];
|
||||||
#ifdef HAVE_FBO
|
|
||||||
struct video_fbo_rect fbo_rect[GFX_MAX_SHADERS];
|
struct video_fbo_rect fbo_rect[GFX_MAX_SHADERS];
|
||||||
struct gfx_fbo_scale fbo_scale[GFX_MAX_SHADERS];
|
struct gfx_fbo_scale fbo_scale[GFX_MAX_SHADERS];
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_GL_SYNC
|
#ifdef HAVE_GL_SYNC
|
||||||
GLsync fences[MAX_FENCES];
|
GLsync fences[MAX_FENCES];
|
||||||
|
@ -476,13 +476,11 @@ GLenum min_filter_to_mag(GLenum type)
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_FBO
|
|
||||||
static uintptr_t gl_get_current_framebuffer(void *data)
|
static uintptr_t gl_get_current_framebuffer(void *data)
|
||||||
{
|
{
|
||||||
gl_t *gl = (gl_t*)data;
|
gl_t *gl = (gl_t*)data;
|
||||||
return gl->hw_render_fbo[(gl->tex_index + 1) % gl->textures];
|
return gl->hw_render_fbo[(gl->tex_index + 1) % gl->textures];
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void gl_set_rotation(void *data, unsigned rotation)
|
static void gl_set_rotation(void *data, unsigned rotation)
|
||||||
{
|
{
|
||||||
@ -1207,7 +1205,6 @@ static bool gl_frame(void *data, const void *frame,
|
|||||||
gl_set_viewport(gl, video_info, width, height, false, true);
|
gl_set_viewport(gl, video_info, width, height, false, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_FBO
|
|
||||||
/* Render to texture in first pass. */
|
/* Render to texture in first pass. */
|
||||||
if (gl->fbo_inited)
|
if (gl->fbo_inited)
|
||||||
{
|
{
|
||||||
@ -1219,7 +1216,6 @@ static bool gl_frame(void *data, const void *frame,
|
|||||||
if (gl->renderchain_driver->start_render)
|
if (gl->renderchain_driver->start_render)
|
||||||
gl->renderchain_driver->start_render(gl, video_info);
|
gl->renderchain_driver->start_render(gl, video_info);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (gl->should_resize)
|
if (gl->should_resize)
|
||||||
{
|
{
|
||||||
@ -1232,7 +1228,6 @@ static bool gl_frame(void *data, const void *frame,
|
|||||||
|
|
||||||
video_info->cb_set_resize(video_info->context_data, mode.width, mode.height);
|
video_info->cb_set_resize(video_info->context_data, mode.width, mode.height);
|
||||||
|
|
||||||
#ifdef HAVE_FBO
|
|
||||||
if (gl->fbo_inited)
|
if (gl->fbo_inited)
|
||||||
{
|
{
|
||||||
if (gl->renderchain_driver->check_fbo_dimensions)
|
if (gl->renderchain_driver->check_fbo_dimensions)
|
||||||
@ -1244,7 +1239,6 @@ static bool gl_frame(void *data, const void *frame,
|
|||||||
gl->renderchain_driver->start_render(gl, video_info);
|
gl->renderchain_driver->start_render(gl, video_info);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
gl_set_viewport(gl, video_info, width, height, false, true);
|
gl_set_viewport(gl, video_info, width, height, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1256,9 +1250,7 @@ static bool gl_frame(void *data, const void *frame,
|
|||||||
/* Can be NULL for frame dupe / NULL render. */
|
/* Can be NULL for frame dupe / NULL render. */
|
||||||
if (frame)
|
if (frame)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_FBO
|
|
||||||
if (!gl->hw_render_fbo_init)
|
if (!gl->hw_render_fbo_init)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
gl_update_input_size(gl, frame_width, frame_height, pitch, true);
|
gl_update_input_size(gl, frame_width, frame_height, pitch, true);
|
||||||
gl_copy_frame(gl, video_info, frame, frame_width, frame_height, pitch);
|
gl_copy_frame(gl, video_info, frame, frame_width, frame_height, pitch);
|
||||||
@ -1272,7 +1264,6 @@ static bool gl_frame(void *data, const void *frame,
|
|||||||
|
|
||||||
/* Have to reset rendering state which libretro core
|
/* Have to reset rendering state which libretro core
|
||||||
* could easily have overridden. */
|
* could easily have overridden. */
|
||||||
#ifdef HAVE_FBO
|
|
||||||
if (gl->hw_render_fbo_init)
|
if (gl->hw_render_fbo_init)
|
||||||
{
|
{
|
||||||
gl_update_input_size(gl, frame_width, frame_height, pitch, false);
|
gl_update_input_size(gl, frame_width, frame_height, pitch, false);
|
||||||
@ -1295,7 +1286,6 @@ static bool gl_frame(void *data, const void *frame,
|
|||||||
glBlendEquation(GL_FUNC_ADD);
|
glBlendEquation(GL_FUNC_ADD);
|
||||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
gl->tex_info.tex = gl->texture[gl->tex_index];
|
gl->tex_info.tex = gl->texture[gl->tex_index];
|
||||||
gl->tex_info.input_size[0] = frame_width;
|
gl->tex_info.input_size[0] = frame_width;
|
||||||
@ -1305,7 +1295,6 @@ static bool gl_frame(void *data, const void *frame,
|
|||||||
|
|
||||||
feedback_info = gl->tex_info;
|
feedback_info = gl->tex_info;
|
||||||
|
|
||||||
#ifdef HAVE_FBO
|
|
||||||
if (gl->fbo_feedback_enable)
|
if (gl->fbo_feedback_enable)
|
||||||
{
|
{
|
||||||
const struct video_fbo_rect *rect = &gl->fbo_rect[gl->fbo_feedback_pass];
|
const struct video_fbo_rect *rect = &gl->fbo_rect[gl->fbo_feedback_pass];
|
||||||
@ -1320,7 +1309,6 @@ static bool gl_frame(void *data, const void *frame,
|
|||||||
|
|
||||||
set_texture_coords(feedback_info.coord, xamt, yamt);
|
set_texture_coords(feedback_info.coord, xamt, yamt);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
@ -1350,11 +1338,9 @@ static bool gl_frame(void *data, const void *frame,
|
|||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
|
||||||
#ifdef HAVE_FBO
|
if (gl->fbo_inited && gl->renderchain_driver->renderchain_render)
|
||||||
if (gl->fbo_inited && gl->renderchain_driver)
|
|
||||||
gl->renderchain_driver->renderchain_render(gl, video_info,
|
gl->renderchain_driver->renderchain_render(gl, video_info,
|
||||||
frame_count, &gl->tex_info, &feedback_info);
|
frame_count, &gl->tex_info, &feedback_info);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Set prev textures. */
|
/* Set prev textures. */
|
||||||
if (gl->renderchain_driver->bind_prev_texture)
|
if (gl->renderchain_driver->bind_prev_texture)
|
||||||
@ -1385,7 +1371,6 @@ static bool gl_frame(void *data, const void *frame,
|
|||||||
video_info->cb_update_window_title(
|
video_info->cb_update_window_title(
|
||||||
video_info->context_data, video_info);
|
video_info->context_data, video_info);
|
||||||
|
|
||||||
#ifdef HAVE_FBO
|
|
||||||
/* Reset state which could easily mess up libretro core. */
|
/* Reset state which could easily mess up libretro core. */
|
||||||
if (gl->hw_render_fbo_init)
|
if (gl->hw_render_fbo_init)
|
||||||
{
|
{
|
||||||
@ -1396,7 +1381,6 @@ static bool gl_frame(void *data, const void *frame,
|
|||||||
gl_disable_client_arrays();
|
gl_disable_client_arrays();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NO_GL_READ_PIXELS
|
#ifndef NO_GL_READ_PIXELS
|
||||||
/* Screenshots. */
|
/* Screenshots. */
|
||||||
@ -1548,11 +1532,9 @@ static void gl_free(void *data)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_FBO
|
|
||||||
if (gl->renderchain_driver->free)
|
if (gl->renderchain_driver->free)
|
||||||
gl->renderchain_driver->free(gl);
|
gl->renderchain_driver->free(gl);
|
||||||
gl_deinit_chain(gl);
|
gl_deinit_chain(gl);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_OPENGLES
|
#ifndef HAVE_OPENGLES
|
||||||
if (gl_query_core_context_in_use())
|
if (gl_query_core_context_in_use())
|
||||||
@ -2072,6 +2054,9 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
|||||||
gl->textures = 4;
|
gl->textures = 4;
|
||||||
#ifdef HAVE_FBO
|
#ifdef HAVE_FBO
|
||||||
gl->hw_render_use = hwr->context_type != RETRO_HW_CONTEXT_NONE;
|
gl->hw_render_use = hwr->context_type != RETRO_HW_CONTEXT_NONE;
|
||||||
|
#else
|
||||||
|
gl->hw_render_use = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (gl->hw_render_use)
|
if (gl->hw_render_use)
|
||||||
{
|
{
|
||||||
@ -2084,7 +2069,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
|||||||
context_bind_hw_render(false);
|
context_bind_hw_render(false);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
gl->white_color_ptr = white_color;
|
gl->white_color_ptr = white_color;
|
||||||
|
|
||||||
#ifdef HAVE_GLSL
|
#ifdef HAVE_GLSL
|
||||||
@ -2190,7 +2175,6 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
|||||||
gl_init_textures(gl, video);
|
gl_init_textures(gl, video);
|
||||||
gl_init_textures_data(gl);
|
gl_init_textures_data(gl);
|
||||||
|
|
||||||
#ifdef HAVE_FBO
|
|
||||||
if (!renderchain_gl_init_first(&gl->renderchain_driver,
|
if (!renderchain_gl_init_first(&gl->renderchain_driver,
|
||||||
&gl->renderchain_data))
|
&gl->renderchain_data))
|
||||||
{
|
{
|
||||||
@ -2208,7 +2192,6 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
|||||||
RARCH_ERR("[GL]: Hardware rendering context initialization failed.\n");
|
RARCH_ERR("[GL]: Hardware rendering context initialization failed.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
inp.input = input;
|
inp.input = input;
|
||||||
inp.input_data = input_data;
|
inp.input_data = input_data;
|
||||||
@ -2372,9 +2355,9 @@ static bool gl_set_shader(void *data,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_FBO
|
|
||||||
if (gl->renderchain_driver->deinit_fbo)
|
if (gl->renderchain_driver->deinit_fbo)
|
||||||
gl->renderchain_driver->deinit_fbo(gl);
|
gl->renderchain_driver->deinit_fbo(gl);
|
||||||
|
#ifdef HAVE_FBO
|
||||||
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2403,10 +2386,9 @@ static bool gl_set_shader(void *data,
|
|||||||
|
|
||||||
if (textures > gl->textures) /* Have to reinit a bit. */
|
if (textures > gl->textures) /* Have to reinit a bit. */
|
||||||
{
|
{
|
||||||
#if defined(HAVE_FBO)
|
if (gl->hw_render_use &&
|
||||||
if (gl->renderchain_driver->deinit_hw_render)
|
gl->renderchain_driver->deinit_hw_render)
|
||||||
gl->renderchain_driver->deinit_hw_render(gl);
|
gl->renderchain_driver->deinit_hw_render(gl);
|
||||||
#endif
|
|
||||||
|
|
||||||
glDeleteTextures(gl->textures, gl->texture);
|
glDeleteTextures(gl->textures, gl->texture);
|
||||||
#if defined(HAVE_PSGL)
|
#if defined(HAVE_PSGL)
|
||||||
@ -2419,16 +2401,12 @@ static bool gl_set_shader(void *data,
|
|||||||
gl_init_textures(gl, &gl->video_info);
|
gl_init_textures(gl, &gl->video_info);
|
||||||
gl_init_textures_data(gl);
|
gl_init_textures_data(gl);
|
||||||
|
|
||||||
#if defined(HAVE_FBO)
|
|
||||||
if (gl->hw_render_use && gl->renderchain_driver->init_hw_render)
|
if (gl->hw_render_use && gl->renderchain_driver->init_hw_render)
|
||||||
gl->renderchain_driver->init_hw_render(gl, gl->tex_w, gl->tex_h);
|
gl->renderchain_driver->init_hw_render(gl, gl->tex_w, gl->tex_h);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_FBO
|
if (gl->renderchain_driver->init)
|
||||||
if (gl->renderchain_driver)
|
|
||||||
gl->renderchain_driver->init(gl, gl->tex_w, gl->tex_h);
|
gl->renderchain_driver->init(gl, gl->tex_w, gl->tex_h);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Apparently need to set viewport for passes when we aren't using FBOs. */
|
/* Apparently need to set viewport for passes when we aren't using FBOs. */
|
||||||
gl_set_shader_viewports(gl);
|
gl_set_shader_viewports(gl);
|
||||||
@ -2478,14 +2456,12 @@ unsigned *height_p, size_t *pitch_p)
|
|||||||
void* buffer = NULL;
|
void* buffer = NULL;
|
||||||
void* buffer_texture = NULL;
|
void* buffer_texture = NULL;
|
||||||
|
|
||||||
#ifdef HAVE_FBO
|
|
||||||
if (gl->hw_render_use)
|
if (gl->hw_render_use)
|
||||||
{
|
{
|
||||||
buffer = malloc(pitch * height);
|
buffer = malloc(pitch * height);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
buffer_texture = malloc(pitch * gl->tex_h);
|
buffer_texture = malloc(pitch * gl->tex_h);
|
||||||
|
|
||||||
@ -2504,7 +2480,6 @@ unsigned *height_p, size_t *pitch_p)
|
|||||||
*height_p = height;
|
*height_p = height;
|
||||||
*pitch_p = pitch;
|
*pitch_p = pitch;
|
||||||
|
|
||||||
#ifdef HAVE_FBO
|
|
||||||
if (gl->hw_render_use)
|
if (gl->hw_render_use)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
@ -2516,7 +2491,7 @@ unsigned *height_p, size_t *pitch_p)
|
|||||||
free(buffer_texture);
|
free(buffer_texture);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return buffer_texture;
|
return buffer_texture;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -92,7 +92,6 @@ void gl_set_viewport(
|
|||||||
unsigned viewport_height,
|
unsigned viewport_height,
|
||||||
bool force_full, bool allow_rotate);
|
bool force_full, bool allow_rotate);
|
||||||
|
|
||||||
#ifdef HAVE_FBO
|
|
||||||
static void gl2_renderchain_convert_geometry(
|
static void gl2_renderchain_convert_geometry(
|
||||||
void *data,
|
void *data,
|
||||||
struct video_fbo_rect *fbo_rect,
|
struct video_fbo_rect *fbo_rect,
|
||||||
@ -138,6 +137,7 @@ static void gl2_renderchain_convert_geometry(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_FBO
|
||||||
static bool gl_recreate_fbo(
|
static bool gl_recreate_fbo(
|
||||||
struct video_fbo_rect *fbo_rect,
|
struct video_fbo_rect *fbo_rect,
|
||||||
GLuint fbo,
|
GLuint fbo,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user