Signed-off-by: Stefan Dösinger stefan@codeweavers.com --- dlls/wined3d/resource.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index 8c3ca59bedc..9dab928dbc0 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -634,6 +634,16 @@ void wined3d_resource_memory_colour_fill(struct wined3d_resource *resource, wined3d_texture_get_level_box(texture_from_resource(resource), level, &level_box); }
+ /* Fast and simple path for setting everything to zero. The C library's memset is + * more sophisticated than our code below. Also this works for block formats, which + * we still need to zero-initialize for newly created resources. */ + if (!colour->r && !colour->g && !colour->b && !colour->a && + !memcmp(box, &level_box, sizeof(*box))) + { + memset(map->data, 0, map->slice_pitch * box->back); + return; + } + w = min(box->right, level_box.right) - min(box->left, level_box.right); h = min(box->bottom, level_box.bottom) - min(box->top, level_box.bottom); if (resource->type != WINED3D_RTYPE_TEXTURE_3D)