basetexture.c 18.9 KB
Newer Older
1 2 3 4
/*
 * IWineD3DBaseTexture Implementation
 *
 * Copyright 2002-2004 Jason Edmeades
5 6
 * Copyright 2002-2004 Raphael Junqueira
 * Copyright 2005 Oliver Stieber
7
 * Copyright 2007-2008 Stefan Dösinger for CodeWeavers
8 9 10 11 12 13 14 15 16 17 18 19 20
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
21
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 23 24 25 26
 */

#include "config.h"
#include "wined3d_private.h"

27
WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
28
#define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
29

30 31 32
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT levels, WINED3DRESOURCETYPE resource_type,
        IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct GlPixelFormatDesc *format_desc,
        WINED3DPOOL pool, IUnknown *parent)
33
{
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
    HRESULT hr;

    hr = resource_init((IWineD3DResource *)texture, resource_type, device, size, usage, format_desc, pool, parent);
    if (FAILED(hr))
    {
        WARN("Failed to initialize resource, returning %#x\n", hr);
        return hr;
    }

    texture->baseTexture.levels = levels;
    texture->baseTexture.filterType = (usage & WINED3DUSAGE_AUTOGENMIPMAP) ? WINED3DTEXF_LINEAR : WINED3DTEXF_NONE;
    texture->baseTexture.LOD = 0;
    texture->baseTexture.dirty = TRUE;
    texture->baseTexture.srgbDirty = TRUE;
    texture->baseTexture.is_srgb = FALSE;
    texture->baseTexture.pow2Matrix_identity = TRUE;

    return WINED3D_OK;
52 53
}

54 55
void basetexture_cleanup(IWineD3DBaseTexture *iface)
{
56
    IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
57 58
    IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;

59
    TRACE("(%p) : textureName(%d)\n", This, This->baseTexture.textureName);
60
    if (This->baseTexture.textureName != 0) {
61
        ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
62
        ENTER_GL();
63
        TRACE("(%p) : Deleting texture %d\n", This, This->baseTexture.textureName);
64
        glDeleteTextures(1, &This->baseTexture.textureName);
65
        glDeleteTextures(1, &This->baseTexture.srgbTextureName);
66 67
        LEAVE_GL();
    }
68 69

    resource_cleanup((IWineD3DResource *)iface);
70 71
}

72 73
void basetexture_unload(IWineD3DBaseTexture *iface)
{
74 75 76 77 78 79 80
    IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
    IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;

    if(This->baseTexture.textureName) {
        ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
        ENTER_GL();
        glDeleteTextures(1, &This->baseTexture.textureName);
81
        glDeleteTextures(1, &This->baseTexture.srgbTextureName);
82
        This->baseTexture.textureName = 0;
83
        This->baseTexture.srgbTextureName = 0;
84 85
        LEAVE_GL();
    }
86
    This->baseTexture.dirty = TRUE;
87
    This->baseTexture.srgbDirty = TRUE;
88 89
}

90
/* There is no OpenGL equivalent of setLOD, getLOD. All they do anyway is prioritize texture loading
91
 * so just pretend that they work unless something really needs a failure. */
92 93
DWORD basetexture_set_lod(IWineD3DBaseTexture *iface, DWORD LODNew)
{
94
    IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
95

96
    if (This->resource.pool != WINED3DPOOL_MANAGED) {
97
        return  WINED3DERR_INVALIDCALL;
98 99
    }

100 101 102
    if(LODNew >= This->baseTexture.levels)
        LODNew = This->baseTexture.levels - 1;
     This->baseTexture.LOD = LODNew;
103

104
    TRACE("(%p) : set bogus LOD to %d\n", This, This->baseTexture.LOD);
105

106
    return This->baseTexture.LOD;
107 108
}

109 110
DWORD basetexture_get_lod(IWineD3DBaseTexture *iface)
{
111
    IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
112

113
    if (This->resource.pool != WINED3DPOOL_MANAGED) {
114
        return  WINED3DERR_INVALIDCALL;
115
    }
116

117
    TRACE("(%p) : returning %d\n", This, This->baseTexture.LOD);
118

119
    return This->baseTexture.LOD;
120 121
}

122 123
DWORD basetexture_get_level_count(IWineD3DBaseTexture *iface)
{
124
    IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
125
    TRACE("(%p) : returning %d\n", This, This->baseTexture.levels);
126 127 128
    return This->baseTexture.levels;
}

