diff options
author | Chia-I Wu <[email protected]> | 2010-04-05 10:06:52 +0800 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2010-04-08 16:47:11 +1000 |
commit | 968bf9634ec03e61441834603f13f0c914bbb0ce (patch) | |
tree | 1b982fba448d0c0766dde197091e98754986499f /src/gallium/state_trackers/dri/drm | |
parent | 821abff8c03031603111abc17dabe7cfa28a31e1 (diff) |
st/dri: Fix setTexBuffer2 with __DRI_TEXTURE_FORMAT_RGB.
When the format is __DRI_TEXTURE_FORMAT_RGB, the texture should be
treated as if there is no alpha channel.
Diffstat (limited to 'src/gallium/state_trackers/dri/drm')
-rw-r--r-- | src/gallium/state_trackers/dri/drm/dri2.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index 420ff0ee59e..bd2517f2cdd 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -84,9 +84,25 @@ dri2_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target, pt = drawable->textures[ST_ATTACHMENT_FRONT_LEFT]; if (pt) { + enum pipe_format internal_format = pt->format; + + if (format == __DRI_TEXTURE_FORMAT_RGB) { + /* only need to cover the formats recognized by dri_fill_st_visual */ + switch (internal_format) { + case PIPE_FORMAT_B8G8R8A8_UNORM: + internal_format = PIPE_FORMAT_B8G8R8X8_UNORM; + break; + case PIPE_FORMAT_A8R8G8B8_UNORM: + internal_format = PIPE_FORMAT_X8R8G8B8_UNORM; + break; + default: + break; + } + } + ctx->st->teximage(ctx->st, (target == GL_TEXTURE_2D) ? ST_TEXTURE_2D : ST_TEXTURE_RECT, - 0, drawable->stvis.color_format, pt, FALSE); + 0, internal_format, pt, FALSE); } } |