/** * Initialize the layout. Callers should zero-initialize \p layout first. */ void ilo_layout_init(struct ilo_layout *layout, const struct ilo_dev_info *dev, const struct pipe_resource *templ) { struct ilo_layout_params params; bool transfer_only; /* use transfer layout when the texture is never bound to GPU */ transfer_only = !(templ->bind & ~(PIPE_BIND_TRANSFER_WRITE | PIPE_BIND_TRANSFER_READ)); if (transfer_only && templ->last_level == 0 && templ->nr_samples <= 1) { layout_init_for_transfer(layout, dev, templ); return; } memset(¶ms, 0, sizeof(params)); params.dev = dev; params.templ = templ; /* note that there are dependencies between these functions */ layout_init_aux(layout, ¶ms); layout_init_size_and_format(layout, ¶ms); layout_init_walk(layout, ¶ms); layout_init_tiling(layout, ¶ms); layout_init_alignments(layout, ¶ms); layout_init_lods(layout, ¶ms); layout_init_layer_height(layout, ¶ms); layout_align(layout, ¶ms); layout_calculate_bo_size(layout, ¶ms); switch (layout->aux) { case ILO_LAYOUT_AUX_HIZ: layout_calculate_hiz_size(layout, ¶ms); break; case ILO_LAYOUT_AUX_MCS: layout_calculate_mcs_size(layout, ¶ms); break; default: break; } }
/** * Initialize the layout. Callers should zero-initialize \p layout first. */ void intel_layout_init(struct intel_layout *layout, struct intel_dev *dev, const VkImageCreateInfo *info, bool scanout) { struct intel_layout_params params; memset(¶ms, 0, sizeof(params)); params.dev = dev; params.gpu = dev->gpu; params.info = info; params.scanout = scanout; /* note that there are dependencies between these functions */ layout_init_aux(layout, ¶ms); layout_init_size_and_format(layout, ¶ms); layout_init_walk(layout, ¶ms); layout_init_tiling(layout, ¶ms); layout_init_alignments(layout, ¶ms); layout_init_lods(layout, ¶ms); layout_init_layer_height(layout, ¶ms); layout_align(layout, ¶ms); layout_calculate_bo_size(layout, ¶ms); switch (layout->aux) { case INTEL_LAYOUT_AUX_HIZ: layout_calculate_hiz_size(layout, ¶ms); break; case INTEL_LAYOUT_AUX_MCS: layout_calculate_mcs_size(layout, ¶ms); break; default: break; } }