diff options
author | Keith Whitwell <[email protected]> | 2006-09-21 10:07:04 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2006-09-21 10:07:04 +0000 |
commit | afd244d4e8dc36895676c1b3bdbdba59f03a6962 (patch) | |
tree | 389909f43b0c464556f10af4270d8e5856d7e2b9 /src/mesa/drivers/dri | |
parent | 76dd385fed7fc9b5303fb0b7707a49c5500d7748 (diff) |
use the requested internal texture format where possible
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_tex.c | 32 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 12 |
2 files changed, 32 insertions, 12 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_tex.c b/src/mesa/drivers/dri/i965/brw_tex.c index 78d351407de..47bd875bb06 100644 --- a/src/mesa/drivers/dri/i965/brw_tex.c +++ b/src/mesa/drivers/dri/i965/brw_tex.c @@ -59,27 +59,37 @@ brwChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - case GL_RGBA4: - case GL_RGBA2: - case GL_RGB5_A1: return &_mesa_texformat_argb8888; -/* return &_mesa_texformat_rgba8888_rev; */ - case 3: - case GL_RGB: - case GL_COMPRESSED_RGB: case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: - case GL_RGB5: - case GL_RGB4: - case GL_R3_G3_B2: - /* Broadwater doesn't support RGB textures, so these must be + /* Broadwater doesn't support RGB888 textures, so these must be * stored as ARGB. */ return &_mesa_texformat_argb8888; + case 3: + case GL_COMPRESSED_RGB: + case GL_RGB: + if (format == GL_RGB && + type == GL_UNSIGNED_SHORT_5_6_5) + return &_mesa_texformat_rgb565; + else + return &_mesa_texformat_argb8888; + + + case GL_RGB5: + case GL_RGB5_A1: + return &_mesa_texformat_argb1555; + + case GL_R3_G3_B2: + case GL_RGBA2: + case GL_RGBA4: + case GL_RGB4: + return &_mesa_texformat_argb4444; + case GL_ALPHA: case GL_ALPHA4: case GL_ALPHA8: diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 6ccf56e41a2..5c7dc500cab 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -85,7 +85,8 @@ static GLuint translate_tex_format( GLuint mesa_format ) return BRW_SURFACEFORMAT_L8A8_UNORM; case MESA_FORMAT_RGB888: - return BRW_SURFACEFORMAT_R8G8B8_UNORM; + assert(0); /* not supported for sampling */ + return BRW_SURFACEFORMAT_R8G8B8_UNORM; case MESA_FORMAT_ARGB8888: return BRW_SURFACEFORMAT_B8G8R8A8_UNORM; @@ -93,6 +94,15 @@ static GLuint translate_tex_format( GLuint mesa_format ) case MESA_FORMAT_RGBA8888_REV: return BRW_SURFACEFORMAT_R8G8B8A8_UNORM; + case MESA_FORMAT_RGB565: + return BRW_SURFACEFORMAT_B5G6R5_UNORM; + + case MESA_FORMAT_ARGB1555: + return BRW_SURFACEFORMAT_B5G5R5A1_UNORM; + + case MESA_FORMAT_ARGB4444: + return BRW_SURFACEFORMAT_B4G4R4A4_UNORM; + case MESA_FORMAT_YCBCR_REV: return BRW_SURFACEFORMAT_YCRCB_NORMAL; |