[PATCH 5/5] wined3d: Enforce volume texture block restrictions
Stefan Dösinger
stefan at codeweavers.com
Thu Aug 29 17:19:09 CDT 2013
---
dlls/wined3d/texture.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index c7d5de8..d0abb18 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1138,6 +1138,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
UINT tmp_w, tmp_h, tmp_d;
unsigned int i;
HRESULT hr;
+ const struct wined3d_format *format;
/* TODO: It should only be possible to create textures for formats
* that are reported as supported. */
@@ -1153,6 +1154,18 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
return WINED3DERR_INVALIDCALL;
}
+ format = wined3d_get_format(gl_info, desc->format);
+ if (format->flags & WINED3DFMT_FLAG_BLOCKS)
+ {
+ UINT width_mask = format->block_width - 1;
+ UINT height_mask = format->block_height - 1;
+ if (desc->width & width_mask || desc->height & height_mask)
+ {
+ WARN("(%p) : Texture cannot be created - width or height not block size aligned.\n", texture);
+ return WINED3DERR_INVALIDCALL;
+ }
+ }
+
/* Calculate levels for mip mapping. */
if (desc->usage & WINED3DUSAGE_AUTOGENMIPMAP)
{
--
1.8.1.5
More information about the wine-patches
mailing list