Lines Matching refs:templ
162 create_bci(struct zink_screen *screen, const struct pipe_resource *templ, unsigned bind)
170 bci.size = templ->width0;
192 if (templ->flags & PIPE_RESOURCE_FLAG_SPARSE)
255 get_image_usage_for_feats(struct zink_screen *screen, VkFormatFeatureFlags feats, const struct pipe_resource *templ, unsigned bind, bool *need_extended)
258 bool is_planar = util_format_get_num_planes(templ->format) > 1;
273 assert(templ->nr_samples <= 1 || screen->info.feats.features.shaderStorageImageMultisample);
288 } else if ((bind & PIPE_BIND_SAMPLER_VIEW) && !util_format_is_depth_or_stencil(templ->format)) {
353 get_image_usage(struct zink_screen *screen, VkImageCreateInfo *ici, const struct pipe_resource *templ, unsigned bind, unsigned modifiers_count, const uint64_t *modifiers, uint64_t *mod)
360 const struct zink_modifier_prop *prop = &screen->modifier_props[templ->format];
371 VkImageUsageFlags usage = get_image_usage_for_feats(screen, feats, templ, bind, &need_extended);
381 VkImageUsageFlags usage = get_image_usage_for_feats(screen, feats, templ, bind, &need_extended);
389 VkFormatProperties props = screen->format_props[templ->format];
393 VkImageUsageFlags usage = get_image_usage_for_feats(screen, feats, templ, bind, &need_extended);
397 usage = get_image_usage_for_feats(screen, feats, templ, bind, &need_extended);
407 create_ici(struct zink_screen *screen, VkImageCreateInfo *ici, const struct pipe_resource *templ, bool dmabuf, unsigned bind, unsigned modifiers_count, const uint64_t *modifiers, bool *success)
411 if (util_format_get_num_planes(templ->format) > 1)
424 if (templ->flags & PIPE_RESOURCE_FLAG_SPARSE)
428 switch (templ->target) {
431 if (templ->flags & PIPE_RESOURCE_FLAG_SPARSE)
433 if (util_format_is_depth_or_stencil(templ->format))
462 util_format_has_depth(util_format_description(templ->format)))
465 ici->format = zink_get_format(screen, templ->format);
466 ici->extent.width = templ->width0;
467 ici->extent.height = templ->height0;
468 ici->extent.depth = templ->depth0;
469 ici->mipLevels = templ->last_level + 1;
470 ici->arrayLayers = MAX2(templ->array_size, 1);
471 ici->samples = templ->nr_samples ? templ->nr_samples : VK_SAMPLE_COUNT_1_BIT;
484 (templ->target == PIPE_TEXTURE_CUBE ||
485 templ->target == PIPE_TEXTURE_CUBE_ARRAY ||
486 (templ->target == PIPE_TEXTURE_2D_ARRAY && ici->extent.width == ici->extent.height && ici->arrayLayers >= 6));
488 if (templ->target == PIPE_TEXTURE_CUBE)
491 if (templ->usage == PIPE_USAGE_STAGING &&
492 templ->format != PIPE_FORMAT_B4G4R4A4_UNORM &&
493 templ->format != PIPE_FORMAT_B4G4R4A4_UINT)
534 ici->usage = get_image_usage(screen, ici, templ, bind, modifiers_count, modifiers, &mod);
541 if (get_image_usage(screen, ici, templ, bind, modifiers_count, modifiers, &mod) != ici->usage)
550 resource_object_create(struct zink_screen *screen, const struct pipe_resource *templ, struct winsys_handle *whandle, bool *optimal_tiling,
564 struct pipe_resource *pnext = templ->next;
572 bool shared = templ->bind & PIPE_BIND_SHARED;
578 unsigned num_planes = util_format_get_num_planes(templ->format);
585 bool needs_export = (templ->bind & (ZINK_BIND_VIDEO | ZINK_BIND_DMABUF)) != 0;
615 } else if (templ->target == PIPE_BUFFER) {
616 VkBufferCreateInfo bci = create_bci(screen, templ, templ->bind);
623 if (!(templ->bind & PIPE_BIND_SHADER_IMAGE)) {
632 if (templ->usage == PIPE_USAGE_STAGING)
634 else if (templ->usage == PIPE_USAGE_STREAM)
636 else if (templ->usage == PIPE_USAGE_IMMUTABLE)
649 modifiers_count = screen->modifier_props[templ->format].drmFormatModifierCount;
651 mods[j] = screen->modifier_props[templ->format].pDrmFormatModifierProperties[j].drmFormatModifier;
665 srgb = util_format_is_srgb(templ->format) ? util_format_linear(templ->format) : util_format_srgb(templ->format);
667 if (srgb == templ->format)
678 formats[0] = zink_get_format(screen, templ->format);
684 uint64_t mod = create_ici(screen, &ici, templ, external == VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT,
685 templ->bind, ici_modifier_count, ici_modifiers, &success);
717 pnext = templ->next;
764 feats = screen->format_props[templ->format].linearTilingFeatures;
767 feats = screen->format_props[templ->format].optimalTilingFeatures;
783 for (unsigned i = 0; i < screen->modifier_props[templ->format].drmFormatModifierCount; i++)
784 feats &= screen->modifier_props[templ->format].pDrmFormatModifierProperties[i].drmFormatModifierTilingFeatures;
790 if (util_format_is_yuv(templ->format)) {
849 unsigned num_dmabuf_planes = screen->base.get_dmabuf_modifier_planes(&screen->base, obj->modifier, templ->format);
892 if (templ->usage == PIPE_USAGE_STAGING && ici.tiling == VK_IMAGE_TILING_LINEAR)
902 if (templ->flags & PIPE_RESOURCE_FLAG_MAP_COHERENT || templ->usage == PIPE_USAGE_DYNAMIC)
905 templ->usage == PIPE_USAGE_STAGING)
908 if (templ->bind & ZINK_BIND_TRANSIENT)
912 enum zink_alloc_flag aflags = templ->flags & PIPE_RESOURCE_FLAG_SPARSE ? ZINK_ALLOC_SPARSE : 0;
947 if ((templ->bind & ZINK_BIND_VIDEO) || ((templ->bind & PIPE_BIND_SHARED) && shared) || (templ->bind & ZINK_BIND_DMABUF)) {
1005 if (templ->usage == PIPE_USAGE_STAGING && obj->is_buffer)
1012 if (templ->flags & PIPE_RESOURCE_FLAG_MAP_COHERENT || templ->usage == PIPE_USAGE_DYNAMIC)
1021 obj->size = templ->width0;
1028 if (!(templ->flags & PIPE_RESOURCE_FLAG_SPARSE)) {
1032 if (templ->target == PIPE_BUFFER) {
1033 if (!(templ->flags & PIPE_RESOURCE_FLAG_SPARSE)) {
1052 if (templ->bind & ZINK_BIND_VIDEO) {
1064 if (!(templ->flags & PIPE_RESOURCE_FLAG_SPARSE))
1077 if (templ->target == PIPE_BUFFER) {
1089 const struct pipe_resource *templ,
1108 res->base.b = *templ;
1115 struct pipe_resource templ2 = *templ;
1118 if (screen->faked_e5sparse && templ->format == PIPE_FORMAT_R9G9B9E5_FLOAT) {
1129 res->internal_format = templ->format;
1130 if (templ->target == PIPE_BUFFER) {
1133 if (!screen->resizable_bar && templ->width0 >= 8196) {
1144 if (templ->flags & PIPE_RESOURCE_FLAG_SPARSE)
1146 if (templ->flags & PIPE_RESOURCE_FLAG_SPARSE) {
1151 res->format = zink_get_format(screen, templ->format);
1152 if (templ->target == PIPE_TEXTURE_1D || templ->target == PIPE_TEXTURE_1D_ARRAY) {
1153 res->need_2D = (screen->need_2D_zs && util_format_is_depth_or_stencil(templ->format)) ||
1154 (screen->need_2D_sparse && (templ->flags & PIPE_RESOURCE_FLAG_SPARSE));
1160 res->aspect = aspect_from_format(templ->format);
1164 if (templ->bind & PIPE_BIND_DISPLAY_TARGET) {
1169 templ->width0,
1170 templ->height0,
1209 const struct pipe_resource *templ)
1211 return resource_create(pscreen, templ, NULL, 0, NULL, 0, NULL);
1215 zink_resource_create_with_modifiers(struct pipe_screen *pscreen, const struct pipe_resource *templ,
1218 return resource_create(pscreen, templ, NULL, 0, modifiers, modifiers_count, NULL);
1223 const struct pipe_resource *templ,
1226 return resource_create(pscreen, templ, NULL, 0, NULL, 0, loader_private);
1476 const struct pipe_resource *templ,
1485 struct pipe_resource templ2 = *templ;
1486 if (templ->format == PIPE_FORMAT_NONE)
1557 const struct pipe_resource *templ,
1563 struct pipe_resource *pres = resource_create(pscreen, templ, &memobj->whandle, 0, NULL, 0, NULL);
1938 struct pipe_resource templ = *pres;
1939 templ.next = NULL;
1940 templ.format = format;
1941 templ.usage = usage & PIPE_MAP_READ ? PIPE_USAGE_STAGING : PIPE_USAGE_STREAM;
1942 templ.target = PIPE_BUFFER;
1943 templ.bind = PIPE_BIND_LINEAR;
1944 templ.width0 = trans->base.b.layer_stride * box->depth;
1945 templ.height0 = templ.depth0 = 0;
1946 templ.last_level = 0;
1947 templ.array_size = 1;
1948 templ.flags = 0;
1950 trans->staging_res = zink_resource_create(pctx->screen, &templ);