diff options
author | Axel Davy <[email protected]> | 2014-12-07 18:11:40 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2015-01-22 22:16:19 +0000 |
commit | 77f0ecf9cead20ee6f61149f66663258cebd6179 (patch) | |
tree | b87d10f97b2e0c662581f7a3de4db3bb6b289bc9 /src/gallium/state_trackers/nine/surface9.c | |
parent | b0b5430322406a521b8a75468452ac5d4ce86750 (diff) |
st/nine: Add ATI1 and ATI2 support
Adds ATI1 and ATI2 support to nine.
They map to PIPE_FORMAT_RGTC1_UNORM and PIPE_FORMAT_RGTC2_UNORM,
but need special handling.
Reviewed-by: David Heidelberg <[email protected]>
Signed-off-by: Axel Davy <[email protected]>
Signed-off-by: Xavier Bouchoux <[email protected]>
Cc: "10.4" <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/surface9.c')
-rw-r--r-- | src/gallium/state_trackers/nine/surface9.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c index 59288927a84..b3c7c189a46 100644 --- a/src/gallium/state_trackers/nine/surface9.c +++ b/src/gallium/state_trackers/nine/surface9.c @@ -38,6 +38,8 @@ #define DBG_CHANNEL DBG_SURFACE +#define is_ATI1_ATI2(format) (format == PIPE_FORMAT_RGTC1_UNORM || format == PIPE_FORMAT_RGTC2_UNORM) + HRESULT NineSurface9_ctor( struct NineSurface9 *This, struct NineUnknownParams *pParams, @@ -382,10 +384,19 @@ NineSurface9_LockRect( struct NineSurface9 *This, if (This->data) { DBG("returning system memory\n"); - - pLockedRect->Pitch = This->stride; - pLockedRect->pBits = NineSurface9_GetSystemMemPointer(This, - box.x, box.y); + /* ATI1 and ATI2 need special handling, because of d3d9 bug. + * We must advertise to the application as if it is uncompressed + * and bpp 8, and the app has a workaround to work with the fact + * that it is actually compressed. */ + if (is_ATI1_ATI2(This->base.info.format)) { + pLockedRect->Pitch = This->desc.Height; + pLockedRect->pBits = This->data + box.y * This->desc.Height + box.x; + } else { + pLockedRect->Pitch = This->stride; + pLockedRect->pBits = NineSurface9_GetSystemMemPointer(This, + box.x, + box.y); + } } else { DBG("mapping pipe_resource %p (level=%u usage=%x)\n", resource, This->level, usage); |