diff options
author | Keith Whitwell <[email protected]> | 2006-09-20 22:40:34 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2006-09-20 22:40:34 +0000 |
commit | 3974cc8c09a00274f87c418cb295ed0cdd7c9d1e (patch) | |
tree | 680bc00df959e1a82d0438ad931da1ecd2347f60 /src/mesa/main | |
parent | 3aea82b396387bf3835f91bcc9121e02274c4c04 (diff) |
Deal with the overloading of _mesa_texstore_rgba, which is actually
used to store all sorts of formats.
Software mesa fails the glean pixelFormats test, but it appears to be
failing even with the swizzle code disabled??
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/texstore.c | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index f64642124da..8456273dbb1 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -991,20 +991,46 @@ _mesa_texstore_rgba(TEXSTORE_PARAMS) can_swizzle(baseInternalFormat) && can_swizzle(srcFormat)) { - GLubyte dstmap[4]; + const GLubyte *dstmap; + GLuint components; /* dstmap - how to swizzle from RGBA to dst format: */ - dstmap[3] = 0; - dstmap[2] = 1; - dstmap[1] = 2; - dstmap[0] = 3; - + if (dstFormat == &_mesa_texformat_rgba) { + dstmap = mappings[IDX_RGBA].from_rgba; + components = 4; + } + else if (dstFormat == &_mesa_texformat_rgb) { + dstmap = mappings[IDX_RGB].from_rgba; + components = 3; + } + else if (dstFormat == &_mesa_texformat_alpha) { + dstmap = mappings[IDX_ALPHA].from_rgba; + components = 1; + } + else if (dstFormat == &_mesa_texformat_luminance) { + dstmap = mappings[IDX_LUMINANCE].from_rgba; + components = 1; + } + else if (dstFormat == &_mesa_texformat_luminance_alpha) { + dstmap = mappings[IDX_LUMINANCE_ALPHA].from_rgba; + components = 2; + } + else if (dstFormat == &_mesa_texformat_intensity) { + dstmap = mappings[IDX_INTENSITY].from_rgba; + components = 1; + } + else { + ASSERT(0); + dstmap = map_identity; + components = 4; + } + _mesa_swizzle_ubyte_image(ctx, dims, srcFormat, srcType, baseInternalFormat, - dstmap, 4, + dstmap, components, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageOffsets, srcWidth, srcHeight, srcDepth, srcAddr, |