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
38 NineVolume9_AllocateData( struct NineVolume9 *This ) in NineVolume9_AllocateData() argument
40 unsigned size = This->layer_stride * This->desc.Depth; in NineVolume9_AllocateData()
42 DBG("(%p(This=%p),level=%u) Allocating 0x%x bytes of system memory.\n", in NineVolume9_AllocateData()
43 This->base.container, This, This->level, size); in NineVolume9_AllocateData()
45 This->data = (uint8_t *)align_calloc(size, 32); in NineVolume9_AllocateData()
46 if (!This->data) in NineVolume9_AllocateData()
52 NineVolume9_ctor( struct NineVolume9 *This, in NineVolume9_ctor() argument
63 DBG("This=%p pContainer=%p pDevice=%p pResource=%p Level=%u pDesc=%p\n", in NineVolume9_ctor()
64 This, pContainer, pParams->device, pResource, Level, pDesc); in NineVolume9_ctor()
66 /* Mark this as a special surface held by another internal resource. */ in NineVolume9_ctor()
74 hr = NineUnknown_ctor(&This->base, pParams); in NineVolume9_ctor()
78 pipe_resource_reference(&This->resource, pResource); in NineVolume9_ctor()
80 This->transfer = NULL; in NineVolume9_ctor()
81 This->lock_count = 0; in NineVolume9_ctor()
83 This->level = Level; in NineVolume9_ctor()
84 This->level_actual = Level; in NineVolume9_ctor()
85 This->desc = *pDesc; in NineVolume9_ctor()
87 This->info.screen = pParams->device->screen; in NineVolume9_ctor()
88 This->info.target = PIPE_TEXTURE_3D; in NineVolume9_ctor()
89 This->info.width0 = pDesc->Width; in NineVolume9_ctor()
90 This->info.height0 = pDesc->Height; in NineVolume9_ctor()
91 This->info.depth0 = pDesc->Depth; in NineVolume9_ctor()
92 This->info.last_level = 0; in NineVolume9_ctor()
93 This->info.array_size = 1; in NineVolume9_ctor()
94 This->info.nr_samples = 0; in NineVolume9_ctor()
95 This->info.nr_storage_samples = 0; in NineVolume9_ctor()
96 This->info.usage = PIPE_USAGE_DEFAULT; in NineVolume9_ctor()
97 This->info.bind = PIPE_BIND_SAMPLER_VIEW; in NineVolume9_ctor()
98 This->info.flags = 0; in NineVolume9_ctor()
99 This->info.format = d3d9_to_pipe_format_checked(This->info.screen, in NineVolume9_ctor()
101 This->info.target, in NineVolume9_ctor()
102 This->info.nr_samples, in NineVolume9_ctor()
103 This->info.bind, FALSE, in NineVolume9_ctor()
106 if (This->info.format == PIPE_FORMAT_NONE) in NineVolume9_ctor()
109 This->stride = util_format_get_stride(This->info.format, pDesc->Width); in NineVolume9_ctor()
110 This->stride = align(This->stride, 4); in NineVolume9_ctor()
111 This->layer_stride = util_format_get_2d_size(This->info.format, in NineVolume9_ctor()
112 This->stride, pDesc->Height); in NineVolume9_ctor()
115 This->format_internal = d3d9_to_pipe_format_checked(This->info.screen, in NineVolume9_ctor()
117 This->info.target, in NineVolume9_ctor()
118 This->info.nr_samples, in NineVolume9_ctor()
119 This->info.bind, FALSE, in NineVolume9_ctor()
121 if (This->info.format != This->format_internal || in NineVolume9_ctor()
126 This->stride_internal = nine_format_get_stride(This->format_internal, in NineVolume9_ctor()
128 This->layer_stride_internal = util_format_get_2d_size(This->format_internal, in NineVolume9_ctor()
129 This->stride_internal, in NineVolume9_ctor()
131 This->data_internal = align_calloc(This->layer_stride_internal * in NineVolume9_ctor()
132 This->desc.Depth, 32); in NineVolume9_ctor()
133 if (!This->data_internal) in NineVolume9_ctor()
137 if (!This->resource) { in NineVolume9_ctor()
138 hr = NineVolume9_AllocateData(This); in NineVolume9_ctor()
146 NineVolume9_dtor( struct NineVolume9 *This ) in NineVolume9_dtor() argument
148 DBG("This=%p\n", This); in NineVolume9_dtor()
150 if (This->transfer) { in NineVolume9_dtor()
151 struct pipe_context *pipe = nine_context_get_pipe_multithread(This->base.device); in NineVolume9_dtor()
152 pipe->transfer_unmap(pipe, This->transfer); in NineVolume9_dtor()
153 This->transfer = NULL; in NineVolume9_dtor()
159 if (p_atomic_read(&This->pending_uploads_counter)) in NineVolume9_dtor()
160 nine_csmt_process(This->base.device); in NineVolume9_dtor()
162 if (This->data) in NineVolume9_dtor()
163 align_free(This->data); in NineVolume9_dtor()
164 if (This->data_internal) in NineVolume9_dtor()
165 align_free(This->data_internal); in NineVolume9_dtor()
167 pipe_resource_reference(&This->resource, NULL); in NineVolume9_dtor()
169 NineUnknown_dtor(&This->base); in NineVolume9_dtor()
173 NineVolume9_GetContainer( struct NineVolume9 *This, in NineVolume9_GetContainer() argument
179 DBG("This=%p riid=%p id=%s ppContainer=%p\n", in NineVolume9_GetContainer()
180 This, riid, riid ? GUID_sprintf(guid_str, riid) : "", ppContainer); in NineVolume9_GetContainer()
184 if (!NineUnknown(This)->container) in NineVolume9_GetContainer()
186 return NineUnknown_QueryInterface(NineUnknown(This)->container, riid, ppContainer); in NineVolume9_GetContainer()
190 NineVolume9_MarkContainerDirty( struct NineVolume9 *This ) in NineVolume9_MarkContainerDirty() argument
194 /* This is always contained by a NineVolumeTexture9. */ in NineVolume9_MarkContainerDirty()
197 assert(NineUnknown_QueryInterface(This->base.container, ref, (void **)&tex) in NineVolume9_MarkContainerDirty()
202 tex = NineBaseTexture9(This->base.container); in NineVolume9_MarkContainerDirty()
204 if (This->desc.Pool == D3DPOOL_MANAGED) in NineVolume9_MarkContainerDirty()
211 NineVolume9_GetDesc( struct NineVolume9 *This, in NineVolume9_GetDesc() argument
215 *pDesc = This->desc; in NineVolume9_GetDesc()
220 NineVolume9_AddDirtyRegion( struct NineVolume9 *This, in NineVolume9_AddDirtyRegion() argument
224 struct NineVolumeTexture9 *tex = NineVolumeTexture9(This->base.container); in NineVolume9_AddDirtyRegion()
229 dirty_region.Left = box->x << This->level_actual; in NineVolume9_AddDirtyRegion()
230 dirty_region.Top = box->y << This->level_actual; in NineVolume9_AddDirtyRegion()
231 dirty_region.Front = box->z << This->level_actual; in NineVolume9_AddDirtyRegion()
232 dirty_region.Right = dirty_region.Left + (box->width << This->level_actual); in NineVolume9_AddDirtyRegion()
233 dirty_region.Bottom = dirty_region.Top + (box->height << This->level_actual); in NineVolume9_AddDirtyRegion()
234 dirty_region.Back = dirty_region.Front + (box->depth << This->level_actual); in NineVolume9_AddDirtyRegion()
252 NineVolume9_LockBox( struct NineVolume9 *This, in NineVolume9_LockBox() argument
258 struct pipe_resource *resource = This->resource; in NineVolume9_LockBox()
262 DBG("This=%p(%p) pLockedVolume=%p pBox=%p[%u..%u,%u..%u,%u..%u] Flags=%s\n", in NineVolume9_LockBox()
263 This, This->base.container, pLockedVolume, pBox, in NineVolume9_LockBox()
270 user_assert(This->lock_count == 0, D3DERR_INVALIDCALL); in NineVolume9_LockBox()
276 user_assert(This->desc.Pool != D3DPOOL_DEFAULT || in NineVolume9_LockBox()
277 (This->desc.Usage & D3DUSAGE_DYNAMIC), D3DERR_INVALIDCALL); in NineVolume9_LockBox()
282 if (pBox && compressed_format (This->desc.Format)) { /* For volume all pools are checked */ in NineVolume9_LockBox()
283 const unsigned w = util_format_get_blockwidth(This->info.format); in NineVolume9_LockBox()
284 const unsigned h = util_format_get_blockheight(This->info.format); in NineVolume9_LockBox()
285 user_assert((pBox->Left == 0 && pBox->Right == This->desc.Width && in NineVolume9_LockBox()
286 pBox->Top == 0 && pBox->Bottom == This->desc.Height) || in NineVolume9_LockBox()
305 user_assert(pBox->Right <= This->desc.Width, D3DERR_INVALIDCALL); in NineVolume9_LockBox()
306 user_assert(pBox->Bottom <= This->desc.Height, D3DERR_INVALIDCALL); in NineVolume9_LockBox()
307 user_assert(pBox->Back <= This->desc.Depth, D3DERR_INVALIDCALL); in NineVolume9_LockBox()
310 if (u_box_clip_2d(&box, &box, This->desc.Width, This->desc.Height) < 0) { in NineVolume9_LockBox()
315 u_box_3d(0, 0, 0, This->desc.Width, This->desc.Height, This->desc.Depth, in NineVolume9_LockBox()
319 if (p_atomic_read(&This->pending_uploads_counter)) in NineVolume9_LockBox()
320 nine_csmt_process(This->base.device); in NineVolume9_LockBox()
322 if (This->data_internal || This->data) { in NineVolume9_LockBox()
323 enum pipe_format format = This->info.format; in NineVolume9_LockBox()
324 unsigned stride = This->stride; in NineVolume9_LockBox()
325 unsigned layer_stride = This->layer_stride; in NineVolume9_LockBox()
326 uint8_t *data = This->data; in NineVolume9_LockBox()
327 if (This->data_internal) { in NineVolume9_LockBox()
328 format = This->format_internal; in NineVolume9_LockBox()
329 stride = This->stride_internal; in NineVolume9_LockBox()
330 layer_stride = This->layer_stride_internal; in NineVolume9_LockBox()
331 data = This->data_internal; in NineVolume9_LockBox()
340 bool no_refs = !p_atomic_read(&This->base.bind) && in NineVolume9_LockBox()
341 !p_atomic_read(&This->base.container->bind); in NineVolume9_LockBox()
343 pipe = nine_context_get_pipe_acquire(This->base.device); in NineVolume9_LockBox()
345 pipe = NineDevice9_GetPipe(This->base.device); in NineVolume9_LockBox()
347 pipe->transfer_map(pipe, resource, This->level, usage, in NineVolume9_LockBox()
348 &box, &This->transfer); in NineVolume9_LockBox()
350 nine_context_get_pipe_release(This->base.device); in NineVolume9_LockBox()
351 if (!This->transfer) { in NineVolume9_LockBox()
356 pLockedVolume->RowPitch = This->transfer->stride; in NineVolume9_LockBox()
357 pLockedVolume->SlicePitch = This->transfer->layer_stride; in NineVolume9_LockBox()
361 NineVolume9_MarkContainerDirty(This); in NineVolume9_LockBox()
362 NineVolume9_AddDirtyRegion(This, &box); in NineVolume9_LockBox()
365 ++This->lock_count; in NineVolume9_LockBox()
370 NineVolume9_UnlockBox( struct NineVolume9 *This ) in NineVolume9_UnlockBox() argument
374 DBG("This=%p lock_count=%u\n", This, This->lock_count); in NineVolume9_UnlockBox()
375 user_assert(This->lock_count, D3DERR_INVALIDCALL); in NineVolume9_UnlockBox()
376 if (This->transfer) { in NineVolume9_UnlockBox()
377 pipe = nine_context_get_pipe_acquire(This->base.device); in NineVolume9_UnlockBox()
378 pipe->transfer_unmap(pipe, This->transfer); in NineVolume9_UnlockBox()
379 This->transfer = NULL; in NineVolume9_UnlockBox()
380 nine_context_get_pipe_release(This->base.device); in NineVolume9_UnlockBox()
382 --This->lock_count; in NineVolume9_UnlockBox()
384 if (This->data_internal) { in NineVolume9_UnlockBox()
387 u_box_3d(0, 0, 0, This->desc.Width, This->desc.Height, This->desc.Depth, in NineVolume9_UnlockBox()
391 if (This->data) { in NineVolume9_UnlockBox()
392 (void) util_format_translate_3d(This->info.format, in NineVolume9_UnlockBox()
393 This->data, This->stride, in NineVolume9_UnlockBox()
394 This->layer_stride, in NineVolume9_UnlockBox()
396 This->format_internal, in NineVolume9_UnlockBox()
397 This->data_internal, in NineVolume9_UnlockBox()
398 This->stride_internal, in NineVolume9_UnlockBox()
399 This->layer_stride_internal, in NineVolume9_UnlockBox()
401 This->desc.Width, This->desc.Height, in NineVolume9_UnlockBox()
402 This->desc.Depth); in NineVolume9_UnlockBox()
404 nine_context_box_upload(This->base.device, in NineVolume9_UnlockBox()
405 &This->pending_uploads_counter, in NineVolume9_UnlockBox()
406 (struct NineUnknown *)This, in NineVolume9_UnlockBox()
407 This->resource, in NineVolume9_UnlockBox()
408 This->level, in NineVolume9_UnlockBox()
410 This->format_internal, in NineVolume9_UnlockBox()
411 This->data_internal, in NineVolume9_UnlockBox()
412 This->stride_internal, in NineVolume9_UnlockBox()
413 This->layer_stride_internal, in NineVolume9_UnlockBox()
421 /* When this function is called, we have already checked
424 NineVolume9_CopyMemToDefault( struct NineVolume9 *This, in NineVolume9_CopyMemToDefault() argument
429 struct pipe_resource *r_dst = This->resource; in NineVolume9_CopyMemToDefault()
433 DBG("This=%p From=%p dstx=%u dsty=%u dstz=%u pSrcBox=%p\n", in NineVolume9_CopyMemToDefault()
434 This, From, dstx, dsty, dstz, pSrcBox); in NineVolume9_CopyMemToDefault()
436 assert(This->desc.Pool == D3DPOOL_DEFAULT && in NineVolume9_CopyMemToDefault()
458 nine_context_box_upload(This->base.device, in NineVolume9_CopyMemToDefault()
462 This->level, in NineVolume9_CopyMemToDefault()
469 if (This->data_internal) in NineVolume9_CopyMemToDefault()
470 (void) util_format_translate_3d(This->format_internal, in NineVolume9_CopyMemToDefault()
471 This->data_internal, in NineVolume9_CopyMemToDefault()
472 This->stride_internal, in NineVolume9_CopyMemToDefault()
473 This->layer_stride_internal, in NineVolume9_CopyMemToDefault()
484 NineVolume9_MarkContainerDirty(This); in NineVolume9_CopyMemToDefault()
490 NineVolume9_UploadSelf( struct NineVolume9 *This, in NineVolume9_UploadSelf() argument
493 struct pipe_resource *res = This->resource; in NineVolume9_UploadSelf()
496 DBG("This=%p damaged=%p data=%p res=%p\n", This, damaged, in NineVolume9_UploadSelf()
497 This->data, res); in NineVolume9_UploadSelf()
499 assert(This->desc.Pool == D3DPOOL_MANAGED); in NineVolume9_UploadSelf()
508 box.width = This->desc.Width; in NineVolume9_UploadSelf()
509 box.height = This->desc.Height; in NineVolume9_UploadSelf()
510 box.depth = This->desc.Depth; in NineVolume9_UploadSelf()
513 nine_context_box_upload(This->base.device, in NineVolume9_UploadSelf()
514 &This->pending_uploads_counter, in NineVolume9_UploadSelf()
515 (struct NineUnknown *)This, in NineVolume9_UploadSelf()
517 This->level, in NineVolume9_UploadSelf()
520 This->data, This->stride, in NineVolume9_UploadSelf()
521 This->layer_stride, in NineVolume9_UploadSelf()