summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2009-08-27 20:17:53 +0200
committerMichel Dänzer <daenzer@vmware.com>2009-08-27 20:17:53 +0200
commita33e9ea3b9b7ac98d6e9bc385bbbe7eac2eb73d0 (patch)
treeecec722af43c49849343b1e88e0b40241137ac06 /src/gallium/state_trackers
parent1160bf7c65313f66dac0ba4011c8bfe31fee01e5 (diff)
st/xorg/dri: Pass texture formats via the DRI2 protocol flags.
No need to guess.
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/dri/dri_drawable.c16
-rw-r--r--src/gallium/state_trackers/xorg/xorg_dri2.c2
2 files changed, 7 insertions, 11 deletions
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index c7ca7f78a3..e27d5c12a8 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -181,27 +181,25 @@ dri_get_buffers(__DRIdrawablePrivate * dPriv)
drawable->is_pixmap = dri2_check_if_pixmap(buffers, count);
for (i = 0; i < count; i++) {
- enum pipe_format format = 0;
int index = 0;
switch (buffers[i].attachment) {
case __DRI_BUFFER_FRONT_LEFT:
- continue;
case __DRI_BUFFER_FAKE_FRONT_LEFT:
index = ST_SURFACE_FRONT_LEFT;
- format = drawable->color_format;
+ drawable->color_format = buffers[i].flags;
break;
case __DRI_BUFFER_BACK_LEFT:
index = ST_SURFACE_BACK_LEFT;
- format = drawable->color_format;
+ drawable->color_format = buffers[i].flags;
break;
case __DRI_BUFFER_DEPTH:
index = ST_SURFACE_DEPTH;
- format = drawable->depth_format;
+ drawable->depth_format = buffers[i].flags;
break;
case __DRI_BUFFER_STENCIL:
index = ST_SURFACE_DEPTH;
- format = drawable->stencil_format;
+ drawable->stencil_format = buffers[i].flags;
break;
case __DRI_BUFFER_ACCUM:
default:
@@ -218,7 +216,7 @@ dri_get_buffers(__DRIdrawablePrivate * dPriv)
surface = dri_surface_from_handle(api,
screen,
buffers[i].name,
- format,
+ buffers[i].flags,
dri_drawable->w,
dri_drawable->h, buffers[i].pitch);
@@ -242,9 +240,7 @@ void dri2_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target,
st_get_framebuffer_surface(drawable->stfb, ST_SURFACE_FRONT_LEFT, &ps);
st_bind_texture_surface(ps, target == GL_TEXTURE_2D ? ST_TEXTURE_2D :
- ST_TEXTURE_RECT, 0,
- format == GLX_TEXTURE_FORMAT_RGBA_EXT ?
- PIPE_FORMAT_R8G8B8A8_UNORM : PIPE_FORMAT_R8G8B8X8_UNORM);
+ ST_TEXTURE_RECT, 0, drawable->color_format);
}
void dri2_set_tex_buffer(__DRIcontext *pDRICtx, GLint target,
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index 7d6954016f..111024692e 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -137,7 +137,7 @@ driCreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count)
buffers[i].pitch = stride;
buffers[i].cpp = 4;
buffers[i].driverPrivate = &privates[i];
- buffers[i].flags = 0; /* not tiled */
+ buffers[i].flags = tex->format;
privates[i].pPixmap = pPixmap;
privates[i].buf = buf;
privates[i].tex = tex;