Lines Matching full:this
5 * copy of this software and associated documentation files (the "Software"),
11 * The above copyright notice and this permission notice (including the next
41 NineBaseTexture9_ctor( struct NineBaseTexture9 *This, in NineBaseTexture9_ctor() argument
53 DBG("This=%p, pParams=%p initResource=%p Type=%d format=%d Pool=%d Usage=%d\n", in NineBaseTexture9_ctor()
54 This, pParams, initResource, Type, format, Pool, Usage); in NineBaseTexture9_ctor()
62 hr = NineResource9_ctor(&This->base, pParams, initResource, alloc, Type, Pool, Usage); in NineBaseTexture9_ctor()
66 This->format = format; in NineBaseTexture9_ctor()
67 This->mipfilter = (Usage & D3DUSAGE_AUTOGENMIPMAP) ? in NineBaseTexture9_ctor()
69 This->managed.lod = 0; in NineBaseTexture9_ctor()
70 This->managed.lod_resident = -1; in NineBaseTexture9_ctor()
74 This->managed.dirty = TRUE; in NineBaseTexture9_ctor()
78 * if z write is disabled. This particular feature may not work for us in in NineBaseTexture9_ctor()
80 * some cards have performance issues with this feature, so real apps in NineBaseTexture9_ctor()
82 This->shadow = (This->format != D3DFMT_INTZ && This->format != D3DFMT_DF16 && in NineBaseTexture9_ctor()
83 This->format != D3DFMT_DF24) && in NineBaseTexture9_ctor()
84 util_format_has_depth(util_format_description(This->base.info.format)); in NineBaseTexture9_ctor()
86 list_inithead(&This->list); in NineBaseTexture9_ctor()
87 list_inithead(&This->list2); in NineBaseTexture9_ctor()
89 list_add(&This->list2, &This->base.base.device->managed_textures); in NineBaseTexture9_ctor()
95 NineBaseTexture9_dtor( struct NineBaseTexture9 *This ) in NineBaseTexture9_dtor() argument
97 DBG("This=%p\n", This); in NineBaseTexture9_dtor()
99 pipe_sampler_view_reference(&This->view[0], NULL); in NineBaseTexture9_dtor()
100 pipe_sampler_view_reference(&This->view[1], NULL); in NineBaseTexture9_dtor()
102 if (This->list.prev != NULL && This->list.next != NULL) in NineBaseTexture9_dtor()
103 list_del(&This->list); in NineBaseTexture9_dtor()
104 if (This->list2.prev != NULL && This->list2.next != NULL) in NineBaseTexture9_dtor()
105 list_del(&This->list2); in NineBaseTexture9_dtor()
107 NineResource9_dtor(&This->base); in NineBaseTexture9_dtor()
111 NineBaseTexture9_SetLOD( struct NineBaseTexture9 *This, in NineBaseTexture9_SetLOD() argument
114 DWORD old = This->managed.lod; in NineBaseTexture9_SetLOD()
117 DBG("This=%p LODNew=%d\n", This, LODNew); in NineBaseTexture9_SetLOD()
119 user_assert(This->base.pool == D3DPOOL_MANAGED, 0); in NineBaseTexture9_SetLOD()
121 max_level = (This->base.usage & D3DUSAGE_AUTOGENMIPMAP) ? in NineBaseTexture9_SetLOD()
122 0 : This->base.info.last_level; in NineBaseTexture9_SetLOD()
123 This->managed.lod = MIN2(LODNew, max_level); in NineBaseTexture9_SetLOD()
125 if (This->managed.lod != old && This->bind_count && list_is_empty(&This->list)) in NineBaseTexture9_SetLOD()
126 list_add(&This->list, &This->base.base.device->update_textures); in NineBaseTexture9_SetLOD()
132 NineBaseTexture9_GetLOD( struct NineBaseTexture9 *This ) in NineBaseTexture9_GetLOD() argument
134 DBG("This=%p\n", This); in NineBaseTexture9_GetLOD()
136 return This->managed.lod; in NineBaseTexture9_GetLOD()
140 NineBaseTexture9_GetLevelCount( struct NineBaseTexture9 *This ) in NineBaseTexture9_GetLevelCount() argument
142 DBG("This=%p\n", This); in NineBaseTexture9_GetLevelCount()
144 if (This->base.usage & D3DUSAGE_AUTOGENMIPMAP) in NineBaseTexture9_GetLevelCount()
146 return This->base.info.last_level + 1; in NineBaseTexture9_GetLevelCount()
150 NineBaseTexture9_SetAutoGenFilterType( struct NineBaseTexture9 *This, in NineBaseTexture9_SetAutoGenFilterType() argument
153 DBG("This=%p FilterType=%d\n", This, FilterType); in NineBaseTexture9_SetAutoGenFilterType()
155 if (!(This->base.usage & D3DUSAGE_AUTOGENMIPMAP)) in NineBaseTexture9_SetAutoGenFilterType()
159 This->mipfilter = FilterType; in NineBaseTexture9_SetAutoGenFilterType()
160 This->dirty_mip = TRUE; in NineBaseTexture9_SetAutoGenFilterType()
161 NineBaseTexture9_GenerateMipSubLevels(This); in NineBaseTexture9_SetAutoGenFilterType()
167 NineBaseTexture9_GetAutoGenFilterType( struct NineBaseTexture9 *This ) in NineBaseTexture9_GetAutoGenFilterType() argument
169 DBG("This=%p\n", This); in NineBaseTexture9_GetAutoGenFilterType()
171 return This->mipfilter; in NineBaseTexture9_GetAutoGenFilterType()
175 NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This ) in NineBaseTexture9_UploadSelf() argument
178 unsigned last_level = This->base.info.last_level; in NineBaseTexture9_UploadSelf()
179 unsigned l, min_level_dirty = This->managed.lod; in NineBaseTexture9_UploadSelf()
182 DBG("This=%p dirty=%i type=%s\n", This, This->managed.dirty, in NineBaseTexture9_UploadSelf()
183 nine_D3DRTYPE_to_str(This->base.type)); in NineBaseTexture9_UploadSelf()
185 assert(This->base.pool == D3DPOOL_MANAGED); in NineBaseTexture9_UploadSelf()
187 if (This->base.usage & D3DUSAGE_AUTOGENMIPMAP) in NineBaseTexture9_UploadSelf()
190 update_lod = This->managed.lod_resident != This->managed.lod; in NineBaseTexture9_UploadSelf()
191 if (!update_lod && !This->managed.dirty) in NineBaseTexture9_UploadSelf()
200 DBG("updating LOD from %u to %u ...\n", This->managed.lod_resident, This->managed.lod); in NineBaseTexture9_UploadSelf()
202 pipe_sampler_view_reference(&This->view[0], NULL); in NineBaseTexture9_UploadSelf()
203 pipe_sampler_view_reference(&This->view[1], NULL); in NineBaseTexture9_UploadSelf()
206 hr = NineBaseTexture9_CreatePipeResource(This, This->managed.lod_resident != -1); in NineBaseTexture9_UploadSelf()
209 res = This->base.resource; in NineBaseTexture9_UploadSelf()
211 if (This->managed.lod_resident == -1) {/* no levels were resident */ in NineBaseTexture9_UploadSelf()
212 This->managed.dirty = FALSE; /* We are going to upload everything. */ in NineBaseTexture9_UploadSelf()
213 This->managed.lod_resident = This->base.info.last_level + 1; in NineBaseTexture9_UploadSelf()
216 if (This->base.type == D3DRTYPE_TEXTURE) { in NineBaseTexture9_UploadSelf()
217 struct NineTexture9 *tex = NineTexture9(This); in NineBaseTexture9_UploadSelf()
223 * corresponds to This->managed.lod). in NineBaseTexture9_UploadSelf()
225 * before This->managed.lod, negative with this implementation. */ in NineBaseTexture9_UploadSelf()
226 for (l = 0; l <= This->base.info.last_level; ++l) in NineBaseTexture9_UploadSelf()
227 NineSurface9_SetResource(tex->surfaces[l], res, l - This->managed.lod); in NineBaseTexture9_UploadSelf()
229 if (This->base.type == D3DRTYPE_CUBETEXTURE) { in NineBaseTexture9_UploadSelf()
230 struct NineCubeTexture9 *tex = NineCubeTexture9(This); in NineBaseTexture9_UploadSelf()
233 for (l = 0; l <= This->base.info.last_level; ++l) { in NineBaseTexture9_UploadSelf()
236 res, l - This->managed.lod); in NineBaseTexture9_UploadSelf()
239 if (This->base.type == D3DRTYPE_VOLUMETEXTURE) { in NineBaseTexture9_UploadSelf()
240 struct NineVolumeTexture9 *tex = NineVolumeTexture9(This); in NineBaseTexture9_UploadSelf()
242 for (l = 0; l <= This->base.info.last_level; ++l) in NineBaseTexture9_UploadSelf()
243 NineVolume9_SetResource(tex->volumes[l], res, l - This->managed.lod); in NineBaseTexture9_UploadSelf()
250 min_level_dirty = MAX2(This->managed.lod, This->managed.lod_resident); in NineBaseTexture9_UploadSelf()
254 if (This->managed.dirty) { in NineBaseTexture9_UploadSelf()
255 if (This->base.type == D3DRTYPE_TEXTURE) { in NineBaseTexture9_UploadSelf()
256 struct NineTexture9 *tex = NineTexture9(This); in NineBaseTexture9_UploadSelf()
277 if (This->base.type == D3DRTYPE_CUBETEXTURE) { in NineBaseTexture9_UploadSelf()
278 struct NineCubeTexture9 *tex = NineCubeTexture9(This); in NineBaseTexture9_UploadSelf()
299 if (This->base.type == D3DRTYPE_VOLUMETEXTURE) { in NineBaseTexture9_UploadSelf()
300 struct NineVolumeTexture9 *tex = NineVolumeTexture9(This); in NineBaseTexture9_UploadSelf()
317 This->managed.dirty = FALSE; in NineBaseTexture9_UploadSelf()
322 if (This->base.type == D3DRTYPE_TEXTURE) { in NineBaseTexture9_UploadSelf()
323 struct NineTexture9 *tex = NineTexture9(This); in NineBaseTexture9_UploadSelf()
328 for (l = This->managed.lod; l < This->managed.lod_resident; ++l) { in NineBaseTexture9_UploadSelf()
329 box.width = u_minify(This->base.info.width0, l); in NineBaseTexture9_UploadSelf()
330 box.height = u_minify(This->base.info.height0, l); in NineBaseTexture9_UploadSelf()
334 if (This->base.type == D3DRTYPE_CUBETEXTURE) { in NineBaseTexture9_UploadSelf()
335 struct NineCubeTexture9 *tex = NineCubeTexture9(This); in NineBaseTexture9_UploadSelf()
341 for (l = This->managed.lod; l < This->managed.lod_resident; ++l) { in NineBaseTexture9_UploadSelf()
342 box.width = u_minify(This->base.info.width0, l); in NineBaseTexture9_UploadSelf()
343 box.height = u_minify(This->base.info.height0, l); in NineBaseTexture9_UploadSelf()
348 if (This->base.type == D3DRTYPE_VOLUMETEXTURE) { in NineBaseTexture9_UploadSelf()
349 struct NineVolumeTexture9 *tex = NineVolumeTexture9(This); in NineBaseTexture9_UploadSelf()
353 for (l = This->managed.lod; l < This->managed.lod_resident; ++l) { in NineBaseTexture9_UploadSelf()
354 box.width = u_minify(This->base.info.width0, l); in NineBaseTexture9_UploadSelf()
355 box.height = u_minify(This->base.info.height0, l); in NineBaseTexture9_UploadSelf()
356 box.depth = u_minify(This->base.info.depth0, l); in NineBaseTexture9_UploadSelf()
363 This->managed.lod_resident = This->managed.lod; in NineBaseTexture9_UploadSelf()
366 if (This->base.usage & D3DUSAGE_AUTOGENMIPMAP) in NineBaseTexture9_UploadSelf()
367 This->dirty_mip = TRUE; in NineBaseTexture9_UploadSelf()
370 if (This->bind_count) { in NineBaseTexture9_UploadSelf()
371 struct nine_state *state = &This->base.base.device->state; in NineBaseTexture9_UploadSelf()
375 if (state->texture[s] == This) in NineBaseTexture9_UploadSelf()
376 nine_context_set_texture(This->base.base.device, s, This); in NineBaseTexture9_UploadSelf()
379 DBG("DONE, generate mip maps = %i\n", This->dirty_mip); in NineBaseTexture9_UploadSelf()
384 NineBaseTexture9_GenerateMipSubLevels( struct NineBaseTexture9 *This ) in NineBaseTexture9_GenerateMipSubLevels() argument
387 unsigned last_level = This->base.info.last_level - This->managed.lod; in NineBaseTexture9_GenerateMipSubLevels()
390 unsigned filter = This->mipfilter == D3DTEXF_POINT ? PIPE_TEX_FILTER_NEAREST in NineBaseTexture9_GenerateMipSubLevels()
392 DBG("This=%p\n", This); in NineBaseTexture9_GenerateMipSubLevels()
394 if (This->base.pool == D3DPOOL_MANAGED) in NineBaseTexture9_GenerateMipSubLevels()
395 NineBaseTexture9_UploadSelf(This); in NineBaseTexture9_GenerateMipSubLevels()
396 if (!This->dirty_mip) in NineBaseTexture9_GenerateMipSubLevels()
398 if (This->managed.lod) { in NineBaseTexture9_GenerateMipSubLevels()
403 if (!This->view[0]) in NineBaseTexture9_GenerateMipSubLevels()
404 NineBaseTexture9_UpdateSamplerView(This, 0); in NineBaseTexture9_GenerateMipSubLevels()
406 last_layer = util_max_layer(This->view[0]->texture, base_level); in NineBaseTexture9_GenerateMipSubLevels()
408 nine_context_gen_mipmap(This->base.base.device, (struct NineUnknown *)This, in NineBaseTexture9_GenerateMipSubLevels()
409 This->base.resource, in NineBaseTexture9_GenerateMipSubLevels()
413 This->dirty_mip = FALSE; in NineBaseTexture9_GenerateMipSubLevels()
417 NineBaseTexture9_CreatePipeResource( struct NineBaseTexture9 *This, in NineBaseTexture9_CreatePipeResource() argument
421 struct pipe_screen *screen = This->base.info.screen; in NineBaseTexture9_CreatePipeResource()
425 struct pipe_resource *old = This->base.resource; in NineBaseTexture9_CreatePipeResource()
427 DBG("This=%p lod=%u last_level=%u\n", This, in NineBaseTexture9_CreatePipeResource()
428 This->managed.lod, This->base.info.last_level); in NineBaseTexture9_CreatePipeResource()
430 assert(This->base.pool == D3DPOOL_MANAGED); in NineBaseTexture9_CreatePipeResource()
432 templ = This->base.info; in NineBaseTexture9_CreatePipeResource()
434 if (This->managed.lod) { in NineBaseTexture9_CreatePipeResource()
435 templ.width0 = u_minify(templ.width0, This->managed.lod); in NineBaseTexture9_CreatePipeResource()
436 templ.height0 = u_minify(templ.height0, This->managed.lod); in NineBaseTexture9_CreatePipeResource()
437 templ.depth0 = u_minify(templ.depth0, This->managed.lod); in NineBaseTexture9_CreatePipeResource()
439 templ.last_level = This->base.info.last_level - This->managed.lod; in NineBaseTexture9_CreatePipeResource()
449 res = nine_resource_create_with_retry(This->base.base.device, screen, &templ); in NineBaseTexture9_CreatePipeResource()
452 This->base.resource = res; in NineBaseTexture9_CreatePipeResource()
460 …l = (This->managed.lod < This->managed.lod_resident) ? This->managed.lod_resident - This->managed.… in NineBaseTexture9_CreatePipeResource()
461 …m = (This->managed.lod < This->managed.lod_resident) ? 0 : This->managed.lod - This->managed.lod_r… in NineBaseTexture9_CreatePipeResource()
467 pipe = nine_context_get_pipe_acquire(This->base.base.device); in NineBaseTexture9_CreatePipeResource()
478 nine_context_get_pipe_release(This->base.base.device); in NineBaseTexture9_CreatePipeResource()
490 NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This, in NineBaseTexture9_UpdateSamplerView() argument
495 struct pipe_screen *screen = NineDevice9_GetScreen(This->base.base.device); in NineBaseTexture9_UpdateSamplerView()
496 struct pipe_resource *resource = This->base.resource; in NineBaseTexture9_UpdateSamplerView()
502 DBG("This=%p sRGB=%d\n", This, sRGB); in NineBaseTexture9_UpdateSamplerView()
505 if (unlikely(This->format == D3DFMT_NULL)) in NineBaseTexture9_UpdateSamplerView()
507 NineBaseTexture9_Dump(This); in NineBaseTexture9_UpdateSamplerView()
511 pipe_sampler_view_reference(&This->view[sRGB], NULL); in NineBaseTexture9_UpdateSamplerView()
528 if (This->format == D3DFMT_DF16 || in NineBaseTexture9_UpdateSamplerView()
529 This->format == D3DFMT_DF24) { in NineBaseTexture9_UpdateSamplerView()
575 pipe = nine_context_get_pipe_acquire(This->base.base.device); in NineBaseTexture9_UpdateSamplerView()
576 This->view[sRGB] = pipe->create_sampler_view(pipe, resource, &templ); in NineBaseTexture9_UpdateSamplerView()
577 nine_context_get_pipe_release(This->base.base.device); in NineBaseTexture9_UpdateSamplerView()
579 DBG("sampler view = %p(resource = %p)\n", This->view[sRGB], resource); in NineBaseTexture9_UpdateSamplerView()
581 return This->view ? D3D_OK : D3DERR_DRIVERINTERNALERROR; in NineBaseTexture9_UpdateSamplerView()
585 NineBaseTexture9_PreLoad( struct NineBaseTexture9 *This ) in NineBaseTexture9_PreLoad() argument
587 DBG("This=%p\n", This); in NineBaseTexture9_PreLoad()
589 if (This->base.pool == D3DPOOL_MANAGED) in NineBaseTexture9_PreLoad()
590 NineBaseTexture9_UploadSelf(This); in NineBaseTexture9_PreLoad()
594 NineBaseTexture9_UnLoad( struct NineBaseTexture9 *This ) in NineBaseTexture9_UnLoad() argument
596 if (This->base.pool != D3DPOOL_MANAGED || in NineBaseTexture9_UnLoad()
597 This->managed.lod_resident == -1) in NineBaseTexture9_UnLoad()
600 DBG("This=%p, releasing resource\n", This); in NineBaseTexture9_UnLoad()
601 pipe_resource_reference(&This->base.resource, NULL); in NineBaseTexture9_UnLoad()
602 This->managed.lod_resident = -1; in NineBaseTexture9_UnLoad()
603 This->managed.dirty = TRUE; in NineBaseTexture9_UnLoad()
606 BASETEX_REGISTER_UPDATE(This); in NineBaseTexture9_UnLoad()
611 NineBaseTexture9_Dump( struct NineBaseTexture9 *This ) in NineBaseTexture9_Dump() argument
614 "Format=%s Dims=%ux%ux%u/%u LastLevel=%u Lod=%u(%u)\n", This, in NineBaseTexture9_Dump()
615 This->base.resource, in NineBaseTexture9_Dump()
616 nine_D3DPOOL_to_str(This->base.pool), in NineBaseTexture9_Dump()
617 nine_D3DRTYPE_to_str(This->base.type), in NineBaseTexture9_Dump()
618 nine_D3DUSAGE_to_str(This->base.usage), in NineBaseTexture9_Dump()
619 d3dformat_to_string(This->format), in NineBaseTexture9_Dump()
620 This->base.info.width0, This->base.info.height0, This->base.info.depth0, in NineBaseTexture9_Dump()
621 This->base.info.array_size, This->base.info.last_level, in NineBaseTexture9_Dump()
622 This->managed.lod, This->managed.lod_resident); in NineBaseTexture9_Dump()