st/nine: Impose restrictions on DXTN texture sizes
authorAxel Davy <axel.davy@ens.fr>
Thu, 14 May 2015 15:01:40 +0000 (17:01 +0200)
committerAxel Davy <axel.davy@ens.fr>
Fri, 21 Aug 2015 20:21:46 +0000 (22:21 +0200)
This is the expected behaviour.

Fixes wine tests.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: David Heidelberg <david@ixit.cz>
src/gallium/state_trackers/nine/cubetexture9.c
src/gallium/state_trackers/nine/device9.c
src/gallium/state_trackers/nine/texture9.c
src/gallium/state_trackers/nine/volumetexture9.c

index c1e6cbdb0d834870a91b540fbf9d7c00e6683272..a2bb9b9512f4392dcb0fbab518f7a5e01260c73d 100644 (file)
@@ -70,6 +70,13 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This,
     if (Format == D3DFMT_ATI1 || Format == D3DFMT_ATI2)
         return D3DERR_INVALIDCALL;
 
+    if (compressed_format(Format)) {
+        const unsigned w = util_format_get_blockwidth(pf);
+        const unsigned h = util_format_get_blockheight(pf);
+
+        user_assert(!(EdgeLength % w) && !(EdgeLength % h), D3DERR_INVALIDCALL);
+    }
+
     info->screen = pParams->device->screen;
     info->target = PIPE_TEXTURE_CUBE;
     info->format = pf;
index 224f7c896ddb8b9c19a7834f252addb156b7a0e1..f84364e516bff260616e90b423da046edda4e137 100644 (file)
@@ -1125,6 +1125,13 @@ create_zs_or_rt_surface(struct NineDevice9 *This,
     default: break;
     }
 
+    if (compressed_format(Format)) {
+        const unsigned w = util_format_get_blockwidth(templ.format);
+        const unsigned h = util_format_get_blockheight(templ.format);
+
+        user_assert(!(Width % w) && !(Height % h), D3DERR_INVALIDCALL);
+    }
+
     if (Pool == D3DPOOL_DEFAULT && Format != D3DFMT_NULL) {
         /* resource_create doesn't return an error code, so check format here */
         user_assert(templ.format != PIPE_FORMAT_NONE, D3DERR_INVALIDCALL);
index 6822865287ae00b5a209d733b38cc6da5f664ce2..af97082df8dbbd7ac4f333cbd405cd39e34d8dd5 100644 (file)
@@ -101,6 +101,13 @@ NineTexture9_ctor( struct NineTexture9 *This,
     if (Format != D3DFMT_NULL && pf == PIPE_FORMAT_NONE)
         return D3DERR_INVALIDCALL;
 
+    if (compressed_format(Format)) {
+        const unsigned w = util_format_get_blockwidth(pf);
+        const unsigned h = util_format_get_blockheight(pf);
+
+        user_assert(!(Width % w) && !(Height % h), D3DERR_INVALIDCALL);
+    }
+
     info->screen = screen;
     info->target = PIPE_TEXTURE_2D;
     info->format = pf;
index 4b5614d0b66f806c5012f01dc765348869e9a0cb..e5b2b53148de7966f8e29a3cee9d86a4c07410eb 100644 (file)
@@ -64,6 +64,13 @@ NineVolumeTexture9_ctor( struct NineVolumeTexture9 *This,
     if (Format == D3DFMT_ATI1 || Format == D3DFMT_ATI2)
         return D3DERR_INVALIDCALL;
 
+    if (compressed_format(Format)) {
+        const unsigned w = util_format_get_blockwidth(pf);
+        const unsigned h = util_format_get_blockheight(pf);
+        /* Compressed formats are not compressed on depth component */
+        user_assert(!(Width % w) && !(Height % h), D3DERR_INVALIDCALL);
+    }
+
     info->screen = pParams->device->screen;
     info->target = PIPE_TEXTURE_3D;
     info->format = pf;