Module: wine Branch: master Commit: 55b97245707e74196f999240bf06c77236a3c815 URL: http://source.winehq.org/git/wine.git/?a=commit;h=55b97245707e74196f999240bf...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Mon Mar 21 17:40:12 2016 +0100
wined3d: Check for compressed and height scaled formats in texture_init().
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/wined3d/surface.c | 23 ++--------------------- dlls/wined3d/texture.c | 11 +++++++++++ 2 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 5842d52..7878ee0 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -518,7 +518,7 @@ static void surface_evict_sysmem(struct wined3d_surface *surface) surface_invalidate_location(surface, WINED3D_LOCATION_SYSMEM); }
-static HRESULT surface_private_setup(struct wined3d_surface *surface) +static void surface_private_setup(struct wined3d_surface *surface) { /* TODO: Check against the maximum texture sizes supported by the video card. */ struct wined3d_texture *texture = surface->container; @@ -546,24 +546,11 @@ static HRESULT surface_private_setup(struct wined3d_surface *surface) surface->pow2Width = pow2Width; surface->pow2Height = pow2Height;
- if (pow2Width > surface->resource.width || pow2Height > surface->resource.height) - { - /* TODO: Add support for non power two compressed textures. */ - if (texture->resource.format_flags & (WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_HEIGHT_SCALE)) - { - FIXME("(%p) Compressed or height scaled non-power-two textures are not supported w(%d) h(%d)\n", - surface, surface->resource.width, surface->resource.height); - return WINED3DERR_NOTAVAILABLE; - } - } - if (texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) surface->locations = WINED3D_LOCATION_DISCARDED;
if (wined3d_texture_use_pbo(texture, gl_info)) surface->resource.map_binding = WINED3D_LOCATION_BUFFER; - - return WINED3D_OK; }
static BOOL surface_is_full_rect(const struct wined3d_surface *surface, const RECT *r) @@ -4627,13 +4614,7 @@ HRESULT wined3d_surface_init(struct wined3d_surface *surface, struct wined3d_tex surface->texture_level = level; surface->texture_layer = layer;
- /* Call the private setup routine */ - if (FAILED(hr = surface_private_setup(surface))) - { - ERR("Private setup failed, hr %#x.\n", hr); - wined3d_surface_cleanup(surface); - return hr; - } + surface_private_setup(surface);
/* Similar to lockable rendertargets above, creating the DIB section * during surface initialization prevents the sysmem pointer from changing diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 588066f..7e28681 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -1423,6 +1423,17 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
if (!gl_info->supported[ARB_TEXTURE_RECTANGLE] && !gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]) { + const struct wined3d_format *format = wined3d_get_format(gl_info, desc->format); + + /* TODO: Add support for non-power-of-two compressed textures. */ + if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] + & (WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_HEIGHT_SCALE)) + { + FIXME("Compressed or height scaled non-power-of-two (%ux%u) textures are not supported.\n", + desc->width, desc->height); + return WINED3DERR_NOTAVAILABLE; + } + /* Find the nearest pow2 match. */ pow2_width = pow2_height = 1; while (pow2_width < desc->width)