st/nine: Impose restrictions on DXTN texture sizes

This is the expected behaviour.

Fixes wine tests.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: David Heidelberg <david@ixit.cz>
This commit is contained in:
Axel Davy 2015-05-14 17:01:40 +02:00
parent 48d895aa4b
commit d0daec1797
4 changed files with 28 additions and 0 deletions

View 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;

View 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);

View 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;

View 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;