summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_image.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-05-15 21:15:59 -0700
committerJason Ekstrand <[email protected]>2016-05-17 12:17:22 -0700
commit8ed429a4f0d58eafe3e3212552af6fb0cb78feeb (patch)
tree0d0d24253ce01f136b6b8b0a394a970753fed33f /src/intel/vulkan/anv_image.c
parent13f5cee663f693bc2cafeda9c3d6fc3537334dde (diff)
anv/formats: Add an anv_get_format helper
This commit removes anv_format_for_vk_format and adds an anv_get_format helper. The anv_get_format helper returns the anv_format by-value. Unlike anv_format_for_vk_format the format returned by anv_get_format is 100% accurate and includes any tweaks needed for tiled vs. linear. anv_get_isl_format is now just a wrapper around anv_get_format that picks off just the isl_format.
Diffstat (limited to 'src/intel/vulkan/anv_image.c')
-rw-r--r--src/intel/vulkan/anv_image.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index 792645d5cea..75c02b3a672 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -131,8 +131,7 @@ make_surface(const struct anv_device *dev,
ok = isl_surf_init(&dev->isl_dev, &anv_surf->isl,
.dim = vk_to_isl_surf_dim[vk_info->imageType],
- .format = anv_get_isl_format(vk_info->format, aspect,
- vk_info->tiling, NULL),
+ .format = anv_get_isl_format(vk_info->format, aspect, vk_info->tiling),
.width = image->extent.width,
.height = image->extent.height,
.depth = image->extent.depth,
@@ -473,29 +472,27 @@ anv_image_view_init(struct anv_image_view *iview,
iview->aspect_mask = pCreateInfo->subresourceRange.aspectMask;
iview->vk_format = pCreateInfo->format;
- struct anv_format_swizzle swizzle;
- enum isl_format format = anv_get_isl_format(pCreateInfo->format,
- range->aspectMask,
- image->tiling, &swizzle);
+ struct anv_format format =
+ anv_get_format(pCreateInfo->format, range->aspectMask, image->tiling);
iview->base_layer = range->baseArrayLayer;
iview->base_mip = range->baseMipLevel;
struct isl_view isl_view = {
- .format = format,
+ .format = format.isl_format,
.base_level = range->baseMipLevel,
.levels = anv_get_levelCount(image, range),
.base_array_layer = range->baseArrayLayer,
.array_len = anv_get_layerCount(image, range),
.channel_select = {
remap_swizzle(pCreateInfo->components.r,
- VK_COMPONENT_SWIZZLE_R, swizzle),
+ VK_COMPONENT_SWIZZLE_R, format.swizzle),
remap_swizzle(pCreateInfo->components.g,
- VK_COMPONENT_SWIZZLE_G, swizzle),
+ VK_COMPONENT_SWIZZLE_G, format.swizzle),
remap_swizzle(pCreateInfo->components.b,
- VK_COMPONENT_SWIZZLE_B, swizzle),
+ VK_COMPONENT_SWIZZLE_B, format.swizzle),
remap_swizzle(pCreateInfo->components.a,
- VK_COMPONENT_SWIZZLE_A, swizzle),
+ VK_COMPONENT_SWIZZLE_A, format.swizzle),
},
};
@@ -548,7 +545,8 @@ anv_image_view_init(struct anv_image_view *iview,
if (image->usage & usage_mask & VK_IMAGE_USAGE_STORAGE_BIT) {
iview->storage_surface_state = alloc_surface_state(device, cmd_buffer);
- if (isl_has_matching_typed_storage_image_format(&device->info, format)) {
+ if (isl_has_matching_typed_storage_image_format(&device->info,
+ format.isl_format)) {
isl_view.usage = cube_usage | ISL_SURF_USAGE_STORAGE_BIT;
isl_surf_fill_state(&device->isl_dev,
iview->storage_surface_state.map,
@@ -631,7 +629,7 @@ void anv_buffer_view_init(struct anv_buffer_view *view,
view->format = anv_get_isl_format(pCreateInfo->format,
VK_IMAGE_ASPECT_COLOR_BIT,
- VK_IMAGE_TILING_LINEAR, NULL);
+ VK_IMAGE_TILING_LINEAR);
view->bo = buffer->bo;
view->offset = buffer->offset + pCreateInfo->offset;
view->range = pCreateInfo->range == VK_WHOLE_SIZE ?