129 130
HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface, WINED3DTEXTUREFILTERTYPE FilterType)
{
131
  IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
132 133
  IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
  UINT textureDimensions = IWineD3DBaseTexture_GetTextureDimensions(iface);
134

135
  if (!(This->resource.usage & WINED3DUSAGE_AUTOGENMIPMAP)) {
136
      TRACE("(%p) : returning invalid call\n", This);
137
      return WINED3DERR_INVALIDCALL;
138
  }
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
  if(This->baseTexture.filterType != FilterType) {
      /* What about multithreading? Do we want all the context overhead just to set this value?
       * Or should we delay the applying until the texture is used for drawing? For now, apply
       * immediately.
       */
      ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
      ENTER_GL();
      glBindTexture(textureDimensions, This->baseTexture.textureName);
      checkGLcall("glBindTexture");
      switch(FilterType) {
          case WINED3DTEXF_NONE:
          case WINED3DTEXF_POINT:
              glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST);
              checkGLcall("glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST)");

154
              break;
155 156 157 158
          case WINED3DTEXF_LINEAR:
              glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST);
              checkGLcall("glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST)");

159
              break;
160 161 162 163 164 165 166
          default:
              WARN("Unexpected filter type %d, setting to GL_NICEST\n", FilterType);
              glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST);
              checkGLcall("glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST)");
      }
      LEAVE_GL();
  }
167
  This->baseTexture.filterType = FilterType;
168
  TRACE("(%p) :\n", This);
169
  return WINED3D_OK;
170 171
}

172 173
WINED3DTEXTUREFILTERTYPE basetexture_get_autogen_filter_type(IWineD3DBaseTexture *iface)
{
174 175
  IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
  FIXME("(%p) : stub\n", This);
176
  if (!(This->resource.usage & WINED3DUSAGE_AUTOGENMIPMAP)) {
177
     return WINED3DTEXF_NONE;
178 179
  }
  return This->baseTexture.filterType;
180 181
}

182 183
void basetexture_generate_mipmaps(IWineD3DBaseTexture *iface)
{
184
  IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
185
  /* TODO: implement filters using GL_SGI_generate_mipmaps http://oss.sgi.com/projects/ogl-sample/registry/SGIS/generate_mipmap.txt */
186 187 188 189
  FIXME("(%p) : stub\n", This);
  return ;
}

190 191
BOOL basetexture_set_dirty(IWineD3DBaseTexture *iface, BOOL dirty)
{
192 193
    BOOL old;
    IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
194
    old = This->baseTexture.dirty || This->baseTexture.srgbDirty;
195
    This->baseTexture.dirty = dirty;
196
    This->baseTexture.srgbDirty = dirty;
197 198 199
    return old;
}

200 201
BOOL basetexture_get_dirty(IWineD3DBaseTexture *iface)
{
202
    IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
203
    return This->baseTexture.dirty || This->baseTexture.srgbDirty;
204 205
}

