diff options
author | Eric Anholt <[email protected]> | 2011-04-15 14:18:43 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2011-04-20 10:35:41 -0700 |
commit | f7c26109c2cc61150d678529c8b0b5e769e9607e (patch) | |
tree | 2e8bf3e6ecc843e75a7d761a9024e70aa8c21954 /src/mesa/main/texformat.c | |
parent | ba99c2fbd95c5ecd741767d0c37eaf94bf655342 (diff) |
mesa: Add ChooseTexFormat fallbacks for floating point textures.
This covers X_FLOAT16 -> X_FLOAT32, and X -> RGBA_FLOAT32.
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main/texformat.c')
-rw-r--r-- | src/mesa/main/texformat.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 97b905fd36c..c85a7c05030 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -327,36 +327,52 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat, switch (internalFormat) { case GL_ALPHA16F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); break; case GL_ALPHA32F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); break; case GL_LUMINANCE16F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); break; case GL_LUMINANCE32F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); break; case GL_LUMINANCE_ALPHA16F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); break; case GL_LUMINANCE_ALPHA32F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); break; case GL_INTENSITY16F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); break; case GL_INTENSITY32F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); break; case GL_RGB16F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); break; case GL_RGB32F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); break; case GL_RGBA16F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); break; case GL_RGBA32F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); @@ -631,13 +647,23 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat, if (ctx->Extensions.ARB_texture_rg && ctx->Extensions.ARB_texture_float) { switch (internalFormat) { case GL_R16F: - return MESA_FORMAT_R_FLOAT16; + RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + break; case GL_R32F: - return MESA_FORMAT_R_FLOAT32; + RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + break; case GL_RG16F: - return MESA_FORMAT_RG_FLOAT16; + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + break; case GL_RG32F: - return MESA_FORMAT_RG_FLOAT32; + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); + break; default: ; /* fallthrough */ |