st/nine: util_gen_mipmap doesn't need we reset states.
[mesa.git] / src / gallium / state_trackers / nine / basetexture9.c
1 /*
2 * Copyright 2011 Joakim Sindholt <opensource@zhasha.com>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE. */
22
23 #include "basetexture9.h"
24 #include "device9.h"
25
26 /* For UploadSelf: */
27 #include "texture9.h"
28 #include "cubetexture9.h"
29 #include "volumetexture9.h"
30
31 #ifdef DEBUG
32 #include "nine_pipe.h"
33 #include "nine_dump.h"
34 #endif
35
36 #include "util/u_format.h"
37 #include "util/u_gen_mipmap.h"
38
39 #define DBG_CHANNEL DBG_BASETEXTURE
40
41 HRESULT
42 NineBaseTexture9_ctor( struct NineBaseTexture9 *This,
43 struct NineUnknownParams *pParams,
44 struct pipe_resource *initResource,
45 D3DRESOURCETYPE Type,
46 D3DFORMAT format,
47 D3DPOOL Pool,
48 DWORD Usage)
49 {
50 BOOL alloc = (Pool == D3DPOOL_DEFAULT) && !initResource &&
51 (format != D3DFMT_NULL);
52 HRESULT hr;
53
54 DBG("This=%p, pParams=%p initResource=%p Type=%d format=%d Pool=%d Usage=%d\n",
55 This, pParams, initResource, Type, format, Pool, Usage);
56
57 user_assert(!(Usage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL)) ||
58 Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL);
59 user_assert(!(Usage & D3DUSAGE_DYNAMIC) ||
60 Pool != D3DPOOL_MANAGED, D3DERR_INVALIDCALL);
61
62 hr = NineResource9_ctor(&This->base, pParams, initResource, alloc, Type, Pool, Usage);
63 if (FAILED(hr))
64 return hr;
65
66 This->format = format;
67 This->pipe = pParams->device->pipe;
68 This->mipfilter = (Usage & D3DUSAGE_AUTOGENMIPMAP) ?
69 D3DTEXF_LINEAR : D3DTEXF_NONE;
70 This->managed.lod = 0;
71 This->managed.lod_resident = -1;
72 /* When a depth buffer is sampled, it is for shadow mapping, except for
73 * D3DFMT_INTZ, D3DFMT_DF16 and D3DFMT_DF24.
74 * In addition D3DFMT_INTZ can be used for both texturing and depth buffering
75 * if z write is disabled. This particular feature may not work for us in
76 * practice because OGL doesn't have that. However apparently it is known
77 * some cards have performance issues with this feature, so real apps
78 * shouldn't use it. */
79 This->shadow = (This->format != D3DFMT_INTZ && This->format != D3DFMT_DF16 &&
80 This->format != D3DFMT_DF24) &&
81 util_format_has_depth(util_format_description(This->base.info.format));
82
83 list_inithead(&This->list);
84
85 return D3D_OK;
86 }
87
88 void
89 NineBaseTexture9_dtor( struct NineBaseTexture9 *This )
90 {
91 DBG("This=%p\n", This);
92
93 pipe_sampler_view_reference(&This->view[0], NULL);
94 pipe_sampler_view_reference(&This->view[1], NULL);
95
96 if (This->list.prev != NULL && This->list.next != NULL)
97 list_del(&This->list),
98
99 NineResource9_dtor(&This->base);
100 }
101
102 DWORD WINAPI
103 NineBaseTexture9_SetLOD( struct NineBaseTexture9 *This,
104 DWORD LODNew )
105 {
106 DWORD old = This->managed.lod;
107
108 DBG("This=%p LODNew=%d\n", This, LODNew);
109
110 user_assert(This->base.pool == D3DPOOL_MANAGED, 0);
111
112 This->managed.lod = MIN2(LODNew, This->base.info.last_level);
113
114 if (This->managed.lod != old && This->bind_count && LIST_IS_EMPTY(&This->list))
115 list_add(&This->list, &This->base.base.device->update_textures);
116
117 return old;
118 }
119
120 DWORD WINAPI
121 NineBaseTexture9_GetLOD( struct NineBaseTexture9 *This )
122 {
123 DBG("This=%p\n", This);
124
125 return This->managed.lod;
126 }
127
128 DWORD WINAPI
129 NineBaseTexture9_GetLevelCount( struct NineBaseTexture9 *This )
130 {
131 DBG("This=%p\n", This);
132
133 if (This->base.usage & D3DUSAGE_AUTOGENMIPMAP)
134 return 1;
135 return This->base.info.last_level + 1;
136 }
137
138 HRESULT WINAPI
139 NineBaseTexture9_SetAutoGenFilterType( struct NineBaseTexture9 *This,
140 D3DTEXTUREFILTERTYPE FilterType )
141 {
142 DBG("This=%p FilterType=%d\n", This, FilterType);
143
144 if (!(This->base.usage & D3DUSAGE_AUTOGENMIPMAP))
145 return D3D_OK;
146 user_assert(FilterType != D3DTEXF_NONE, D3DERR_INVALIDCALL);
147
148 This->mipfilter = FilterType;
149
150 return D3D_OK;
151 }
152
153 D3DTEXTUREFILTERTYPE WINAPI
154 NineBaseTexture9_GetAutoGenFilterType( struct NineBaseTexture9 *This )
155 {
156 DBG("This=%p\n", This);
157
158 return This->mipfilter;
159 }
160
161 HRESULT
162 NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This )
163 {
164 HRESULT hr;
165 unsigned last_level = This->base.info.last_level;
166 unsigned l, min_level_dirty = This->managed.lod;
167 BOOL update_lod;
168
169 DBG("This=%p dirty=%i type=%s\n", This, This->managed.dirty,
170 nine_D3DRTYPE_to_str(This->base.type));
171
172 assert(This->base.pool == D3DPOOL_MANAGED);
173
174 if (This->base.usage & D3DUSAGE_AUTOGENMIPMAP)
175 last_level = 0; /* TODO: What if level 0 is not resident ? */
176
177 update_lod = This->managed.lod_resident != This->managed.lod;
178 if (!update_lod && !This->managed.dirty)
179 return D3D_OK;
180
181 /* Allocate a new resource with the correct number of levels,
182 * Mark states for update, and tell the nine surfaces/volumes
183 * their new resource. */
184 if (update_lod) {
185 struct pipe_resource *res;
186
187 DBG("updating LOD from %u to %u ...\n", This->managed.lod_resident, This->managed.lod);
188
189 pipe_sampler_view_reference(&This->view[0], NULL);
190 pipe_sampler_view_reference(&This->view[1], NULL);
191
192 if (This->bind_count) {
193 /* mark state dirty */
194 struct nine_state *state = &This->base.base.device->state;
195 unsigned s;
196 for (s = 0; s < NINE_MAX_SAMPLERS; ++s)
197 if (state->texture[s] == This)
198 state->changed.texture |= 1 << s;
199 if (state->changed.texture)
200 state->changed.group |= NINE_STATE_TEXTURE;
201 }
202
203 /* Allocate a new resource */
204 hr = NineBaseTexture9_CreatePipeResource(This, This->managed.lod_resident != -1);
205 if (FAILED(hr))
206 return hr;
207 res = This->base.resource;
208
209 if (This->managed.lod_resident == -1) {/* no levels were resident */
210 This->managed.dirty = FALSE; /* We are going to upload everything. */
211 This->managed.lod_resident = This->base.info.last_level + 1;
212 }
213
214 if (This->base.type == D3DRTYPE_TEXTURE) {
215 struct NineTexture9 *tex = NineTexture9(This);
216
217 /* last content (if apply) has been copied to the new resource.
218 * Note: We cannot render to surfaces of managed textures.
219 * Note2: the level argument passed is to get the level offset
220 * right when the texture is uploaded (the texture first level
221 * corresponds to This->managed.lod).
222 * Note3: We don't care about the value passed for the surfaces
223 * before This->managed.lod, negative with this implementation. */
224 for (l = 0; l <= This->base.info.last_level; ++l)
225 NineSurface9_SetResource(tex->surfaces[l], res, l - This->managed.lod);
226 } else
227 if (This->base.type == D3DRTYPE_CUBETEXTURE) {
228 struct NineCubeTexture9 *tex = NineCubeTexture9(This);
229 unsigned z;
230
231 for (l = 0; l <= This->base.info.last_level; ++l) {
232 for (z = 0; z < 6; ++z)
233 NineSurface9_SetResource(tex->surfaces[l * 6 + z],
234 res, l - This->managed.lod);
235 }
236 } else
237 if (This->base.type == D3DRTYPE_VOLUMETEXTURE) {
238 struct NineVolumeTexture9 *tex = NineVolumeTexture9(This);
239
240 for (l = 0; l <= This->base.info.last_level; ++l)
241 NineVolume9_SetResource(tex->volumes[l], res, l - This->managed.lod);
242 } else {
243 assert(!"invalid texture type");
244 }
245
246 /* We are going to fully upload the new levels,
247 * no need to update dirty parts of the texture for these */
248 min_level_dirty = MAX2(This->managed.lod, This->managed.lod_resident);
249 }
250
251 /* Update dirty parts of the texture */
252 if (This->managed.dirty) {
253 if (This->base.type == D3DRTYPE_TEXTURE) {
254 struct NineTexture9 *tex = NineTexture9(This);
255 struct pipe_box box;
256 box.z = 0;
257 box.depth = 1;
258
259 DBG("TEXTURE: dirty rect=(%u,%u) (%ux%u)\n",
260 tex->dirty_rect.x, tex->dirty_rect.y,
261 tex->dirty_rect.width, tex->dirty_rect.height);
262
263 /* Note: for l < min_level_dirty, the resource is
264 * either non-existing (and thus will be entirely re-uploaded
265 * if the lod changes) or going to have a full upload */
266 if (tex->dirty_rect.width) {
267 for (l = min_level_dirty; l <= last_level; ++l) {
268 u_box_minify_2d(&box, &tex->dirty_rect, l);
269 NineSurface9_UploadSelf(tex->surfaces[l], &box);
270 }
271 memset(&tex->dirty_rect, 0, sizeof(tex->dirty_rect));
272 tex->dirty_rect.depth = 1;
273 }
274 } else
275 if (This->base.type == D3DRTYPE_CUBETEXTURE) {
276 struct NineCubeTexture9 *tex = NineCubeTexture9(This);
277 unsigned z;
278 struct pipe_box box;
279 box.z = 0;
280 box.depth = 1;
281
282 for (z = 0; z < 6; ++z) {
283 DBG("FACE[%u]: dirty rect=(%u,%u) (%ux%u)\n", z,
284 tex->dirty_rect[z].x, tex->dirty_rect[z].y,
285 tex->dirty_rect[z].width, tex->dirty_rect[z].height);
286
287 if (tex->dirty_rect[z].width) {
288 for (l = min_level_dirty; l <= last_level; ++l) {
289 u_box_minify_2d(&box, &tex->dirty_rect[z], l);
290 NineSurface9_UploadSelf(tex->surfaces[l * 6 + z], &box);
291 }
292 memset(&tex->dirty_rect[z], 0, sizeof(tex->dirty_rect[z]));
293 tex->dirty_rect[z].depth = 1;
294 }
295 }
296 } else
297 if (This->base.type == D3DRTYPE_VOLUMETEXTURE) {
298 struct NineVolumeTexture9 *tex = NineVolumeTexture9(This);
299 struct pipe_box box;
300
301 DBG("VOLUME: dirty_box=(%u,%u,%u) (%ux%ux%u)\n",
302 tex->dirty_box.x, tex->dirty_box.y, tex->dirty_box.y,
303 tex->dirty_box.width, tex->dirty_box.height, tex->dirty_box.depth);
304
305 if (tex->dirty_box.width) {
306 for (l = 0; l <= last_level; ++l) {
307 u_box_minify_2d(&box, &tex->dirty_box, l);
308 NineVolume9_AddDirtyRegion(tex->volumes[l], &tex->dirty_box);
309 }
310 memset(&tex->dirty_box, 0, sizeof(tex->dirty_box));
311 }
312 for (l = min_level_dirty; l <= last_level; ++l)
313 NineVolume9_UploadSelf(tex->volumes[l]);
314 } else {
315 assert(!"invalid texture type");
316 }
317 This->managed.dirty = FALSE;
318 }
319
320 /* Upload the new levels */
321 if (update_lod) {
322 if (This->base.type == D3DRTYPE_TEXTURE) {
323 struct NineTexture9 *tex = NineTexture9(This);
324 struct pipe_box box;
325
326 box.x = box.y = box.z = 0;
327 box.depth = 1;
328 for (l = This->managed.lod; l < This->managed.lod_resident; ++l) {
329 box.width = u_minify(This->base.info.width0, l);
330 box.height = u_minify(This->base.info.height0, l);
331 NineSurface9_UploadSelf(tex->surfaces[l], &box);
332 }
333 } else
334 if (This->base.type == D3DRTYPE_CUBETEXTURE) {
335 struct NineCubeTexture9 *tex = NineCubeTexture9(This);
336 struct pipe_box box;
337 unsigned z;
338
339 box.x = box.y = box.z = 0;
340 box.depth = 1;
341 for (l = This->managed.lod; l < This->managed.lod_resident; ++l) {
342 box.width = u_minify(This->base.info.width0, l);
343 box.height = u_minify(This->base.info.height0, l);
344 for (z = 0; z < 6; ++z)
345 NineSurface9_UploadSelf(tex->surfaces[l * 6 + z], &box);
346 }
347 } else
348 if (This->base.type == D3DRTYPE_VOLUMETEXTURE) {
349 struct NineVolumeTexture9 *tex = NineVolumeTexture9(This);
350 struct pipe_box box;
351
352 box.x = box.y = box.z = 0;
353 for (l = This->managed.lod; l < This->managed.lod_resident; ++l) {
354 box.width = u_minify(This->base.info.width0, l);
355 box.height = u_minify(This->base.info.height0, l);
356 box.depth = u_minify(This->base.info.depth0, l);
357 NineVolume9_AddDirtyRegion(tex->volumes[l], &box);
358 NineVolume9_UploadSelf(tex->volumes[l]);
359 }
360 } else {
361 assert(!"invalid texture type");
362 }
363
364 This->managed.lod_resident = This->managed.lod;
365 }
366
367 if (This->base.usage & D3DUSAGE_AUTOGENMIPMAP)
368 This->dirty_mip = TRUE;
369 /* TODO: if dirty only because of lod change, only generate added levels */
370
371 DBG("DONE, generate mip maps = %i\n", This->dirty_mip);
372 return D3D_OK;
373 }
374
375 void WINAPI
376 NineBaseTexture9_GenerateMipSubLevels( struct NineBaseTexture9 *This )
377 {
378 struct pipe_resource *resource = This->base.resource;
379
380 unsigned base_level = 0;
381 unsigned last_level = This->base.info.last_level - This->managed.lod;
382 unsigned first_layer = 0;
383 unsigned last_layer;
384 unsigned filter = This->mipfilter == D3DTEXF_POINT ? PIPE_TEX_FILTER_NEAREST
385 : PIPE_TEX_FILTER_LINEAR;
386 DBG("This=%p\n", This);
387
388 if (This->base.pool == D3DPOOL_MANAGED)
389 NineBaseTexture9_UploadSelf(This);
390 if (!This->dirty_mip)
391 return;
392 if (This->managed.lod) {
393 ERR("AUTOGENMIPMAP if level 0 is not resident not supported yet !\n");
394 return;
395 }
396
397 if (!This->view[0])
398 NineBaseTexture9_UpdateSamplerView(This, 0);
399
400 last_layer = util_max_layer(This->view[0]->texture, base_level);
401
402 util_gen_mipmap(This->pipe, resource,
403 resource->format, base_level, last_level,
404 first_layer, last_layer, filter);
405
406 This->dirty_mip = FALSE;
407 }
408
409 HRESULT
410 NineBaseTexture9_CreatePipeResource( struct NineBaseTexture9 *This,
411 BOOL CopyData )
412 {
413 struct pipe_context *pipe = This->pipe;
414 struct pipe_screen *screen = This->base.info.screen;
415 struct pipe_resource templ;
416 unsigned l, m;
417 struct pipe_resource *res;
418 struct pipe_resource *old = This->base.resource;
419
420 DBG("This=%p lod=%u last_level=%u\n", This,
421 This->managed.lod, This->base.info.last_level);
422
423 assert(This->base.pool == D3DPOOL_MANAGED);
424
425 templ = This->base.info;
426
427 if (This->managed.lod) {
428 templ.width0 = u_minify(templ.width0, This->managed.lod);
429 templ.height0 = u_minify(templ.height0, This->managed.lod);
430 templ.depth0 = u_minify(templ.depth0, This->managed.lod);
431 }
432 templ.last_level = This->base.info.last_level - This->managed.lod;
433
434 if (old) {
435 /* LOD might have changed. */
436 if (old->width0 == templ.width0 &&
437 old->height0 == templ.height0 &&
438 old->depth0 == templ.depth0)
439 return D3D_OK;
440 }
441
442 res = screen->resource_create(screen, &templ);
443 if (!res)
444 return D3DERR_OUTOFVIDEOMEMORY;
445 This->base.resource = res;
446
447 if (old && CopyData) { /* Don't return without releasing old ! */
448 struct pipe_box box;
449 box.x = 0;
450 box.y = 0;
451 box.z = 0;
452
453 l = (This->managed.lod < This->managed.lod_resident) ? This->managed.lod_resident - This->managed.lod : 0;
454 m = (This->managed.lod < This->managed.lod_resident) ? 0 : This->managed.lod - This->managed.lod_resident;
455
456 box.width = u_minify(templ.width0, l);
457 box.height = u_minify(templ.height0, l);
458 box.depth = u_minify(templ.depth0, l);
459
460 for (; l <= templ.last_level; ++l, ++m) {
461 pipe->resource_copy_region(pipe,
462 res, l, 0, 0, 0,
463 old, m, &box);
464 box.width = u_minify(box.width, 1);
465 box.height = u_minify(box.height, 1);
466 box.depth = u_minify(box.depth, 1);
467 }
468 }
469 pipe_resource_reference(&old, NULL);
470
471 return D3D_OK;
472 }
473
474 #define SWIZZLE_TO_REPLACE(s) (s == UTIL_FORMAT_SWIZZLE_0 || \
475 s == UTIL_FORMAT_SWIZZLE_1 || \
476 s == UTIL_FORMAT_SWIZZLE_NONE)
477
478 HRESULT
479 NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This,
480 const int sRGB )
481 {
482 const struct util_format_description *desc;
483 struct pipe_context *pipe = This->pipe;
484 struct pipe_screen *screen = pipe->screen;
485 struct pipe_resource *resource = This->base.resource;
486 struct pipe_sampler_view templ;
487 enum pipe_format srgb_format;
488 unsigned i;
489 uint8_t swizzle[4];
490
491 DBG("This=%p sRGB=%d\n", This, sRGB);
492
493 if (unlikely(!resource)) {
494 if (unlikely(This->format == D3DFMT_NULL))
495 return D3D_OK;
496 NineBaseTexture9_Dump(This);
497 /* hack due to incorrect POOL_MANAGED handling */
498 NineBaseTexture9_GenerateMipSubLevels(This);
499 resource = This->base.resource;
500 }
501 assert(resource);
502
503 pipe_sampler_view_reference(&This->view[sRGB], NULL);
504
505 swizzle[0] = PIPE_SWIZZLE_RED;
506 swizzle[1] = PIPE_SWIZZLE_GREEN;
507 swizzle[2] = PIPE_SWIZZLE_BLUE;
508 swizzle[3] = PIPE_SWIZZLE_ALPHA;
509 desc = util_format_description(resource->format);
510 if (desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) {
511 /* msdn doc is incomplete here and wrong.
512 * The only formats that can be read directly here
513 * are DF16, DF24 and INTZ.
514 * Tested on win the swizzle is
515 * R = depth, G = B = 0, A = 1 for DF16 and DF24
516 * R = G = B = A = depth for INTZ
517 * For the other ZS formats that can't be read directly
518 * but can be used as shadow map, the result is duplicated on
519 * all channel */
520 if (This->format == D3DFMT_DF16 ||
521 This->format == D3DFMT_DF24) {
522 swizzle[1] = PIPE_SWIZZLE_ZERO;
523 swizzle[2] = PIPE_SWIZZLE_ZERO;
524 swizzle[3] = PIPE_SWIZZLE_ONE;
525 } else {
526 swizzle[1] = PIPE_SWIZZLE_RED;
527 swizzle[2] = PIPE_SWIZZLE_RED;
528 swizzle[3] = PIPE_SWIZZLE_RED;
529 }
530 } else if (resource->format != PIPE_FORMAT_A8_UNORM &&
531 resource->format != PIPE_FORMAT_RGTC1_UNORM) {
532 /* exceptions:
533 * A8 should have 0.0 as default values for RGB.
534 * ATI1/RGTC1 should be r 0 0 1 (tested on windows).
535 * It is already what gallium does. All the other ones
536 * should have 1.0 for non-defined values */
537 for (i = 0; i < 4; i++) {
538 if (SWIZZLE_TO_REPLACE(desc->swizzle[i]))
539 swizzle[i] = PIPE_SWIZZLE_ONE;
540 }
541 }
542
543 /* if requested and supported, convert to the sRGB format */
544 srgb_format = util_format_srgb(resource->format);
545 if (sRGB && srgb_format != PIPE_FORMAT_NONE &&
546 screen->is_format_supported(screen, srgb_format,
547 resource->target, 0, resource->bind))
548 templ.format = srgb_format;
549 else
550 templ.format = resource->format;
551 templ.u.tex.first_layer = 0;
552 templ.u.tex.last_layer = resource->target == PIPE_TEXTURE_3D ?
553 resource->depth0 - 1 : resource->array_size - 1;
554 templ.u.tex.first_level = 0;
555 templ.u.tex.last_level = resource->last_level;
556 templ.swizzle_r = swizzle[0];
557 templ.swizzle_g = swizzle[1];
558 templ.swizzle_b = swizzle[2];
559 templ.swizzle_a = swizzle[3];
560 templ.target = resource->target;
561
562 This->view[sRGB] = pipe->create_sampler_view(pipe, resource, &templ);
563
564 DBG("sampler view = %p(resource = %p)\n", This->view[sRGB], resource);
565
566 return This->view ? D3D_OK : D3DERR_DRIVERINTERNALERROR;
567 }
568
569 void WINAPI
570 NineBaseTexture9_PreLoad( struct NineBaseTexture9 *This )
571 {
572 DBG("This=%p\n", This);
573
574 if (This->base.pool == D3DPOOL_MANAGED)
575 NineBaseTexture9_UploadSelf(This);
576 }
577
578 #ifdef DEBUG
579 void
580 NineBaseTexture9_Dump( struct NineBaseTexture9 *This )
581 {
582 DBG("\nNineBaseTexture9(%p->NULL/%p): Pool=%s Type=%s Usage=%s\n"
583 "Format=%s Dims=%ux%ux%u/%u LastLevel=%u Lod=%u(%u)\n", This,
584 This->base.resource,
585 nine_D3DPOOL_to_str(This->base.pool),
586 nine_D3DRTYPE_to_str(This->base.type),
587 nine_D3DUSAGE_to_str(This->base.usage),
588 d3dformat_to_string(This->format),
589 This->base.info.width0, This->base.info.height0, This->base.info.depth0,
590 This->base.info.array_size, This->base.info.last_level,
591 This->managed.lod, This->managed.lod_resident);
592 }
593 #endif /* DEBUG */