summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2008-07-25 20:32:22 +1000
committerEric Anholt <[email protected]>2008-08-20 11:28:39 -0700
commit9cc13eba3e58d5cbb905c51828b6b2743dc61290 (patch)
treebc1199e8384dcf1c9399c09567dc5603baf9c3e8 /src/mesa/drivers
parentce61660ab90d2f80370e423e4cd40a51ff4c4902 (diff)
i965: fixup format for TFP zero copy
(cherry picked from commit 9bc9e0ecb0fb2069b2c123e665eb2118e358098f which was lost in a merge)
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c14
1 files changed, 12 insertions, 2 deletions
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 0272156c977..af1401b34b7 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -188,7 +188,17 @@ brw_create_texture_surface( struct brw_context *brw,
surf.ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW;
surf.ss0.surface_type = translate_tex_target(key->target);
- surf.ss0.surface_format = translate_tex_format(key->format, key->depthmode);
+
+ if (key->bo)
+ surf.ss0.surface_format = translate_tex_format(key->format, key->depthmode);
+ else {
+ switch(key->depth) {
+ case 32: surf.ss0.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; break;
+ default:
+ case 24: surf.ss0.surface_format = BRW_SURFACEFORMAT_B8G8R8X8_UNORM; break;
+ case 16: surf.ss0.surface_format = BRW_SURFACEFORMAT_B5G6R5_UNORM; break;
+ }
+ }
/* This is ok for all textures with channel width 8bit or less:
*/
@@ -250,6 +260,7 @@ brw_update_texture_surface( GLcontext *ctx, GLuint unit )
key.bo = NULL;
key.offset = intelObj->textureOffset;
} else {
+ key.format = firstImage->TexFormat->MesaFormat;
key.pitch = intelObj->mt->pitch;
key.depth = firstImage->Depth;
key.bo = intelObj->mt->region->buffer;
@@ -258,7 +269,6 @@ brw_update_texture_surface( GLcontext *ctx, GLuint unit )
key.target = tObj->Target;
key.depthmode = tObj->DepthMode;
- key.format = firstImage->TexFormat->MesaFormat;
key.first_level = intelObj->firstLevel;
key.last_level = intelObj->lastLevel;
key.width = firstImage->Width;