vk: Return anv_image_view_info by value
authorChad Versace <chad.versace@intel.com>
Mon, 5 Oct 2015 20:22:44 +0000 (13:22 -0700)
committerChad Versace <chad.versace@intel.com>
Mon, 5 Oct 2015 20:22:44 +0000 (13:22 -0700)
The struct is only 2 bytes. Returning it on the stack is better than
returning a reference into the ELF .data segment.

src/vulkan/anv_image.c
src/vulkan/anv_private.h
src/vulkan/gen7_state.c
src/vulkan/gen8_state.c

index 43245297f0e7fec745b47bb8204360522bbc64b5..248df3d9b420359f16c7e0059c3e3881c31e8207 100644 (file)
@@ -61,10 +61,10 @@ anv_image_view_info_table[] = {
    #undef INFO
 };
 
-const struct anv_image_view_info *
+struct anv_image_view_info
 anv_image_view_info_for_vk_image_view_type(VkImageViewType type)
 {
-   return &anv_image_view_info_table[type];
+   return anv_image_view_info_table[type];
 }
 
 static const struct anv_surf_type_limits {
index 15e5124d857dc00521e696af3bb163a2200b716e..bc747fcd27c8d29f275ba292110f44deb4a838d9 100644 (file)
@@ -1154,7 +1154,7 @@ struct anv_image_view_info {
    bool is_cube:1; /**< RENDER_SURFACE_STATE.CubeFaceEnable* */
 };
 
-const struct anv_image_view_info *
+struct anv_image_view_info
 anv_image_view_info_for_vk_image_view_type(VkImageViewType type);
 
 /**
index f93349da0b06bf8c6841f95ce14b779d95a86ac2..7445bf02042cacc119bd9209c6825478c536dc1f 100644 (file)
@@ -279,7 +279,7 @@ gen7_image_view_init(struct anv_image_view *iview,
    const struct anv_format *format =
       anv_format_for_vk_format(pCreateInfo->format);
 
-   const struct anv_image_view_info *view_type_info =
+   const struct anv_image_view_info view_type_info =
       anv_image_view_info_for_vk_image_view_type(pCreateInfo->viewType);
 
    if (pCreateInfo->viewType != VK_IMAGE_VIEW_TYPE_2D)
@@ -303,7 +303,7 @@ gen7_image_view_init(struct anv_image_view *iview,
    }
 
    struct GEN7_RENDER_SURFACE_STATE surface_state = {
-      .SurfaceType = view_type_info->surface_type,
+      .SurfaceType = view_type_info.surface_type,
       .SurfaceArray = image->array_size > 1,
       .SurfaceFormat = format->surface_format,
       .SurfaceVerticalAlignment = anv_valign[surface->v_align],
index 3709a50005d74636f234d4910f926bb94e2fa7cf..0ef44d03c4441aeb66726efc1d70d63680c9c9f4 100644 (file)
@@ -158,7 +158,7 @@ gen8_image_view_init(struct anv_image_view *iview,
    const struct anv_format *format_info =
       anv_format_for_vk_format(pCreateInfo->format);
 
-   const struct anv_image_view_info *view_type_info =
+   const struct anv_image_view_info view_type_info =
       anv_image_view_info_for_vk_image_view_type(pCreateInfo->viewType);
 
    view->bo = image->bo;
@@ -220,7 +220,7 @@ gen8_image_view_init(struct anv_image_view *iview,
    };
 
    struct GEN8_RENDER_SURFACE_STATE surface_state = {
-      .SurfaceType = view_type_info->surface_type,
+      .SurfaceType = view_type_info.surface_type,
       .SurfaceArray = image->array_size > 1,
       .SurfaceFormat = format_info->surface_format,
       .SurfaceVerticalAlignment = anv_valign[surface->v_align],