コード例 #1
0
ファイル: ilo_layout.c プロジェクト: John-Gee/Mesa-3D
/**
 * 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(&params, 0, sizeof(params));
   params.dev = dev;
   params.templ = templ;

   /* note that there are dependencies between these functions */
   layout_init_aux(layout, &params);
   layout_init_size_and_format(layout, &params);
   layout_init_walk(layout, &params);
   layout_init_tiling(layout, &params);
   layout_init_alignments(layout, &params);
   layout_init_lods(layout, &params);
   layout_init_layer_height(layout, &params);

   layout_align(layout, &params);
   layout_calculate_bo_size(layout, &params);

   switch (layout->aux) {
   case ILO_LAYOUT_AUX_HIZ:
      layout_calculate_hiz_size(layout, &params);
      break;
   case ILO_LAYOUT_AUX_MCS:
      layout_calculate_mcs_size(layout, &params);
      break;
   default:
      break;
   }
}
コード例 #2
0
ファイル: layout.c プロジェクト: LunarG/VulkanTools
/**
 * 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(&params, 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, &params);
   layout_init_size_and_format(layout, &params);
   layout_init_walk(layout, &params);
   layout_init_tiling(layout, &params);
   layout_init_alignments(layout, &params);
   layout_init_lods(layout, &params);
   layout_init_layer_height(layout, &params);

   layout_align(layout, &params);
   layout_calculate_bo_size(layout, &params);

   switch (layout->aux) {
   case INTEL_LAYOUT_AUX_HIZ:
      layout_calculate_hiz_size(layout, &params);
      break;
   case INTEL_LAYOUT_AUX_MCS:
      layout_calculate_mcs_size(layout, &params);
      break;
   default:
      break;
   }
}