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
48 NineSurface9_CreatePipeSurfaces( struct NineSurface9 *This );
51 NineSurface9_ctor( struct NineSurface9 *This, in NineSurface9_ctor() argument
65 DBG("This=%p pDevice=%p pResource=%p Level=%u Layer=%u pDesc=%p\n", in NineSurface9_ctor()
66 This, pParams->device, pResource, Level, Layer, pDesc); in NineSurface9_ctor()
68 /* Mark this as a special surface held by another internal resource. */ in NineSurface9_ctor()
82 This->data = (uint8_t *)user_buffer; in NineSurface9_ctor()
96 /* TODO: this is (except width and height) duplicate from in NineSurface9_ctor()
99 This->base.info.screen = pParams->device->screen; in NineSurface9_ctor()
100 This->base.info.target = PIPE_TEXTURE_2D; in NineSurface9_ctor()
101 This->base.info.width0 = pDesc->Width; in NineSurface9_ctor()
102 This->base.info.height0 = pDesc->Height; in NineSurface9_ctor()
103 This->base.info.depth0 = 1; in NineSurface9_ctor()
104 This->base.info.last_level = 0; in NineSurface9_ctor()
105 This->base.info.array_size = 1; in NineSurface9_ctor()
106 This->base.info.nr_samples = multisample_type; in NineSurface9_ctor()
107 This->base.info.nr_storage_samples = multisample_type; in NineSurface9_ctor()
108 This->base.info.usage = PIPE_USAGE_DEFAULT; in NineSurface9_ctor()
109 This->base.info.bind = PIPE_BIND_SAMPLER_VIEW; /* StretchRect */ in NineSurface9_ctor()
112 This->base.info.bind |= PIPE_BIND_RENDER_TARGET; in NineSurface9_ctor()
116 This->base.info.bind = d3d9_get_pipe_depth_format_bindings(pDesc->Format); in NineSurface9_ctor()
118 This->base.info.bind |= PIPE_BIND_SAMPLER_VIEW; in NineSurface9_ctor()
121 This->base.info.flags = 0; in NineSurface9_ctor()
122 This->base.info.format = d3d9_to_pipe_format_checked(This->base.info.screen, in NineSurface9_ctor()
124 This->base.info.target, in NineSurface9_ctor()
125 This->base.info.nr_samples, in NineSurface9_ctor()
126 This->base.info.bind, in NineSurface9_ctor()
130 if (This->base.info.format == PIPE_FORMAT_NONE && pDesc->Format != D3DFMT_NULL) in NineSurface9_ctor()
134 const unsigned w = util_format_get_blockwidth(This->base.info.format); in NineSurface9_ctor()
135 const unsigned h = util_format_get_blockheight(This->base.info.format); in NineSurface9_ctor()
142 This->format_internal = d3d9_to_pipe_format_checked(This->base.info.screen, in NineSurface9_ctor()
144 This->base.info.target, in NineSurface9_ctor()
145 This->base.info.nr_samples, in NineSurface9_ctor()
146 This->base.info.bind, in NineSurface9_ctor()
149 if (This->base.info.format != This->format_internal || in NineSurface9_ctor()
154 This->data_internal = align_calloc( in NineSurface9_ctor()
155 nine_format_get_level_alloc_size(This->format_internal, in NineSurface9_ctor()
159 if (!This->data_internal) in NineSurface9_ctor()
161 This->stride_internal = nine_format_get_stride(This->format_internal, in NineSurface9_ctor()
168 This->data = align_calloc( in NineSurface9_ctor()
169 nine_format_get_level_alloc_size(This->base.info.format, in NineSurface9_ctor()
173 if (!This->data) in NineSurface9_ctor()
177 hr = NineResource9_ctor(&This->base, pParams, pResource, in NineSurface9_ctor()
184 This->transfer = NULL; in NineSurface9_ctor()
186 This->texture = TextureType; in NineSurface9_ctor()
187 This->level = Level; in NineSurface9_ctor()
188 This->level_actual = Level; in NineSurface9_ctor()
189 This->layer = Layer; in NineSurface9_ctor()
190 This->desc = *pDesc; in NineSurface9_ctor()
192 This->stride = nine_format_get_stride(This->base.info.format, pDesc->Width); in NineSurface9_ctor()
194 if (This->base.resource && (pDesc->Usage & D3DUSAGE_DYNAMIC)) in NineSurface9_ctor()
195 This->base.resource->flags |= NINE_RESOURCE_FLAG_LOCKABLE; in NineSurface9_ctor()
197 if (This->base.resource && (pDesc->Usage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL))) in NineSurface9_ctor()
198 NineSurface9_CreatePipeSurfaces(This); in NineSurface9_ctor()
201 if (This->base.resource && (pDesc->Usage & D3DUSAGE_RENDERTARGET)) in NineSurface9_ctor()
202 … nine_context_clear_render_target(pParams->device, This, 0, 0, 0, pDesc->Width, pDesc->Height); in NineSurface9_ctor()
204 NineSurface9_Dump(This); in NineSurface9_ctor()
210 NineSurface9_dtor( struct NineSurface9 *This ) in NineSurface9_dtor() argument
212 DBG("This=%p\n", This); in NineSurface9_dtor()
214 if (This->transfer) { in NineSurface9_dtor()
215 struct pipe_context *pipe = nine_context_get_pipe_multithread(This->base.base.device); in NineSurface9_dtor()
216 pipe->transfer_unmap(pipe, This->transfer); in NineSurface9_dtor()
217 This->transfer = NULL; in NineSurface9_dtor()
223 if (p_atomic_read(&This->pending_uploads_counter)) in NineSurface9_dtor()
224 nine_csmt_process(This->base.base.device); in NineSurface9_dtor()
226 pipe_surface_reference(&This->surface[0], NULL); in NineSurface9_dtor()
227 pipe_surface_reference(&This->surface[1], NULL); in NineSurface9_dtor()
230 if (!This->base.base.container && This->data) in NineSurface9_dtor()
231 align_free(This->data); in NineSurface9_dtor()
232 if (This->data_internal) in NineSurface9_dtor()
233 align_free(This->data_internal); in NineSurface9_dtor()
234 NineResource9_dtor(&This->base); in NineSurface9_dtor()
238 NineSurface9_CreatePipeSurfaces( struct NineSurface9 *This ) in NineSurface9_CreatePipeSurfaces() argument
241 struct pipe_screen *screen = NineDevice9_GetScreen(This->base.base.device); in NineSurface9_CreatePipeSurfaces()
242 struct pipe_resource *resource = This->base.resource; in NineSurface9_CreatePipeSurfaces()
246 assert(This->desc.Pool == D3DPOOL_DEFAULT); in NineSurface9_CreatePipeSurfaces()
257 templ.u.tex.level = This->level; in NineSurface9_CreatePipeSurfaces()
258 templ.u.tex.first_layer = This->layer; in NineSurface9_CreatePipeSurfaces()
259 templ.u.tex.last_layer = This->layer; in NineSurface9_CreatePipeSurfaces()
261 pipe = nine_context_get_pipe_acquire(This->base.base.device); in NineSurface9_CreatePipeSurfaces()
263 This->surface[0] = pipe->create_surface(pipe, resource, &templ); in NineSurface9_CreatePipeSurfaces()
267 templ.u.tex.level = This->level; in NineSurface9_CreatePipeSurfaces()
268 templ.u.tex.first_layer = This->layer; in NineSurface9_CreatePipeSurfaces()
269 templ.u.tex.last_layer = This->layer; in NineSurface9_CreatePipeSurfaces()
271 This->surface[1] = pipe->create_surface(pipe, resource, &templ); in NineSurface9_CreatePipeSurfaces()
273 nine_context_get_pipe_release(This->base.base.device); in NineSurface9_CreatePipeSurfaces()
275 assert(This->surface[0]); /* TODO: Handle failure */ in NineSurface9_CreatePipeSurfaces()
276 assert(This->surface[1]); in NineSurface9_CreatePipeSurfaces()
281 NineSurface9_Dump( struct NineSurface9 *This ) in NineSurface9_Dump() argument
289 "Level=%u(%u), Layer=%u\n", This, This->base.resource, This->data, in NineSurface9_Dump()
290 nine_D3DPOOL_to_str(This->desc.Pool), in NineSurface9_Dump()
291 nine_D3DRTYPE_to_str(This->desc.Type), in NineSurface9_Dump()
292 nine_D3DUSAGE_to_str(This->desc.Usage), in NineSurface9_Dump()
293 This->desc.Width, This->desc.Height, in NineSurface9_Dump()
294 d3dformat_to_string(This->desc.Format), This->stride, in NineSurface9_Dump()
295 This->base.resource && in NineSurface9_Dump()
296 (This->base.resource->flags & NINE_RESOURCE_FLAG_LOCKABLE), in NineSurface9_Dump()
297 This->level, This->level_actual, This->layer); in NineSurface9_Dump()
299 if (!This->base.base.container) in NineSurface9_Dump()
301 NineUnknown_QueryInterface(This->base.base.container, ref, (void **)&tex); in NineSurface9_Dump()
310 NineSurface9_GetContainer( struct NineSurface9 *This, in NineSurface9_GetContainer() argument
317 DBG("This=%p riid=%p id=%s ppContainer=%p\n", in NineSurface9_GetContainer()
318 This, riid, riid ? GUID_sprintf(guid_str, riid) : "", ppContainer); in NineSurface9_GetContainer()
325 if (!NineUnknown(This)->container) { in NineSurface9_GetContainer()
326 *ppContainer = NineUnknown(This)->device; in NineSurface9_GetContainer()
332 hr = NineUnknown_QueryInterface(NineUnknown(This)->container, riid, ppContainer); in NineSurface9_GetContainer()
339 NineSurface9_MarkContainerDirty( struct NineSurface9 *This ) in NineSurface9_MarkContainerDirty() argument
341 if (This->texture) { in NineSurface9_MarkContainerDirty()
343 NineBaseTexture9(This->base.base.container); in NineSurface9_MarkContainerDirty()
345 assert(This->texture == D3DRTYPE_TEXTURE || in NineSurface9_MarkContainerDirty()
346 This->texture == D3DRTYPE_CUBETEXTURE); in NineSurface9_MarkContainerDirty()
347 if (This->base.pool == D3DPOOL_MANAGED) in NineSurface9_MarkContainerDirty()
350 if (This->base.usage & D3DUSAGE_AUTOGENMIPMAP) in NineSurface9_MarkContainerDirty()
358 NineSurface9_GetDesc( struct NineSurface9 *This, in NineSurface9_GetDesc() argument
362 *pDesc = This->desc; in NineSurface9_GetDesc()
368 NineSurface9_AddDirtyRect( struct NineSurface9 *This, in NineSurface9_AddDirtyRect() argument
373 DBG("This=%p box=%p\n", This, box); in NineSurface9_AddDirtyRect()
375 assert (This->base.pool != D3DPOOL_MANAGED || in NineSurface9_AddDirtyRect()
376 This->texture == D3DRTYPE_CUBETEXTURE || in NineSurface9_AddDirtyRect()
377 This->texture == D3DRTYPE_TEXTURE); in NineSurface9_AddDirtyRect()
379 if (This->base.pool == D3DPOOL_DEFAULT) in NineSurface9_AddDirtyRect()
383 dirty_rect.left = box->x << This->level_actual; in NineSurface9_AddDirtyRect()
384 dirty_rect.right = dirty_rect.left + (box->width << This->level_actual); in NineSurface9_AddDirtyRect()
385 dirty_rect.top = box->y << This->level_actual; in NineSurface9_AddDirtyRect()
386 dirty_rect.bottom = dirty_rect.top + (box->height << This->level_actual); in NineSurface9_AddDirtyRect()
388 if (This->texture == D3DRTYPE_TEXTURE) { in NineSurface9_AddDirtyRect()
390 NineTexture9(This->base.base.container); in NineSurface9_AddDirtyRect()
393 } else if (This->texture == D3DRTYPE_CUBETEXTURE) { in NineSurface9_AddDirtyRect()
395 NineCubeTexture9(This->base.base.container); in NineSurface9_AddDirtyRect()
397 NineCubeTexture9_AddDirtyRect(ctex, This->layer, &dirty_rect); in NineSurface9_AddDirtyRect()
413 NineSurface9_LockRect( struct NineSurface9 *This, in NineSurface9_LockRect() argument
418 struct pipe_resource *resource = This->base.resource; in NineSurface9_LockRect()
423 DBG("This=%p pLockedRect=%p pRect=%p[%u..%u,%u..%u] Flags=%s\n", This, in NineSurface9_LockRect()
428 NineSurface9_Dump(This); in NineSurface9_LockRect()
431 user_assert(This->lock_count == 0, D3DERR_INVALIDCALL); in NineSurface9_LockRect()
438 user_assert(This->base.pool != D3DPOOL_DEFAULT || in NineSurface9_LockRect()
451 user_assert(This->desc.MultiSampleType == D3DMULTISAMPLE_NONE, in NineSurface9_LockRect()
454 if (pRect && This->desc.Pool == D3DPOOL_DEFAULT && in NineSurface9_LockRect()
455 util_format_is_compressed(This->base.info.format)) { in NineSurface9_LockRect()
456 const unsigned w = util_format_get_blockwidth(This->base.info.format); in NineSurface9_LockRect()
457 const unsigned h = util_format_get_blockheight(This->base.info.format); in NineSurface9_LockRect()
458 user_assert((pRect->left == 0 && pRect->right == This->desc.Width && in NineSurface9_LockRect()
459 pRect->top == 0 && pRect->bottom == This->desc.Height) || in NineSurface9_LockRect()
479 u_box_origin_2d(This->desc.Width, This->desc.Height, &box); in NineSurface9_LockRect()
481 box.z = This->layer; in NineSurface9_LockRect()
483 user_warn(This->desc.Format == D3DFMT_NULL); in NineSurface9_LockRect()
485 if (p_atomic_read(&This->pending_uploads_counter)) in NineSurface9_LockRect()
486 nine_csmt_process(This->base.base.device); in NineSurface9_LockRect()
488 if (This->data_internal || This->data) { in NineSurface9_LockRect()
489 enum pipe_format format = This->base.info.format; in NineSurface9_LockRect()
490 unsigned stride = This->stride; in NineSurface9_LockRect()
491 uint8_t *data = This->data; in NineSurface9_LockRect()
492 if (This->data_internal) { in NineSurface9_LockRect()
493 format = This->format_internal; in NineSurface9_LockRect()
494 stride = This->stride_internal; in NineSurface9_LockRect()
495 data = This->data_internal; in NineSurface9_LockRect()
503 pLockedRect->Pitch = This->desc.Width; in NineSurface9_LockRect()
504 pLockedRect->pBits = data + box.y * This->desc.Width + box.x; in NineSurface9_LockRect()
514 bool no_refs = !p_atomic_read(&This->base.base.bind) && in NineSurface9_LockRect()
515 !(This->base.base.container && p_atomic_read(&This->base.base.container->bind)); in NineSurface9_LockRect()
517 resource, This->level, usage); in NineSurface9_LockRect()
522 pipe = nine_context_get_pipe_acquire(This->base.base.device); in NineSurface9_LockRect()
524 pipe = NineDevice9_GetPipe(This->base.base.device); in NineSurface9_LockRect()
526 This->level, usage, &box, in NineSurface9_LockRect()
527 &This->transfer); in NineSurface9_LockRect()
529 nine_context_get_pipe_release(This->base.base.device); in NineSurface9_LockRect()
530 if (!This->transfer) { in NineSurface9_LockRect()
536 pLockedRect->Pitch = This->transfer->stride; in NineSurface9_LockRect()
540 NineSurface9_MarkContainerDirty(This); in NineSurface9_LockRect()
541 NineSurface9_AddDirtyRect(This, &box); in NineSurface9_LockRect()
544 ++This->lock_count; in NineSurface9_LockRect()
549 NineSurface9_UnlockRect( struct NineSurface9 *This ) in NineSurface9_UnlockRect() argument
553 DBG("This=%p lock_count=%u\n", This, This->lock_count); in NineSurface9_UnlockRect()
554 user_assert(This->lock_count, D3DERR_INVALIDCALL); in NineSurface9_UnlockRect()
555 if (This->transfer) { in NineSurface9_UnlockRect()
556 pipe = nine_context_get_pipe_acquire(This->base.base.device); in NineSurface9_UnlockRect()
557 pipe->transfer_unmap(pipe, This->transfer); in NineSurface9_UnlockRect()
558 nine_context_get_pipe_release(This->base.base.device); in NineSurface9_UnlockRect()
559 This->transfer = NULL; in NineSurface9_UnlockRect()
561 --This->lock_count; in NineSurface9_UnlockRect()
563 if (This->data_internal) { in NineSurface9_UnlockRect()
564 if (This->data) { in NineSurface9_UnlockRect()
565 (void) util_format_translate(This->base.info.format, in NineSurface9_UnlockRect()
566 This->data, This->stride, in NineSurface9_UnlockRect()
568 This->format_internal, in NineSurface9_UnlockRect()
569 This->data_internal, in NineSurface9_UnlockRect()
570 This->stride_internal, in NineSurface9_UnlockRect()
572 This->desc.Width, This->desc.Height); in NineSurface9_UnlockRect()
574 u_box_2d_zslice(0, 0, This->layer, in NineSurface9_UnlockRect()
575 This->desc.Width, This->desc.Height, &dst_box); in NineSurface9_UnlockRect()
577 This->desc.Width, This->desc.Height, &src_box); in NineSurface9_UnlockRect()
579 nine_context_box_upload(This->base.base.device, in NineSurface9_UnlockRect()
580 &This->pending_uploads_counter, in NineSurface9_UnlockRect()
581 (struct NineUnknown *)This, in NineSurface9_UnlockRect()
582 This->base.resource, in NineSurface9_UnlockRect()
583 This->level, in NineSurface9_UnlockRect()
585 This->format_internal, in NineSurface9_UnlockRect()
586 This->data_internal, in NineSurface9_UnlockRect()
587 This->stride_internal, in NineSurface9_UnlockRect()
596 NineSurface9_GetDC( struct NineSurface9 *This, in NineSurface9_GetDC() argument
603 NineSurface9_ReleaseDC( struct NineSurface9 *This, in NineSurface9_ReleaseDC() argument
629 /* When this function is called, we have already checked
632 NineSurface9_CopyMemToDefault( struct NineSurface9 *This, in NineSurface9_CopyMemToDefault() argument
637 struct pipe_resource *r_dst = This->base.resource; in NineSurface9_CopyMemToDefault()
641 assert(This->base.pool == D3DPOOL_DEFAULT && in NineSurface9_CopyMemToDefault()
664 u_box_2d_zslice(dst_x, dst_y, This->layer, in NineSurface9_CopyMemToDefault()
669 nine_context_box_upload(This->base.base.device, in NineSurface9_CopyMemToDefault()
673 This->level, in NineSurface9_CopyMemToDefault()
690 nine_csmt_process(This->base.base.device); in NineSurface9_CopyMemToDefault()
693 if (This->data_internal) in NineSurface9_CopyMemToDefault()
694 (void) util_format_translate(This->format_internal, in NineSurface9_CopyMemToDefault()
695 This->data_internal, in NineSurface9_CopyMemToDefault()
696 This->stride_internal, in NineSurface9_CopyMemToDefault()
703 NineSurface9_MarkContainerDirty(This); in NineSurface9_CopyMemToDefault()
707 NineSurface9_CopyDefaultToMem( struct NineSurface9 *This, in NineSurface9_CopyDefaultToMem() argument
717 assert(This->base.pool == D3DPOOL_SYSTEMMEM && in NineSurface9_CopyDefaultToMem()
720 assert(This->desc.Width == From->desc.Width); in NineSurface9_CopyDefaultToMem()
721 assert(This->desc.Height == From->desc.Height); in NineSurface9_CopyDefaultToMem()
723 u_box_origin_2d(This->desc.Width, This->desc.Height, &src_box); in NineSurface9_CopyDefaultToMem()
726 if (p_atomic_read(&This->pending_uploads_counter)) in NineSurface9_CopyDefaultToMem()
727 nine_csmt_process(This->base.base.device); in NineSurface9_CopyDefaultToMem()
729 pipe = NineDevice9_GetPipe(This->base.base.device); in NineSurface9_CopyDefaultToMem()
733 p_dst = This->data; in NineSurface9_CopyDefaultToMem()
737 util_copy_rect(p_dst, This->base.info.format, in NineSurface9_CopyDefaultToMem()
738 This->stride, 0, 0, in NineSurface9_CopyDefaultToMem()
739 This->desc.Width, This->desc.Height, in NineSurface9_CopyDefaultToMem()
751 NineSurface9_UploadSelf( struct NineSurface9 *This, in NineSurface9_UploadSelf() argument
754 struct pipe_resource *res = This->base.resource; in NineSurface9_UploadSelf()
757 DBG("This=%p damaged=%p\n", This, damaged); in NineSurface9_UploadSelf()
759 assert(This->base.pool == D3DPOOL_MANAGED); in NineSurface9_UploadSelf()
763 box.z = This->layer; in NineSurface9_UploadSelf()
768 box.z = This->layer; in NineSurface9_UploadSelf()
769 box.width = This->desc.Width; in NineSurface9_UploadSelf()
770 box.height = This->desc.Height; in NineSurface9_UploadSelf()
774 nine_context_box_upload(This->base.base.device, in NineSurface9_UploadSelf()
775 &This->pending_uploads_counter, in NineSurface9_UploadSelf()
776 (struct NineUnknown *)This, in NineSurface9_UploadSelf()
778 This->level, in NineSurface9_UploadSelf()
781 This->data, This->stride, in NineSurface9_UploadSelf()
797 NineSurface9_SetResource( struct NineSurface9 *This, in NineSurface9_SetResource() argument
802 assert(This->base.pool == D3DPOOL_MANAGED); in NineSurface9_SetResource()
803 This->level = level; in NineSurface9_SetResource()
804 pipe_resource_reference(&This->base.resource, resource); in NineSurface9_SetResource()
808 NineSurface9_SetMultiSampleType( struct NineSurface9 *This, in NineSurface9_SetMultiSampleType() argument
811 PROCESS_IF_BOUND(This); in NineSurface9_SetMultiSampleType()
812 This->desc.MultiSampleType = mst; in NineSurface9_SetMultiSampleType()
816 NineSurface9_SetResourceResize( struct NineSurface9 *This, in NineSurface9_SetResourceResize() argument
819 assert(This->level == 0 && This->level_actual == 0); in NineSurface9_SetResourceResize()
820 assert(!This->lock_count); in NineSurface9_SetResourceResize()
821 assert(This->desc.Pool == D3DPOOL_DEFAULT); in NineSurface9_SetResourceResize()
822 assert(!This->texture); in NineSurface9_SetResourceResize()
824 PROCESS_IF_BOUND(This); in NineSurface9_SetResourceResize()
825 pipe_resource_reference(&This->base.resource, resource); in NineSurface9_SetResourceResize()
827 This->desc.Width = This->base.info.width0 = resource->width0; in NineSurface9_SetResourceResize()
828 This->desc.Height = This->base.info.height0 = resource->height0; in NineSurface9_SetResourceResize()
829 This->base.info.nr_samples = resource->nr_samples; in NineSurface9_SetResourceResize()
830 This->base.info.nr_storage_samples = resource->nr_storage_samples; in NineSurface9_SetResourceResize()
832 This->stride = nine_format_get_stride(This->base.info.format, in NineSurface9_SetResourceResize()
833 This->desc.Width); in NineSurface9_SetResourceResize()
835 pipe_surface_reference(&This->surface[0], NULL); in NineSurface9_SetResourceResize()
836 pipe_surface_reference(&This->surface[1], NULL); in NineSurface9_SetResourceResize()
837 NineSurface9_CreatePipeSurfaces(This); in NineSurface9_SetResourceResize()