diff options
author | Axel Davy <[email protected]> | 2014-12-07 16:51:49 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2015-01-22 22:16:18 +0000 |
commit | 0abfb80dacf80c1f2d0a6a4142b9ab84695aa9e7 (patch) | |
tree | 35b5d8b4d2602ceee24a2499c5b7a3d17509b7f7 /src/gallium/state_trackers/nine/texture9.c | |
parent | 0d2c22e64844e20f9a52bffe2b934079a4121886 (diff) |
st/nine: Return D3DERR_INVALIDCALL when trying to create a texture of bad format
Reviewed-by: Ilia Mirkin <[email protected]>
Reviewed-by: David Heidelberg <[email protected]>
Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/texture9.c')
-rw-r--r-- | src/gallium/state_trackers/nine/texture9.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gallium/state_trackers/nine/texture9.c b/src/gallium/state_trackers/nine/texture9.c index 8852142c8e7..4d7e950e2ca 100644 --- a/src/gallium/state_trackers/nine/texture9.c +++ b/src/gallium/state_trackers/nine/texture9.c @@ -47,6 +47,7 @@ NineTexture9_ctor( struct NineTexture9 *This, struct pipe_screen *screen = pParams->device->screen; struct pipe_resource *info = &This->base.base.info; struct pipe_resource *resource; + enum pipe_format pf; unsigned l; D3DSURFACE_DESC sfdesc; HRESULT hr; @@ -92,9 +93,15 @@ NineTexture9_ctor( struct NineTexture9 *This, if (Usage & D3DUSAGE_AUTOGENMIPMAP) Levels = 0; + pf = d3d9_to_pipe_format(Format); + if (Format != D3DFMT_NULL && (pf == PIPE_FORMAT_NONE || + !screen->is_format_supported(screen, pf, PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW))) { + return D3DERR_INVALIDCALL; + } + info->screen = screen; info->target = PIPE_TEXTURE_2D; - info->format = d3d9_to_pipe_format(Format); + info->format = pf; info->width0 = Width; info->height0 = Height; info->depth0 = 1; |