Lines Matching refs:This
41 NineBaseTexture9_ctor( struct NineBaseTexture9 *This, in NineBaseTexture9_ctor() argument
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()
71 This->level_count = (Usage & D3DUSAGE_AUTOGENMIPMAP) ? 1 : (This->base.info.last_level+1); in NineBaseTexture9_ctor()
72 This->managed.lod = 0; in NineBaseTexture9_ctor()
73 This->managed.lod_resident = -1; in NineBaseTexture9_ctor()
77 This->managed.dirty = TRUE; in NineBaseTexture9_ctor()
85 This->shadow = (This->format != D3DFMT_INTZ && This->format != D3DFMT_DF16 && in NineBaseTexture9_ctor()
86 This->format != D3DFMT_DF24) && in NineBaseTexture9_ctor()
87 util_format_has_depth(util_format_description(This->base.info.format)); in NineBaseTexture9_ctor()
88 This->fetch4_compatible = fetch4_compatible_format(This->format); in NineBaseTexture9_ctor()
90 list_inithead(&This->list); in NineBaseTexture9_ctor()
91 list_inithead(&This->list2); in NineBaseTexture9_ctor()
93 list_add(&This->list2, &This->base.base.device->managed_textures); in NineBaseTexture9_ctor()
99 NineBaseTexture9_dtor( struct NineBaseTexture9 *This ) in NineBaseTexture9_dtor() argument
101 DBG("This=%p\n", This); in NineBaseTexture9_dtor()
103 pipe_sampler_view_reference(&This->view[0], NULL); in NineBaseTexture9_dtor()
104 pipe_sampler_view_reference(&This->view[1], NULL); in NineBaseTexture9_dtor()
106 if (list_is_linked(&This->list)) in NineBaseTexture9_dtor()
107 list_del(&This->list); in NineBaseTexture9_dtor()
108 if (list_is_linked(&This->list2)) in NineBaseTexture9_dtor()
109 list_del(&This->list2); in NineBaseTexture9_dtor()
111 NineResource9_dtor(&This->base); in NineBaseTexture9_dtor()
115 NineBaseTexture9_SetLOD( struct NineBaseTexture9 *This, in NineBaseTexture9_SetLOD() argument
118 DWORD old = This->managed.lod; in NineBaseTexture9_SetLOD()
120 DBG("This=%p LODNew=%d\n", This, LODNew); in NineBaseTexture9_SetLOD()
122 user_assert(This->base.pool == D3DPOOL_MANAGED, 0); in NineBaseTexture9_SetLOD()
124 This->managed.lod = MIN2(LODNew, This->level_count-1); in NineBaseTexture9_SetLOD()
126 if (This->managed.lod != old && This->bind_count && list_is_empty(&This->list)) in NineBaseTexture9_SetLOD()
127 list_add(&This->list, &This->base.base.device->update_textures); in NineBaseTexture9_SetLOD()
133 NineBaseTexture9_GetLOD( struct NineBaseTexture9 *This ) in NineBaseTexture9_GetLOD() argument
135 DBG("This=%p\n", This); in NineBaseTexture9_GetLOD()
137 return This->managed.lod; in NineBaseTexture9_GetLOD()
141 NineBaseTexture9_GetLevelCount( struct NineBaseTexture9 *This ) in NineBaseTexture9_GetLevelCount() argument
143 DBG("This=%p\n", This); in NineBaseTexture9_GetLevelCount()
145 return This->level_count; in NineBaseTexture9_GetLevelCount()
149 NineBaseTexture9_SetAutoGenFilterType( struct NineBaseTexture9 *This, in NineBaseTexture9_SetAutoGenFilterType() argument
152 DBG("This=%p FilterType=%d\n", This, FilterType); in NineBaseTexture9_SetAutoGenFilterType()
154 if (!(This->base.usage & D3DUSAGE_AUTOGENMIPMAP)) in NineBaseTexture9_SetAutoGenFilterType()
158 This->mipfilter = FilterType; in NineBaseTexture9_SetAutoGenFilterType()
159 This->dirty_mip = TRUE; in NineBaseTexture9_SetAutoGenFilterType()
160 NineBaseTexture9_GenerateMipSubLevels(This); in NineBaseTexture9_SetAutoGenFilterType()
166 NineBaseTexture9_GetAutoGenFilterType( struct NineBaseTexture9 *This ) in NineBaseTexture9_GetAutoGenFilterType() argument
168 DBG("This=%p\n", This); in NineBaseTexture9_GetAutoGenFilterType()
170 return This->mipfilter; in NineBaseTexture9_GetAutoGenFilterType()
174 NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This ) in NineBaseTexture9_UploadSelf() argument
177 unsigned l, min_level_dirty = This->managed.lod; in NineBaseTexture9_UploadSelf()
180 DBG("This=%p dirty=%i type=%s\n", This, This->managed.dirty, in NineBaseTexture9_UploadSelf()
181 nine_D3DRTYPE_to_str(This->base.type)); in NineBaseTexture9_UploadSelf()
183 assert(This->base.pool == D3DPOOL_MANAGED); in NineBaseTexture9_UploadSelf()
185 update_lod = This->managed.lod_resident != This->managed.lod; in NineBaseTexture9_UploadSelf()
186 if (!update_lod && !This->managed.dirty) in NineBaseTexture9_UploadSelf()
195 DBG("updating LOD from %u to %u ...\n", This->managed.lod_resident, This->managed.lod); in NineBaseTexture9_UploadSelf()
197 pipe_sampler_view_reference(&This->view[0], NULL); in NineBaseTexture9_UploadSelf()
198 pipe_sampler_view_reference(&This->view[1], NULL); in NineBaseTexture9_UploadSelf()
201 hr = NineBaseTexture9_CreatePipeResource(This, This->managed.lod_resident != -1); in NineBaseTexture9_UploadSelf()
204 res = This->base.resource; in NineBaseTexture9_UploadSelf()
206 if (This->managed.lod_resident == -1) {/* no levels were resident */ in NineBaseTexture9_UploadSelf()
207 This->managed.dirty = FALSE; /* We are going to upload everything. */ in NineBaseTexture9_UploadSelf()
208 This->managed.lod_resident = This->level_count; in NineBaseTexture9_UploadSelf()
211 if (This->base.type == D3DRTYPE_TEXTURE) { in NineBaseTexture9_UploadSelf()
212 struct NineTexture9 *tex = NineTexture9(This); in NineBaseTexture9_UploadSelf()
221 for (l = 0; l < This->level_count; ++l) in NineBaseTexture9_UploadSelf()
222 NineSurface9_SetResource(tex->surfaces[l], res, l - This->managed.lod); in NineBaseTexture9_UploadSelf()
224 if (This->base.type == D3DRTYPE_CUBETEXTURE) { in NineBaseTexture9_UploadSelf()
225 struct NineCubeTexture9 *tex = NineCubeTexture9(This); in NineBaseTexture9_UploadSelf()
228 for (l = 0; l < This->level_count; ++l) { in NineBaseTexture9_UploadSelf()
231 res, l - This->managed.lod); in NineBaseTexture9_UploadSelf()
234 if (This->base.type == D3DRTYPE_VOLUMETEXTURE) { in NineBaseTexture9_UploadSelf()
235 struct NineVolumeTexture9 *tex = NineVolumeTexture9(This); in NineBaseTexture9_UploadSelf()
237 for (l = 0; l < This->level_count; ++l) in NineBaseTexture9_UploadSelf()
238 NineVolume9_SetResource(tex->volumes[l], res, l - This->managed.lod); in NineBaseTexture9_UploadSelf()
245 min_level_dirty = MAX2(This->managed.lod, This->managed.lod_resident); in NineBaseTexture9_UploadSelf()
249 if (This->managed.dirty) { in NineBaseTexture9_UploadSelf()
250 if (This->base.type == D3DRTYPE_TEXTURE) { in NineBaseTexture9_UploadSelf()
251 struct NineTexture9 *tex = NineTexture9(This); in NineBaseTexture9_UploadSelf()
264 for (l = min_level_dirty; l < This->level_count; ++l) { in NineBaseTexture9_UploadSelf()
272 if (This->base.type == D3DRTYPE_CUBETEXTURE) { in NineBaseTexture9_UploadSelf()
273 struct NineCubeTexture9 *tex = NineCubeTexture9(This); in NineBaseTexture9_UploadSelf()
285 for (l = min_level_dirty; l < This->level_count; ++l) { in NineBaseTexture9_UploadSelf()
294 if (This->base.type == D3DRTYPE_VOLUMETEXTURE) { in NineBaseTexture9_UploadSelf()
295 struct NineVolumeTexture9 *tex = NineVolumeTexture9(This); in NineBaseTexture9_UploadSelf()
303 for (l = min_level_dirty; l < This->level_count; ++l) { in NineBaseTexture9_UploadSelf()
312 This->managed.dirty = FALSE; in NineBaseTexture9_UploadSelf()
317 if (This->base.type == D3DRTYPE_TEXTURE) { in NineBaseTexture9_UploadSelf()
318 struct NineTexture9 *tex = NineTexture9(This); in NineBaseTexture9_UploadSelf()
323 for (l = This->managed.lod; l < This->managed.lod_resident; ++l) { in NineBaseTexture9_UploadSelf()
324 box.width = u_minify(This->base.info.width0, l); in NineBaseTexture9_UploadSelf()
325 box.height = u_minify(This->base.info.height0, l); in NineBaseTexture9_UploadSelf()
329 if (This->base.type == D3DRTYPE_CUBETEXTURE) { in NineBaseTexture9_UploadSelf()
330 struct NineCubeTexture9 *tex = NineCubeTexture9(This); in NineBaseTexture9_UploadSelf()
336 for (l = This->managed.lod; l < This->managed.lod_resident; ++l) { in NineBaseTexture9_UploadSelf()
337 box.width = u_minify(This->base.info.width0, l); in NineBaseTexture9_UploadSelf()
338 box.height = u_minify(This->base.info.height0, l); in NineBaseTexture9_UploadSelf()
343 if (This->base.type == D3DRTYPE_VOLUMETEXTURE) { in NineBaseTexture9_UploadSelf()
344 struct NineVolumeTexture9 *tex = NineVolumeTexture9(This); in NineBaseTexture9_UploadSelf()
348 for (l = This->managed.lod; l < This->managed.lod_resident; ++l) { in NineBaseTexture9_UploadSelf()
349 box.width = u_minify(This->base.info.width0, l); in NineBaseTexture9_UploadSelf()
350 box.height = u_minify(This->base.info.height0, l); in NineBaseTexture9_UploadSelf()
351 box.depth = u_minify(This->base.info.depth0, l); in NineBaseTexture9_UploadSelf()
358 This->managed.lod_resident = This->managed.lod; in NineBaseTexture9_UploadSelf()
361 if (This->base.usage & D3DUSAGE_AUTOGENMIPMAP) in NineBaseTexture9_UploadSelf()
362 This->dirty_mip = TRUE; in NineBaseTexture9_UploadSelf()
365 if (This->bind_count) { in NineBaseTexture9_UploadSelf()
366 struct nine_state *state = &This->base.base.device->state; in NineBaseTexture9_UploadSelf()
370 if (state->texture[s] == This) in NineBaseTexture9_UploadSelf()
371 nine_context_set_texture(This->base.base.device, s, This); in NineBaseTexture9_UploadSelf()
374 DBG("DONE, generate mip maps = %i\n", This->dirty_mip); in NineBaseTexture9_UploadSelf()
379 NineBaseTexture9_GenerateMipSubLevels( struct NineBaseTexture9 *This ) in NineBaseTexture9_GenerateMipSubLevels() argument
382 unsigned last_level = This->base.info.last_level - This->managed.lod; in NineBaseTexture9_GenerateMipSubLevels()
385 unsigned filter = This->mipfilter == D3DTEXF_POINT ? PIPE_TEX_FILTER_NEAREST in NineBaseTexture9_GenerateMipSubLevels()
387 DBG("This=%p\n", This); in NineBaseTexture9_GenerateMipSubLevels()
389 if (This->base.pool == D3DPOOL_MANAGED) in NineBaseTexture9_GenerateMipSubLevels()
390 NineBaseTexture9_UploadSelf(This); in NineBaseTexture9_GenerateMipSubLevels()
391 if (!This->dirty_mip) in NineBaseTexture9_GenerateMipSubLevels()
393 if (This->managed.lod) { in NineBaseTexture9_GenerateMipSubLevels()
398 if (!This->view[0]) in NineBaseTexture9_GenerateMipSubLevels()
399 NineBaseTexture9_UpdateSamplerView(This, 0); in NineBaseTexture9_GenerateMipSubLevels()
401 last_layer = util_max_layer(This->view[0]->texture, base_level); in NineBaseTexture9_GenerateMipSubLevels()
403 nine_context_gen_mipmap(This->base.base.device, (struct NineUnknown *)This, in NineBaseTexture9_GenerateMipSubLevels()
404 This->base.resource, in NineBaseTexture9_GenerateMipSubLevels()
408 This->dirty_mip = FALSE; in NineBaseTexture9_GenerateMipSubLevels()
412 NineBaseTexture9_CreatePipeResource( struct NineBaseTexture9 *This, in NineBaseTexture9_CreatePipeResource() argument
416 struct pipe_screen *screen = This->base.info.screen; in NineBaseTexture9_CreatePipeResource()
420 struct pipe_resource *old = This->base.resource; in NineBaseTexture9_CreatePipeResource()
422 DBG("This=%p lod=%u last_level=%u\n", This, in NineBaseTexture9_CreatePipeResource()
423 This->managed.lod, This->base.info.last_level); in NineBaseTexture9_CreatePipeResource()
425 assert(This->base.pool == D3DPOOL_MANAGED); in NineBaseTexture9_CreatePipeResource()
427 templ = This->base.info; in NineBaseTexture9_CreatePipeResource()
429 if (This->managed.lod) { in NineBaseTexture9_CreatePipeResource()
430 templ.width0 = u_minify(templ.width0, This->managed.lod); in NineBaseTexture9_CreatePipeResource()
431 templ.height0 = u_minify(templ.height0, This->managed.lod); in NineBaseTexture9_CreatePipeResource()
432 templ.depth0 = u_minify(templ.depth0, This->managed.lod); in NineBaseTexture9_CreatePipeResource()
434 templ.last_level = This->base.info.last_level - This->managed.lod; in NineBaseTexture9_CreatePipeResource()
444 res = nine_resource_create_with_retry(This->base.base.device, screen, &templ); in NineBaseTexture9_CreatePipeResource()
447 This->base.resource = res; in NineBaseTexture9_CreatePipeResource()
455 …l = (This->managed.lod < This->managed.lod_resident) ? This->managed.lod_resident - This->managed.… in NineBaseTexture9_CreatePipeResource()
456 …m = (This->managed.lod < This->managed.lod_resident) ? 0 : This->managed.lod - This->managed.lod_r… in NineBaseTexture9_CreatePipeResource()
462 pipe = nine_context_get_pipe_acquire(This->base.base.device); in NineBaseTexture9_CreatePipeResource()
473 nine_context_get_pipe_release(This->base.base.device); in NineBaseTexture9_CreatePipeResource()
485 NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This, in NineBaseTexture9_UpdateSamplerView() argument
490 struct pipe_screen *screen = NineDevice9_GetScreen(This->base.base.device); in NineBaseTexture9_UpdateSamplerView()
491 struct pipe_resource *resource = This->base.resource; in NineBaseTexture9_UpdateSamplerView()
497 DBG("This=%p sRGB=%d\n", This, sRGB); in NineBaseTexture9_UpdateSamplerView()
500 if (unlikely(This->format == D3DFMT_NULL)) in NineBaseTexture9_UpdateSamplerView()
502 NineBaseTexture9_Dump(This); in NineBaseTexture9_UpdateSamplerView()
506 pipe_sampler_view_reference(&This->view[sRGB], NULL); in NineBaseTexture9_UpdateSamplerView()
523 if (This->format == D3DFMT_DF16 || in NineBaseTexture9_UpdateSamplerView()
524 This->format == D3DFMT_DF24) { in NineBaseTexture9_UpdateSamplerView()
570 pipe = nine_context_get_pipe_acquire(This->base.base.device); in NineBaseTexture9_UpdateSamplerView()
571 This->view[sRGB] = pipe->create_sampler_view(pipe, resource, &templ); in NineBaseTexture9_UpdateSamplerView()
572 nine_context_get_pipe_release(This->base.base.device); in NineBaseTexture9_UpdateSamplerView()
574 DBG("sampler view = %p(resource = %p)\n", This->view[sRGB], resource); in NineBaseTexture9_UpdateSamplerView()
576 return This->view[sRGB] ? D3D_OK : D3DERR_DRIVERINTERNALERROR; in NineBaseTexture9_UpdateSamplerView()
580 NineBaseTexture9_PreLoad( struct NineBaseTexture9 *This ) in NineBaseTexture9_PreLoad() argument
582 DBG("This=%p\n", This); in NineBaseTexture9_PreLoad()
584 if (This->base.pool == D3DPOOL_MANAGED) in NineBaseTexture9_PreLoad()
585 NineBaseTexture9_UploadSelf(This); in NineBaseTexture9_PreLoad()
589 NineBaseTexture9_UnLoad( struct NineBaseTexture9 *This ) in NineBaseTexture9_UnLoad() argument
591 DBG("This=%p\n", This); in NineBaseTexture9_UnLoad()
593 if (This->base.pool != D3DPOOL_MANAGED || in NineBaseTexture9_UnLoad()
594 This->managed.lod_resident == -1) in NineBaseTexture9_UnLoad()
597 DBG("This=%p, releasing resource\n", This); in NineBaseTexture9_UnLoad()
598 pipe_resource_reference(&This->base.resource, NULL); in NineBaseTexture9_UnLoad()
599 This->managed.lod_resident = -1; in NineBaseTexture9_UnLoad()
600 This->managed.dirty = TRUE; in NineBaseTexture9_UnLoad()
603 BASETEX_REGISTER_UPDATE(This); in NineBaseTexture9_UnLoad()
608 NineBaseTexture9_Dump( struct NineBaseTexture9 *This ) in NineBaseTexture9_Dump() argument
611 "Format=%s Dims=%ux%ux%u/%u LastLevel=%u Lod=%u(%u)\n", This, in NineBaseTexture9_Dump()
612 This->base.resource, in NineBaseTexture9_Dump()
613 nine_D3DPOOL_to_str(This->base.pool), in NineBaseTexture9_Dump()
614 nine_D3DRTYPE_to_str(This->base.type), in NineBaseTexture9_Dump()
615 nine_D3DUSAGE_to_str(This->base.usage), in NineBaseTexture9_Dump()
616 d3dformat_to_string(This->format), in NineBaseTexture9_Dump()
617 This->base.info.width0, This->base.info.height0, This->base.info.depth0, in NineBaseTexture9_Dump()
618 This->base.info.array_size, This->base.info.last_level, in NineBaseTexture9_Dump()
619 This->managed.lod, This->managed.lod_resident); in NineBaseTexture9_Dump()