Lines Matching refs:tex

50       [PIPE_TEXTURE_1D] = "tex-1d",
51 [PIPE_TEXTURE_2D] = "tex-2d",
52 [PIPE_TEXTURE_3D] = "tex-3d",
53 [PIPE_TEXTURE_CUBE] = "tex-cube",
54 [PIPE_TEXTURE_RECT] = "tex-rect",
55 [PIPE_TEXTURE_1D_ARRAY] = "tex-1d-array",
56 [PIPE_TEXTURE_2D_ARRAY] = "tex-2d-array",
57 [PIPE_TEXTURE_CUBE_ARRAY] = "tex-cube-array",
252 tex_free_slices(struct ilo_texture *tex)
254 FREE(tex->slices[0]);
258 tex_alloc_slices(struct ilo_texture *tex)
260 const struct pipe_resource *templ = &tex->base;
270 * There are (depth * tex->base.array_size) slices in total. Either depth
278 tex->slices[0] = slices;
282 tex->slices[lv] = tex->slices[lv - 1] +
290 tex_create_bo(struct ilo_texture *tex)
292 struct ilo_screen *is = ilo_screen(tex->base.screen);
293 const char *name = resource_get_bo_name(&tex->base);
294 const bool cpu_init = resource_get_cpu_init(&tex->base);
298 tex->image.bo_stride * tex->image.bo_height, cpu_init);
301 if (bo && (tex->image.tiling == GEN6_TILING_X ||
302 tex->image.tiling == GEN6_TILING_Y)) {
304 surface_to_winsys_tiling(tex->image.tiling);
306 if (intel_bo_set_tiling(bo, tiling, tex->image.bo_stride)) {
314 intel_bo_unref(tex->vma.bo);
315 ilo_vma_set_bo(&tex->vma, &is->dev, bo, 0);
321 tex_create_separate_stencil(struct ilo_texture *tex)
323 struct pipe_resource templ = tex->base;
336 s8 = tex->base.screen->resource_create(tex->base.screen, &templ);
340 tex->separate_s8 = ilo_texture(s8);
342 assert(tex->separate_s8->image_format == PIPE_FORMAT_S8_UINT);
348 tex_create_hiz(struct ilo_texture *tex)
350 const struct pipe_resource *templ = &tex->base;
351 const uint32_t size = tex->image.aux.bo_stride * tex->image.aux.bo_height;
352 struct ilo_screen *is = ilo_screen(tex->base.screen);
359 ilo_vma_init(&tex->aux_vma, &is->dev, size, 4096);
360 ilo_vma_set_bo(&tex->aux_vma, &is->dev, bo, 0);
362 if (tex->imported) {
366 if (tex->image.aux.enables & (1 << lv)) {
372 ilo_texture_set_slice_flags(tex, lv, 0, num_slices, flags, flags);
381 tex_create_mcs(struct ilo_texture *tex)
383 const uint32_t size = tex->image.aux.bo_stride * tex->image.aux.bo_height;
384 struct ilo_screen *is = ilo_screen(tex->base.screen);
387 assert(tex->image.aux.enables == (1 << (tex->base.last_level + 1)) - 1);
393 ilo_vma_init(&tex->aux_vma, &is->dev, size, 4096);
394 ilo_vma_set_bo(&tex->aux_vma, &is->dev, bo, 0);
400 tex_destroy(struct ilo_texture *tex)
402 if (tex->separate_s8)
403 tex_destroy(tex->separate_s8);
405 intel_bo_unref(tex->vma.bo);
406 intel_bo_unref(tex->aux_vma.bo);
408 tex_free_slices(tex);
409 FREE(tex);
413 tex_alloc_bos(struct ilo_texture *tex)
415 if (!tex->imported && !tex_create_bo(tex))
418 switch (tex->image.aux.type) {
420 if (!tex_create_hiz(tex))
424 if (!tex_create_mcs(tex))
435 tex_import_handle(struct ilo_texture *tex,
439 struct ilo_screen *is = ilo_screen(tex->base.screen);
440 const struct pipe_resource *templ = &tex->base;
441 const char *name = resource_get_bo_name(&tex->base);
447 tex->image.bo_height, &tiling, &pitch);
469 tex_init_image(struct ilo_texture *tex,
473 struct ilo_screen *is = ilo_screen(tex->base.screen);
474 const struct pipe_resource *templ = &tex->base;
475 struct ilo_image *img = &tex->image;
479 tex->image_format = resource_get_image_format(templ,
481 resource_get_image_info(templ, &is->dev, tex->image_format, &info);
484 imported_bo = tex_import_handle(tex, handle, &info);
507 tex->image_format == PIPE_FORMAT_Z32_FLOAT &&
509 tex->image_format = templ->format;
510 info.format = pipe_to_surface_format(&is->dev, tex->image_format);
521 !ilo_vma_init(&tex->vma, &is->dev, img->bo_stride * img->bo_height,
528 ilo_vma_set_bo(&tex->vma, &is->dev, imported_bo, 0);
529 tex->imported = true;
535 tex->image_format != templ->format)
539 if (!tex_alloc_slices(tex))
550 struct ilo_texture *tex;
553 tex = CALLOC_STRUCT(ilo_texture);
554 if (!tex)
557 tex->base = *templ;
558 tex->base.screen = screen;
559 pipe_reference_init(&tex->base.reference, 1);
561 if (!tex_init_image(tex, handle, &separate_stencil)) {
562 FREE(tex);
566 if (!tex_alloc_bos(tex) ||
567 (separate_stencil && !tex_create_separate_stencil(tex))) {
568 tex_destroy(tex);
572 return &tex->base;
576 tex_get_handle(struct ilo_texture *tex, struct winsys_handle *handle)
578 struct ilo_screen *is = ilo_screen(tex->base.screen);
583 if (tex->image.tiling == GEN8_TILING_W)
586 tiling = surface_to_winsys_tiling(tex->image.tiling);
588 err = intel_winsys_export_handle(is->dev.winsys, tex->vma.bo, tiling,
589 tex->image.bo_stride, tex->image.bo_height, handle);
769 struct ilo_texture *tex = ilo_texture(res);
772 if (tex->imported)
775 return tex_create_bo(tex);