2 * IWineD3DBaseTexture Implementation
4 * Copyright 2002-2004 Jason Edmeades
5 * Copyright 2002-2004 Raphael Junqueira
6 * Copyright 2005 Oliver Stieber
7 * Copyright 2007-2008 Stefan Dösinger for CodeWeavers
8 * Copyright 2009-2010 Henri Verbeet for CodeWeavers
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #include "wined3d_private.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture
);
30 HRESULT
basetexture_init(IWineD3DBaseTextureImpl
*texture
, const struct wined3d_texture_ops
*texture_ops
,
31 UINT layer_count
, UINT level_count
, WINED3DRESOURCETYPE resource_type
, IWineD3DDeviceImpl
*device
,
32 DWORD usage
, const struct wined3d_format
*format
, WINED3DPOOL pool
, void *parent
,
33 const struct wined3d_parent_ops
*parent_ops
, const struct wined3d_resource_ops
*resource_ops
)
37 hr
= resource_init(&texture
->resource
, resource_type
, device
,
38 0, usage
, format
, pool
, parent
, parent_ops
, resource_ops
);
41 WARN("Failed to initialize resource, returning %#x\n", hr
);
45 texture
->baseTexture
.texture_ops
= texture_ops
;
46 texture
->baseTexture
.sub_resources
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
,
47 level_count
* layer_count
* sizeof(*texture
->baseTexture
.sub_resources
));
48 if (!texture
->baseTexture
.sub_resources
)
50 ERR("Failed to allocate sub-resource array.\n");
51 resource_cleanup(&texture
->resource
);
55 texture
->baseTexture
.layer_count
= layer_count
;
56 texture
->baseTexture
.level_count
= level_count
;
57 texture
->baseTexture
.filterType
= (usage
& WINED3DUSAGE_AUTOGENMIPMAP
) ? WINED3DTEXF_LINEAR
: WINED3DTEXF_NONE
;
58 texture
->baseTexture
.LOD
= 0;
59 texture
->baseTexture
.texture_rgb
.dirty
= TRUE
;
60 texture
->baseTexture
.texture_srgb
.dirty
= TRUE
;
61 texture
->baseTexture
.is_srgb
= FALSE
;
62 texture
->baseTexture
.pow2Matrix_identity
= TRUE
;
64 if (texture
->resource
.format
->flags
& WINED3DFMT_FLAG_FILTERING
)
66 texture
->baseTexture
.minMipLookup
= minMipLookup
;
67 texture
->baseTexture
.magLookup
= magLookup
;
71 texture
->baseTexture
.minMipLookup
= minMipLookup_noFilter
;
72 texture
->baseTexture
.magLookup
= magLookup_noFilter
;
78 void basetexture_cleanup(IWineD3DBaseTextureImpl
*texture
)
80 basetexture_unload(texture
);
81 HeapFree(GetProcessHeap(), 0, texture
->baseTexture
.sub_resources
);
82 resource_cleanup(&texture
->resource
);
85 struct wined3d_resource
*basetexture_get_sub_resource(IWineD3DBaseTextureImpl
*texture
, UINT sub_resource_idx
)
87 UINT sub_count
= texture
->baseTexture
.level_count
* texture
->baseTexture
.layer_count
;
89 if (sub_resource_idx
>= sub_count
)
91 WARN("sub_resource_idx %u >= sub_count %u.\n", sub_resource_idx
, sub_count
);
95 return texture
->baseTexture
.sub_resources
[sub_resource_idx
];
98 /* A GL context is provided by the caller */
99 static void gltexture_delete(struct gl_texture
*tex
)
102 glDeleteTextures(1, &tex
->name
);
107 void basetexture_unload(IWineD3DBaseTextureImpl
*texture
)
109 IWineD3DDeviceImpl
*device
= texture
->resource
.device
;
110 struct wined3d_context
*context
= NULL
;
112 if (texture
->baseTexture
.texture_rgb
.name
|| texture
->baseTexture
.texture_srgb
.name
)
114 context
= context_acquire(device
, NULL
);
117 if (texture
->baseTexture
.texture_rgb
.name
)
118 gltexture_delete(&texture
->baseTexture
.texture_rgb
);
120 if (texture
->baseTexture
.texture_srgb
.name
)
121 gltexture_delete(&texture
->baseTexture
.texture_srgb
);
123 if (context
) context_release(context
);
125 basetexture_set_dirty(texture
, TRUE
);
127 resource_unload(&texture
->resource
);
130 DWORD
basetexture_set_lod(IWineD3DBaseTextureImpl
*texture
, DWORD lod
)
132 DWORD old
= texture
->baseTexture
.LOD
;
134 TRACE("texture %p, lod %u.\n", texture
, lod
);
136 /* The d3d9:texture test shows that SetLOD is ignored on non-managed
137 * textures. The call always returns 0, and GetLOD always returns 0. */
138 if (texture
->resource
.pool
!= WINED3DPOOL_MANAGED
)
140 TRACE("Ignoring SetLOD on %s texture, returning 0.\n", debug_d3dpool(texture
->resource
.pool
));
144 if (lod
>= texture
->baseTexture
.level_count
)
145 lod
= texture
->baseTexture
.level_count
- 1;
147 if (texture
->baseTexture
.LOD
!= lod
)
149 texture
->baseTexture
.LOD
= lod
;
151 texture
->baseTexture
.texture_rgb
.states
[WINED3DTEXSTA_MAXMIPLEVEL
] = ~0U;
152 texture
->baseTexture
.texture_srgb
.states
[WINED3DTEXSTA_MAXMIPLEVEL
] = ~0U;
153 if (texture
->baseTexture
.bindCount
)
154 IWineD3DDeviceImpl_MarkStateDirty(texture
->resource
.device
, STATE_SAMPLER(texture
->baseTexture
.sampler
));
160 DWORD
basetexture_get_lod(IWineD3DBaseTextureImpl
*texture
)
162 TRACE("texture %p, returning %u.\n", texture
, texture
->baseTexture
.LOD
);
164 return texture
->baseTexture
.LOD
;
167 DWORD
basetexture_get_level_count(IWineD3DBaseTextureImpl
*texture
)
169 TRACE("texture %p, returning %u.\n", texture
, texture
->baseTexture
.level_count
);
170 return texture
->baseTexture
.level_count
;
173 HRESULT
basetexture_set_autogen_filter_type(IWineD3DBaseTextureImpl
*texture
, WINED3DTEXTUREFILTERTYPE filter_type
)
175 TRACE("texture %p, filter_type %s.\n", texture
, debug_d3dtexturefiltertype(filter_type
));
177 if (!(texture
->resource
.usage
& WINED3DUSAGE_AUTOGENMIPMAP
))
179 WARN("Texture doesn't have AUTOGENMIPMAP usage.\n");
180 return WINED3DERR_INVALIDCALL
;
183 if (texture
->baseTexture
.filterType
!= filter_type
)
185 GLenum target
= texture
->baseTexture
.target
;
186 struct wined3d_context
*context
;
188 context
= context_acquire(texture
->resource
.device
, NULL
);
191 glBindTexture(target
, texture
->baseTexture
.texture_rgb
.name
);
192 checkGLcall("glBindTexture");
195 case WINED3DTEXF_NONE
:
196 case WINED3DTEXF_POINT
:
197 glTexParameteri(target
, GL_GENERATE_MIPMAP_HINT_SGIS
, GL_FASTEST
);
198 checkGLcall("glTexParameteri(target, GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST)");
201 case WINED3DTEXF_LINEAR
:
202 glTexParameteri(target
, GL_GENERATE_MIPMAP_HINT_SGIS
, GL_NICEST
);
203 checkGLcall("glTexParameteri(target, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST)");
207 WARN("Unexpected filter type %#x, setting to GL_NICEST.\n", filter_type
);
208 glTexParameteri(target
, GL_GENERATE_MIPMAP_HINT_SGIS
, GL_NICEST
);
209 checkGLcall("glTexParameteri(target, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST)");
214 context_release(context
);
216 texture
->baseTexture
.filterType
= filter_type
;
221 WINED3DTEXTUREFILTERTYPE
basetexture_get_autogen_filter_type(IWineD3DBaseTextureImpl
*texture
)
223 TRACE("texture %p.\n", texture
);
225 return texture
->baseTexture
.filterType
;
228 void basetexture_generate_mipmaps(IWineD3DBaseTextureImpl
*texture
)
230 /* TODO: Implement filters using GL_SGI_generate_mipmaps. */
231 FIXME("texture %p stub!\n", texture
);
234 void basetexture_set_dirty(IWineD3DBaseTextureImpl
*texture
, BOOL dirty
)
236 texture
->baseTexture
.texture_rgb
.dirty
= dirty
;
237 texture
->baseTexture
.texture_srgb
.dirty
= dirty
;
240 /* Context activation is done by the caller. */
241 HRESULT
basetexture_bind(IWineD3DBaseTextureImpl
*texture
, BOOL srgb
, BOOL
*set_surface_desc
)
243 HRESULT hr
= WINED3D_OK
;
244 GLenum textureDimensions
;
245 BOOL isNewTexture
= FALSE
;
246 struct gl_texture
*gl_tex
;
248 TRACE("texture %p, srgb %#x, set_surface_desc %p.\n", texture
, srgb
, set_surface_desc
);
250 texture
->baseTexture
.is_srgb
= srgb
; /* SRGB mode cache for PreLoad calls outside drawprim */
251 gl_tex
= basetexture_get_gl_texture(texture
, srgb
);
253 textureDimensions
= texture
->baseTexture
.target
;
256 /* Generate a texture name if we don't already have one */
259 *set_surface_desc
= TRUE
;
260 glGenTextures(1, &gl_tex
->name
);
261 checkGLcall("glGenTextures");
262 TRACE("Generated texture %d\n", gl_tex
->name
);
263 if (texture
->resource
.pool
== WINED3DPOOL_DEFAULT
)
265 /* Tell opengl to try and keep this texture in video ram (well mostly) */
268 glPrioritizeTextures(1, &gl_tex
->name
, &tmp
);
271 /* Initialise the state of the texture object
272 to the openGL defaults, not the directx defaults */
273 gl_tex
->states
[WINED3DTEXSTA_ADDRESSU
] = WINED3DTADDRESS_WRAP
;
274 gl_tex
->states
[WINED3DTEXSTA_ADDRESSV
] = WINED3DTADDRESS_WRAP
;
275 gl_tex
->states
[WINED3DTEXSTA_ADDRESSW
] = WINED3DTADDRESS_WRAP
;
276 gl_tex
->states
[WINED3DTEXSTA_BORDERCOLOR
] = 0;
277 gl_tex
->states
[WINED3DTEXSTA_MAGFILTER
] = WINED3DTEXF_LINEAR
;
278 gl_tex
->states
[WINED3DTEXSTA_MINFILTER
] = WINED3DTEXF_POINT
; /* GL_NEAREST_MIPMAP_LINEAR */
279 gl_tex
->states
[WINED3DTEXSTA_MIPFILTER
] = WINED3DTEXF_LINEAR
; /* GL_NEAREST_MIPMAP_LINEAR */
280 gl_tex
->states
[WINED3DTEXSTA_MAXMIPLEVEL
] = 0;
281 gl_tex
->states
[WINED3DTEXSTA_MAXANISOTROPY
] = 1;
282 gl_tex
->states
[WINED3DTEXSTA_SRGBTEXTURE
] = 0;
283 gl_tex
->states
[WINED3DTEXSTA_SHADOW
] = FALSE
;
284 basetexture_set_dirty(texture
, TRUE
);
287 if (texture
->resource
.usage
& WINED3DUSAGE_AUTOGENMIPMAP
)
289 /* This means double binding the texture at creation, but keeps the code simpler all
290 * in all, and the run-time path free from additional checks
292 glBindTexture(textureDimensions
, gl_tex
->name
);
293 checkGLcall("glBindTexture");
294 glTexParameteri(textureDimensions
, GL_GENERATE_MIPMAP_SGIS
, GL_TRUE
);
295 checkGLcall("glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_SGIS, GL_TRUE)");
298 *set_surface_desc
= FALSE
;
301 /* Bind the texture */
304 glBindTexture(textureDimensions
, gl_tex
->name
);
305 checkGLcall("glBindTexture");
307 /* For a new texture we have to set the textures levels after binding the texture.
308 * In theory this is all we should ever have to do, but because ATI's drivers are broken, we
309 * also need to set the texture dimensions before the texture is set
310 * Beware that texture rectangles do not support mipmapping, but set the maxmiplevel if we're
311 * relying on the partial GL_ARB_texture_non_power_of_two emulation with texture rectangles
312 * (ie, do not care for cond_np2 here, just look for GL_TEXTURE_RECTANGLE_ARB)
314 if (textureDimensions
!= GL_TEXTURE_RECTANGLE_ARB
)
316 TRACE("Setting GL_TEXTURE_MAX_LEVEL to %u.\n", texture
->baseTexture
.level_count
- 1);
317 glTexParameteri(textureDimensions
, GL_TEXTURE_MAX_LEVEL
, texture
->baseTexture
.level_count
- 1);
318 checkGLcall("glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, texture->baseTexture.level_count)");
320 if(textureDimensions
==GL_TEXTURE_CUBE_MAP_ARB
) {
321 /* Cubemaps are always set to clamp, regardless of the sampler state. */
322 glTexParameteri(textureDimensions
, GL_TEXTURE_WRAP_S
, GL_CLAMP_TO_EDGE
);
323 glTexParameteri(textureDimensions
, GL_TEXTURE_WRAP_T
, GL_CLAMP_TO_EDGE
);
324 glTexParameteri(textureDimensions
, GL_TEXTURE_WRAP_R
, GL_CLAMP_TO_EDGE
);
327 } else { /* this only happened if we've run out of openGL textures */
328 WARN("This texture doesn't have an openGL texture assigned to it\n");
329 hr
= WINED3DERR_INVALIDCALL
;
336 /* GL locking is done by the caller */
337 static void apply_wrap(const struct wined3d_gl_info
*gl_info
, GLenum target
,
338 WINED3DTEXTUREADDRESS d3d_wrap
, GLenum param
, BOOL cond_np2
)
342 if (d3d_wrap
< WINED3DTADDRESS_WRAP
|| d3d_wrap
> WINED3DTADDRESS_MIRRORONCE
)
344 FIXME("Unrecognized or unsupported WINED3DTEXTUREADDRESS %#x.\n", d3d_wrap
);
348 if (target
== GL_TEXTURE_CUBE_MAP_ARB
349 || (cond_np2
&& d3d_wrap
== WINED3DTADDRESS_WRAP
))
351 /* Cubemaps are always set to clamp, regardless of the sampler state. */
352 gl_wrap
= GL_CLAMP_TO_EDGE
;
356 gl_wrap
= gl_info
->wrap_lookup
[d3d_wrap
- WINED3DTADDRESS_WRAP
];
359 TRACE("Setting param %#x to %#x for target %#x.\n", param
, gl_wrap
, target
);
360 glTexParameteri(target
, param
, gl_wrap
);
361 checkGLcall("glTexParameteri(target, param, gl_wrap)");
364 /* GL locking is done by the caller (state handler) */
365 void basetexture_apply_state_changes(IWineD3DBaseTextureImpl
*texture
,
366 const DWORD samplerStates
[WINED3D_HIGHEST_SAMPLER_STATE
+ 1],
367 const struct wined3d_gl_info
*gl_info
)
369 BOOL cond_np2
= IWineD3DBaseTexture_IsCondNP2((IWineD3DBaseTexture
*)texture
);
370 GLenum textureDimensions
= texture
->baseTexture
.target
;
373 struct gl_texture
*gl_tex
;
375 TRACE("texture %p, samplerStates %p\n", texture
, samplerStates
);
377 gl_tex
= basetexture_get_gl_texture(texture
, texture
->baseTexture
.is_srgb
);
379 /* This function relies on the correct texture being bound and loaded. */
381 if(samplerStates
[WINED3DSAMP_ADDRESSU
] != gl_tex
->states
[WINED3DTEXSTA_ADDRESSU
]) {
382 state
= samplerStates
[WINED3DSAMP_ADDRESSU
];
383 apply_wrap(gl_info
, textureDimensions
, state
, GL_TEXTURE_WRAP_S
, cond_np2
);
384 gl_tex
->states
[WINED3DTEXSTA_ADDRESSU
] = state
;
387 if(samplerStates
[WINED3DSAMP_ADDRESSV
] != gl_tex
->states
[WINED3DTEXSTA_ADDRESSV
]) {
388 state
= samplerStates
[WINED3DSAMP_ADDRESSV
];
389 apply_wrap(gl_info
, textureDimensions
, state
, GL_TEXTURE_WRAP_T
, cond_np2
);
390 gl_tex
->states
[WINED3DTEXSTA_ADDRESSV
] = state
;
393 if(samplerStates
[WINED3DSAMP_ADDRESSW
] != gl_tex
->states
[WINED3DTEXSTA_ADDRESSW
]) {
394 state
= samplerStates
[WINED3DSAMP_ADDRESSW
];
395 apply_wrap(gl_info
, textureDimensions
, state
, GL_TEXTURE_WRAP_R
, cond_np2
);
396 gl_tex
->states
[WINED3DTEXSTA_ADDRESSW
] = state
;
399 if(samplerStates
[WINED3DSAMP_BORDERCOLOR
] != gl_tex
->states
[WINED3DTEXSTA_BORDERCOLOR
]) {
402 state
= samplerStates
[WINED3DSAMP_BORDERCOLOR
];
403 D3DCOLORTOGLFLOAT4(state
, col
);
404 TRACE("Setting border color for %u to %x\n", textureDimensions
, state
);
405 glTexParameterfv(textureDimensions
, GL_TEXTURE_BORDER_COLOR
, &col
[0]);
406 checkGLcall("glTexParameterfv(..., GL_TEXTURE_BORDER_COLOR, ...)");
407 gl_tex
->states
[WINED3DTEXSTA_BORDERCOLOR
] = state
;
410 if(samplerStates
[WINED3DSAMP_MAGFILTER
] != gl_tex
->states
[WINED3DTEXSTA_MAGFILTER
]) {
412 state
= samplerStates
[WINED3DSAMP_MAGFILTER
];
413 if (state
> WINED3DTEXF_ANISOTROPIC
) {
414 FIXME("Unrecognized or unsupported MAGFILTER* value %d\n", state
);
417 glValue
= wined3d_gl_mag_filter(texture
->baseTexture
.magLookup
,
418 min(max(state
, WINED3DTEXF_POINT
), WINED3DTEXF_LINEAR
));
419 TRACE("ValueMAG=%d setting MAGFILTER to %x\n", state
, glValue
);
420 glTexParameteri(textureDimensions
, GL_TEXTURE_MAG_FILTER
, glValue
);
422 gl_tex
->states
[WINED3DTEXSTA_MAGFILTER
] = state
;
425 if((samplerStates
[WINED3DSAMP_MINFILTER
] != gl_tex
->states
[WINED3DTEXSTA_MINFILTER
] ||
426 samplerStates
[WINED3DSAMP_MIPFILTER
] != gl_tex
->states
[WINED3DTEXSTA_MIPFILTER
] ||
427 samplerStates
[WINED3DSAMP_MAXMIPLEVEL
] != gl_tex
->states
[WINED3DTEXSTA_MAXMIPLEVEL
])) {
430 gl_tex
->states
[WINED3DTEXSTA_MIPFILTER
] = samplerStates
[WINED3DSAMP_MIPFILTER
];
431 gl_tex
->states
[WINED3DTEXSTA_MINFILTER
] = samplerStates
[WINED3DSAMP_MINFILTER
];
432 gl_tex
->states
[WINED3DTEXSTA_MAXMIPLEVEL
] = samplerStates
[WINED3DSAMP_MAXMIPLEVEL
];
434 if (gl_tex
->states
[WINED3DTEXSTA_MINFILTER
] > WINED3DTEXF_ANISOTROPIC
435 || gl_tex
->states
[WINED3DTEXSTA_MIPFILTER
] > WINED3DTEXF_ANISOTROPIC
)
438 FIXME("Unrecognized or unsupported D3DSAMP_MINFILTER value %d D3DSAMP_MIPFILTER value %d\n",
439 gl_tex
->states
[WINED3DTEXSTA_MINFILTER
],
440 gl_tex
->states
[WINED3DTEXSTA_MIPFILTER
]);
442 glValue
= wined3d_gl_min_mip_filter(texture
->baseTexture
.minMipLookup
,
443 min(max(samplerStates
[WINED3DSAMP_MINFILTER
], WINED3DTEXF_POINT
), WINED3DTEXF_LINEAR
),
444 min(max(samplerStates
[WINED3DSAMP_MIPFILTER
], WINED3DTEXF_NONE
), WINED3DTEXF_LINEAR
));
446 TRACE("ValueMIN=%d, ValueMIP=%d, setting MINFILTER to %x\n",
447 samplerStates
[WINED3DSAMP_MINFILTER
],
448 samplerStates
[WINED3DSAMP_MIPFILTER
], glValue
);
449 glTexParameteri(textureDimensions
, GL_TEXTURE_MIN_FILTER
, glValue
);
450 checkGLcall("glTexParameter GL_TEXTURE_MIN_FILTER, ...");
454 if (gl_tex
->states
[WINED3DTEXSTA_MIPFILTER
] == WINED3DTEXF_NONE
)
455 glValue
= texture
->baseTexture
.LOD
;
456 else if (gl_tex
->states
[WINED3DTEXSTA_MAXMIPLEVEL
] >= texture
->baseTexture
.level_count
)
457 glValue
= texture
->baseTexture
.level_count
- 1;
458 else if (gl_tex
->states
[WINED3DTEXSTA_MAXMIPLEVEL
] < texture
->baseTexture
.LOD
)
459 /* baseTexture.LOD is already clamped in the setter */
460 glValue
= texture
->baseTexture
.LOD
;
462 glValue
= gl_tex
->states
[WINED3DTEXSTA_MAXMIPLEVEL
];
464 /* Note that D3DSAMP_MAXMIPLEVEL specifies the biggest mipmap(default 0), while
465 * GL_TEXTURE_MAX_LEVEL specifies the smallest mimap used(default 1000).
466 * So D3DSAMP_MAXMIPLEVEL is the same as GL_TEXTURE_BASE_LEVEL.
468 glTexParameteri(textureDimensions
, GL_TEXTURE_BASE_LEVEL
, glValue
);
472 if ((gl_tex
->states
[WINED3DTEXSTA_MAGFILTER
] != WINED3DTEXF_ANISOTROPIC
473 && gl_tex
->states
[WINED3DTEXSTA_MINFILTER
] != WINED3DTEXF_ANISOTROPIC
474 && gl_tex
->states
[WINED3DTEXSTA_MIPFILTER
] != WINED3DTEXF_ANISOTROPIC
)
481 aniso
= samplerStates
[WINED3DSAMP_MAXANISOTROPY
];
484 if (gl_tex
->states
[WINED3DTEXSTA_MAXANISOTROPY
] != aniso
)
486 if (gl_info
->supported
[EXT_TEXTURE_FILTER_ANISOTROPIC
])
488 glTexParameteri(textureDimensions
, GL_TEXTURE_MAX_ANISOTROPY_EXT
, aniso
);
489 checkGLcall("glTexParameteri(GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso)");
493 WARN("Anisotropic filtering not supported.\n");
495 gl_tex
->states
[WINED3DTEXSTA_MAXANISOTROPY
] = aniso
;
498 if (!(texture
->resource
.format
->flags
& WINED3DFMT_FLAG_SHADOW
)
499 != !gl_tex
->states
[WINED3DTEXSTA_SHADOW
])
501 if (texture
->resource
.format
->flags
& WINED3DFMT_FLAG_SHADOW
)
503 glTexParameteri(textureDimensions
, GL_DEPTH_TEXTURE_MODE_ARB
, GL_LUMINANCE
);
504 glTexParameteri(textureDimensions
, GL_TEXTURE_COMPARE_MODE_ARB
, GL_COMPARE_R_TO_TEXTURE_ARB
);
505 checkGLcall("glTexParameteri(textureDimensions, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB)");
506 gl_tex
->states
[WINED3DTEXSTA_SHADOW
] = TRUE
;
510 glTexParameteri(textureDimensions
, GL_TEXTURE_COMPARE_MODE_ARB
, GL_NONE
);
511 checkGLcall("glTexParameteri(textureDimensions, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE)");
512 gl_tex
->states
[WINED3DTEXSTA_SHADOW
] = FALSE
;