Clean up float FBO handling a bit.

Fallback to UNORM if not supported.
This commit is contained in:
Themaister 2013-12-04 12:55:51 +01:00
parent 96c9357273
commit 46c3dd6d20
2 changed files with 11 additions and 12 deletions

View File

@ -483,25 +483,19 @@ static void gl_create_fbo_textures(void *data)
bool fp_fbo = gl->fbo_scale[i].valid && gl->fbo_scale[i].fp_fbo;
if (fp_fbo)
if (fp_fbo && !gl->has_fp_fbo)
RARCH_ERR("Floating-point FBO was requested, but is not supported. Falling back to UNORM.\n");
if (fp_fbo && gl->has_fp_fbo)
{
RARCH_LOG("FBO pass #%d is floating-point.\n", i);
// GLES and GL are inconsistent in which arguments to pass.
#ifdef HAVE_OPENGLES2
bool has_fp_fbo = gl_query_extension(gl, "OES_texture_float_linear");
if (!has_fp_fbo)
RARCH_ERR("OES_texture_float_linear extension not found.\n");
RARCH_LOG("FBO pass #%d is floating-point.\n", i);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
gl->fbo_rect[i].width, gl->fbo_rect[i].height,
0, GL_RGBA, GL_FLOAT, NULL);
#else
bool has_fp_fbo = gl_query_extension(gl, "ARB_texture_float");
if (!has_fp_fbo)
RARCH_ERR("ARB_texture_float extension was not found.\n");
RARCH_LOG("FBO pass #%d is floating-point.\n", i);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F,
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F,
gl->fbo_rect[i].width, gl->fbo_rect[i].height,
0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
#endif
@ -1697,6 +1691,10 @@ static bool resolve_extensions(gl_t *gl)
RARCH_LOG("[GL]: Extension GL_EXT_unpack_subimage, can copy textures faster using UNPACK_ROW_LENGTH.\n");
gl->support_unpack_row_length = true;
}
gl->has_fp_fbo = gl_query_extension(gl, "OES_texture_float_linear");
#else
// Float FBO is core in 3.2.
gl->has_fp_fbo = gl->core_context || gl_query_extension(gl, "ARB_texture_float");
#endif
#ifdef GL_DEBUG

View File

@ -176,6 +176,7 @@ typedef struct gl
GLuint hw_render_depth[MAX_TEXTURES];
bool hw_render_fbo_init;
bool hw_render_depth_init;
bool has_fp_fbo;
#endif
bool hw_render_use;