206
HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surface_desc)
207
{
208
    IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
209
    HRESULT hr = WINED3D_OK;
210
    UINT textureDimensions;
211
    BOOL isNewTexture = FALSE;
212 213
    GLuint *texture;
    DWORD *states;
214 215
    TRACE("(%p) : About to bind texture\n", This);

216 217 218 219 220 221 222 223 224
    This->baseTexture.is_srgb = srgb; /* SRGB mode cache for PreLoad calls outside drawprim */
    if(srgb) {
        texture = &This->baseTexture.srgbTextureName;
        states = This->baseTexture.srgbstates;
    } else {
        texture = &This->baseTexture.textureName;
        states = This->baseTexture.states;
    }

225
    textureDimensions = IWineD3DBaseTexture_GetTextureDimensions(iface);
226 227
    ENTER_GL();
    /* Generate a texture name if we don't already have one */
228 229 230
    if (*texture == 0) {
        *set_surface_desc = TRUE;
        glGenTextures(1, texture);
231
        checkGLcall("glGenTextures");
232
        TRACE("Generated texture %d\n", *texture);
233
        if (This->resource.pool == WINED3DPOOL_DEFAULT) {
234 235 236
            /* Tell opengl to try and keep this texture in video ram (well mostly) */
            GLclampf tmp;
            tmp = 0.9f;
237
            glPrioritizeTextures(1, texture, &tmp);
238 239

        }
240
        /* Initialise the state of the texture object
241
        to the openGL defaults, not the directx defaults */
242 243 244 245 246 247 248 249 250 251 252 253 254
        states[WINED3DTEXSTA_ADDRESSU]      = WINED3DTADDRESS_WRAP;
        states[WINED3DTEXSTA_ADDRESSV]      = WINED3DTADDRESS_WRAP;
        states[WINED3DTEXSTA_ADDRESSW]      = WINED3DTADDRESS_WRAP;
        states[WINED3DTEXSTA_BORDERCOLOR]   = 0;
        states[WINED3DTEXSTA_MAGFILTER]     = WINED3DTEXF_LINEAR;
        states[WINED3DTEXSTA_MINFILTER]     = WINED3DTEXF_POINT; /* GL_NEAREST_MIPMAP_LINEAR */
        states[WINED3DTEXSTA_MIPFILTER]     = WINED3DTEXF_LINEAR; /* GL_NEAREST_MIPMAP_LINEAR */
        states[WINED3DTEXSTA_MAXMIPLEVEL]   = 0;
        states[WINED3DTEXSTA_MAXANISOTROPY] = 0;
        states[WINED3DTEXSTA_SRGBTEXTURE]   = 0;
        states[WINED3DTEXSTA_ELEMENTINDEX]  = 0;
        states[WINED3DTEXSTA_DMAPOFFSET]    = 0;
        states[WINED3DTEXSTA_TSSADDRESSW]   = WINED3DTADDRESS_WRAP;
255
        IWineD3DBaseTexture_SetDirty(iface, TRUE);
256
        isNewTexture = TRUE;
257 258 259 260 261

        if(This->resource.usage & WINED3DUSAGE_AUTOGENMIPMAP) {
            /* This means double binding the texture at creation, but keeps the code simpler all
             * in all, and the run-time path free from additional checks
             */
262
            glBindTexture(textureDimensions, *texture);
263 264 265 266
            checkGLcall("glBindTexture");
            glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
            checkGLcall("glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_SGIS, GL_TRUE)");
        }
267 268
    } else {
        *set_surface_desc = FALSE;
269 270 271
    }

    /* Bind the texture */
272 273
    if (*texture != 0) {
        glBindTexture(textureDimensions, *texture);
274
        checkGLcall("glBindTexture");
275
        if (isNewTexture) {
276
            /* For a new texture we have to set the textures levels after binding the texture.
277 278
             * In theory this is all we should ever have to do, but because ATI's drivers are broken, we
             * also need to set the texture dimensions before the texture is set
279 280 281
             * Beware that texture rectangles do not support mipmapping, but set the maxmiplevel if we're
             * relying on the partial GL_ARB_texture_non_power_of_two emulation with texture rectangles
             * (ie, do not care for cond_np2 here, just look for GL_TEXTURE_RECTANGLE_ARB)
282 283 284 285 286 287
             */
            if(textureDimensions != GL_TEXTURE_RECTANGLE_ARB) {
                TRACE("Setting GL_TEXTURE_MAX_LEVEL to %d\n", This->baseTexture.levels - 1);
                glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, This->baseTexture.levels - 1);
                checkGLcall("glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, This->baseTexture.levels)");
            }
288
            if(textureDimensions==GL_TEXTURE_CUBE_MAP_ARB) {
289
                /* Cubemaps are always set to clamp, regardless of the sampler state. */
290 291 292 293
                glTexParameteri(textureDimensions, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
                glTexParameteri(textureDimensions, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
                glTexParameteri(textureDimensions, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
            }
294
        }
295 296
    } else { /* this only happened if we've run out of openGL textures */
        WARN("This texture doesn't have an openGL texture assigned to it\n");
297
        hr =  WINED3DERR_INVALIDCALL;
298 299
    }

300 301
    LEAVE_GL();
    return hr;
302
}
303

304
/* GL locking is done by the caller */
305 306
static inline void apply_wrap(const GLint textureDimensions, const DWORD state, const GLint type,
                              BOOL cond_np2) {
307 308 309 310 311 312
    GLint wrapParm;

    if (state < minLookup[WINELOOKUP_WARPPARAM] || state > maxLookup[WINELOOKUP_WARPPARAM]) {
        FIXME("Unrecognized or unsupported WINED3DTADDRESS_U value %d\n", state);
    } else {
        if(textureDimensions==GL_TEXTURE_CUBE_MAP_ARB) {
313
            /* Cubemaps are always set to clamp, regardless of the sampler state. */
314
            wrapParm = GL_CLAMP_TO_EDGE;
315
        } else if(cond_np2) {
316 317 318 319 320
            if(state == WINED3DTADDRESS_WRAP) {
                wrapParm = GL_CLAMP_TO_EDGE;
            } else {
                wrapParm = stateLookup[WINELOOKUP_WARPPARAM][state - minLookup[WINELOOKUP_WARPPARAM]];
            }
321 322 323 324 325 326 327 328 329
        } else {
            wrapParm = stateLookup[WINELOOKUP_WARPPARAM][state - minLookup[WINELOOKUP_WARPPARAM]];
        }
        TRACE("Setting WRAP_S to %d for %x\n", wrapParm, textureDimensions);
        glTexParameteri(textureDimensions, type, wrapParm);
        checkGLcall("glTexParameteri(..., type, wrapParm)");
    }
}

330
/* GL locking is done by the caller (state handler) */
331 332 333 334
void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
        const DWORD textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1],
        const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1])
{
335
    IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
336
    DWORD state, *states;
337
    GLint textureDimensions = IWineD3DBaseTexture_GetTextureDimensions(iface);
338
    BOOL cond_np2 = IWineD3DBaseTexture_IsCondNP2(iface);
339

340 341
    TRACE("iface %p, textureStates %p, samplerStates %p\n", iface, textureStates, samplerStates);

342 343 344 345 346 347
    if(This->baseTexture.is_srgb) {
        states = This->baseTexture.srgbstates;
    } else {
        states = This->baseTexture.states;
    }

348
    /* This function relies on the correct texture being bound and loaded. */
349

350
    if(samplerStates[WINED3DSAMP_ADDRESSU]      != states[WINED3DTEXSTA_ADDRESSU]) {
351
        state = samplerStates[WINED3DSAMP_ADDRESSU];
352
        apply_wrap(textureDimensions, state, GL_TEXTURE_WRAP_S, cond_np2);
353
        states[WINED3DTEXSTA_ADDRESSU] = state;
354 355
    }

356
    if(samplerStates[WINED3DSAMP_ADDRESSV]      != states[WINED3DTEXSTA_ADDRESSV]) {
357
        state = samplerStates[WINED3DSAMP_ADDRESSV];
358
        apply_wrap(textureDimensions, state, GL_TEXTURE_WRAP_T, cond_np2);
359
        states[WINED3DTEXSTA_ADDRESSV] = state;
360 361
    }

362
    if(samplerStates[WINED3DSAMP_ADDRESSW]      != states[WINED3DTEXSTA_ADDRESSW]) {
363
        state = samplerStates[WINED3DSAMP_ADDRESSW];
364
        apply_wrap(textureDimensions, state, GL_TEXTURE_WRAP_R, cond_np2);
365
        states[WINED3DTEXSTA_ADDRESSW] = state;
366 367
    }

368
    if(samplerStates[WINED3DSAMP_BORDERCOLOR]   != states[WINED3DTEXSTA_BORDERCOLOR]) {
369 370 371 372 373 374 375
        float col[4];

        state = samplerStates[WINED3DSAMP_BORDERCOLOR];
        D3DCOLORTOGLFLOAT4(state, col);
        TRACE("Setting border color for %u to %x\n", textureDimensions, state);
        glTexParameterfv(textureDimensions, GL_TEXTURE_BORDER_COLOR, &col[0]);
        checkGLcall("glTexParameteri(..., GL_TEXTURE_BORDER_COLOR, ...)");
376
        states[WINED3DTEXSTA_BORDERCOLOR] = state;
377 378
    }

379
    if(samplerStates[WINED3DSAMP_MAGFILTER]     != states[WINED3DTEXSTA_MAGFILTER]) {
380 381
        GLint glValue;
        state = samplerStates[WINED3DSAMP_MAGFILTER];
382
        if (state > WINED3DTEXF_ANISOTROPIC) {
383
            FIXME("Unrecognized or unsupported MAGFILTER* value %d\n", state);
384
        } else {
385
            glValue = This->baseTexture.magLookup[state - WINED3DTEXF_NONE];
386 387 388 389
            TRACE("ValueMAG=%d setting MAGFILTER to %x\n", state, glValue);
            glTexParameteri(textureDimensions, GL_TEXTURE_MAG_FILTER, glValue);
            /* We need to reset the Anisotropic filtering state when we change the mag filter to WINED3DTEXF_ANISOTROPIC (this seems a bit weird, check the documentation to see how it should be switched off. */
            if (GL_SUPPORT(EXT_TEXTURE_FILTER_ANISOTROPIC) && WINED3DTEXF_ANISOTROPIC == state &&
390
                !cond_np2) {
391 392
                glTexParameteri(textureDimensions, GL_TEXTURE_MAX_ANISOTROPY_EXT, samplerStates[WINED3DSAMP_MAXANISOTROPY]);
            }
393
            states[WINED3DTEXSTA_MAGFILTER] = state;
394 395 396
        }
    }

397 398 399
    if((samplerStates[WINED3DSAMP_MINFILTER]     != states[WINED3DTEXSTA_MINFILTER] ||
        samplerStates[WINED3DSAMP_MIPFILTER]     != states[WINED3DTEXSTA_MIPFILTER] ||
        samplerStates[WINED3DSAMP_MAXMIPLEVEL]   != states[WINED3DTEXSTA_MAXMIPLEVEL])) {
400 401
        GLint glValue;

402 403 404
        states[WINED3DTEXSTA_MIPFILTER] = samplerStates[WINED3DSAMP_MIPFILTER];
        states[WINED3DTEXSTA_MINFILTER] = samplerStates[WINED3DSAMP_MINFILTER];
        states[WINED3DTEXSTA_MAXMIPLEVEL] = samplerStates[WINED3DSAMP_MAXMIPLEVEL];
405

406 407
        if (states[WINED3DTEXSTA_MINFILTER] > WINED3DTEXF_ANISOTROPIC ||
            states[WINED3DTEXSTA_MIPFILTER] > WINED3DTEXF_LINEAR)
408 409 410
        {

            FIXME("Unrecognized or unsupported D3DSAMP_MINFILTER value %d D3DSAMP_MIPFILTER value %d\n",
411 412
                  states[WINED3DTEXSTA_MINFILTER],
                  states[WINED3DTEXSTA_MIPFILTER]);
413
        }
414
        glValue = This->baseTexture.minMipLookup
415
                [min(max(samplerStates[WINED3DSAMP_MINFILTER],WINED3DTEXF_NONE), WINED3DTEXF_ANISOTROPIC)]
416
                .mip[min(max(samplerStates[WINED3DSAMP_MIPFILTER],WINED3DTEXF_NONE), WINED3DTEXF_LINEAR)];
417 418 419 420 421 422 423

        TRACE("ValueMIN=%d, ValueMIP=%d, setting MINFILTER to %x\n",
              samplerStates[WINED3DSAMP_MINFILTER],
              samplerStates[WINED3DSAMP_MIPFILTER], glValue);
        glTexParameteri(textureDimensions, GL_TEXTURE_MIN_FILTER, glValue);
        checkGLcall("glTexParameter GL_TEXTURE_MIN_FILTER, ...");

424
        if(!cond_np2) {
425
            if(states[WINED3DTEXSTA_MIPFILTER] == WINED3DTEXF_NONE) {
426
                glValue = 0;
427
            } else if(states[WINED3DTEXSTA_MAXMIPLEVEL] >= This->baseTexture.levels) {
428 429
                glValue = This->baseTexture.levels - 1;
            } else {
430
                glValue = states[WINED3DTEXSTA_MAXMIPLEVEL];
431 432
            }
            glTexParameteri(textureDimensions, GL_TEXTURE_BASE_LEVEL, glValue);
433 434 435
        }
    }

436
    if(samplerStates[WINED3DSAMP_MAXANISOTROPY] != states[WINED3DTEXSTA_MAXANISOTROPY]) {
437
        if (GL_SUPPORT(EXT_TEXTURE_FILTER_ANISOTROPIC) && !cond_np2) {
438 439 440 441
            glTexParameteri(textureDimensions, GL_TEXTURE_MAX_ANISOTROPY_EXT, samplerStates[WINED3DSAMP_MAXANISOTROPY]);
            checkGLcall("glTexParameteri GL_TEXTURE_MAX_ANISOTROPY_EXT ...");
        } else {
            WARN("Unsupported in local OpenGL implementation: glTexParameteri GL_TEXTURE_MAX_ANISOTROPY_EXT\n");
442
        }
443
        states[WINED3DTEXSTA_MAXANISOTROPY] = samplerStates[WINED3DSAMP_MAXANISOTROPY];
444 445
    }
}