Lines Matching refs:spr
55 struct softpipe_resource *spr) in softpipe_resource_layout() argument
57 struct pipe_resource *pt = &spr->base; in softpipe_resource_layout()
74 spr->stride[level] = util_format_get_stride(pt->format, width); in softpipe_resource_layout()
76 spr->level_offset[level] = buffer_size; in softpipe_resource_layout()
79 slices * spr->stride[level]); in softpipe_resource_layout()
86 spr->data = align_malloc(buffer_size, 16); in softpipe_resource_layout()
88 return spr->data != NULL; in softpipe_resource_layout()
97 struct softpipe_resource *spr) in softpipe_displaytarget_layout() argument
103 spr->dt = winsys->displaytarget_create(winsys, in softpipe_displaytarget_layout()
104 spr->base.bind, in softpipe_displaytarget_layout()
105 spr->base.format, in softpipe_displaytarget_layout()
106 spr->base.width0, in softpipe_displaytarget_layout()
107 spr->base.height0, in softpipe_displaytarget_layout()
109 &spr->stride[0] ); in softpipe_displaytarget_layout()
111 return spr->dt != NULL; in softpipe_displaytarget_layout()
122 struct softpipe_resource *spr = CALLOC_STRUCT(softpipe_resource); in softpipe_resource_create() local
123 if (!spr) in softpipe_resource_create()
128 spr->base = *templat; in softpipe_resource_create()
129 pipe_reference_init(&spr->base.reference, 1); in softpipe_resource_create()
130 spr->base.screen = screen; in softpipe_resource_create()
132 spr->pot = (util_is_power_of_two(templat->width0) && in softpipe_resource_create()
136 if (spr->base.bind & (PIPE_BIND_DISPLAY_TARGET | in softpipe_resource_create()
139 if (!softpipe_displaytarget_layout(screen, spr)) in softpipe_resource_create()
143 if (!softpipe_resource_layout(screen, spr)) in softpipe_resource_create()
147 return &spr->base; in softpipe_resource_create()
150 FREE(spr); in softpipe_resource_create()
160 struct softpipe_resource *spr = softpipe_resource(pt); in softpipe_resource_destroy() local
162 if (spr->dt) { in softpipe_resource_destroy()
165 winsys->displaytarget_destroy(winsys, spr->dt); in softpipe_resource_destroy()
167 else if (!spr->userBuffer) { in softpipe_resource_destroy()
169 align_free(spr->data); in softpipe_resource_destroy()
172 FREE(spr); in softpipe_resource_destroy()
182 struct softpipe_resource *spr = CALLOC_STRUCT(softpipe_resource); in softpipe_resource_from_handle() local
183 if (!spr) in softpipe_resource_from_handle()
186 spr->base = *templat; in softpipe_resource_from_handle()
187 pipe_reference_init(&spr->base.reference, 1); in softpipe_resource_from_handle()
188 spr->base.screen = screen; in softpipe_resource_from_handle()
190 spr->pot = (util_is_power_of_two(templat->width0) && in softpipe_resource_from_handle()
194 spr->dt = winsys->displaytarget_from_handle(winsys, in softpipe_resource_from_handle()
197 &spr->stride[0]); in softpipe_resource_from_handle()
198 if (!spr->dt) in softpipe_resource_from_handle()
201 return &spr->base; in softpipe_resource_from_handle()
204 FREE(spr); in softpipe_resource_from_handle()
215 struct softpipe_resource *spr = softpipe_resource(pt); in softpipe_resource_get_handle() local
217 assert(spr->dt); in softpipe_resource_get_handle()
218 if (!spr->dt) in softpipe_resource_get_handle()
221 return winsys->displaytarget_get_handle(winsys, spr->dt, whandle); in softpipe_resource_get_handle()
230 sp_get_tex_image_offset(const struct softpipe_resource *spr, in sp_get_tex_image_offset() argument
233 const unsigned hgt = u_minify(spr->base.height0, level); in sp_get_tex_image_offset()
234 const unsigned nblocksy = util_format_get_nblocksy(spr->base.format, hgt); in sp_get_tex_image_offset()
235 unsigned offset = spr->level_offset[level]; in sp_get_tex_image_offset()
237 if (spr->base.target == PIPE_TEXTURE_CUBE || in sp_get_tex_image_offset()
238 spr->base.target == PIPE_TEXTURE_3D || in sp_get_tex_image_offset()
239 spr->base.target == PIPE_TEXTURE_2D_ARRAY) { in sp_get_tex_image_offset()
240 offset += layer * nblocksy * spr->stride[level]; in sp_get_tex_image_offset()
242 else if (spr->base.target == PIPE_TEXTURE_1D_ARRAY) { in sp_get_tex_image_offset()
243 offset += layer * spr->stride[level]; in sp_get_tex_image_offset()
318 struct softpipe_resource *spr = softpipe_resource(resource); in softpipe_get_transfer() local
367 const unsigned hgt = u_minify(spr->base.height0, level); in softpipe_get_transfer()
374 pt->stride = spr->stride[level]; in softpipe_get_transfer()
377 spt->offset = sp_get_tex_image_offset(spr, level, box->z); in softpipe_get_transfer()
410 struct softpipe_resource *spr = softpipe_resource(transfer->resource); in softpipe_transfer_map() local
416 if (spr->dt) { in softpipe_transfer_map()
417 map = winsys->displaytarget_map(winsys, spr->dt, transfer->usage); in softpipe_transfer_map()
420 map = spr->data; in softpipe_transfer_map()
437 struct softpipe_resource *spr; in softpipe_transfer_unmap() local
440 spr = softpipe_resource(transfer->resource); in softpipe_transfer_unmap()
442 if (spr->dt) { in softpipe_transfer_unmap()
445 winsys->displaytarget_unmap(winsys, spr->dt); in softpipe_transfer_unmap()
450 spr->timestamp++; in softpipe_transfer_unmap()
463 struct softpipe_resource *spr; in softpipe_user_buffer_create() local
465 spr = CALLOC_STRUCT(softpipe_resource); in softpipe_user_buffer_create()
466 if (!spr) in softpipe_user_buffer_create()
469 pipe_reference_init(&spr->base.reference, 1); in softpipe_user_buffer_create()
470 spr->base.screen = screen; in softpipe_user_buffer_create()
471 spr->base.format = PIPE_FORMAT_R8_UNORM; /* ?? */ in softpipe_user_buffer_create()
472 spr->base.bind = bind_flags; in softpipe_user_buffer_create()
473 spr->base.usage = PIPE_USAGE_IMMUTABLE; in softpipe_user_buffer_create()
474 spr->base.flags = 0; in softpipe_user_buffer_create()
475 spr->base.width0 = bytes; in softpipe_user_buffer_create()
476 spr->base.height0 = 1; in softpipe_user_buffer_create()
477 spr->base.depth0 = 1; in softpipe_user_buffer_create()
478 spr->base.array_size = 1; in softpipe_user_buffer_create()
479 spr->userBuffer = TRUE; in softpipe_user_buffer_create()
480 spr->data = ptr; in softpipe_user_buffer_create()
482 return &spr->base; in softpipe_user_buffer_create()