diff options
author | Jason Ekstrand <[email protected]> | 2016-04-15 16:53:31 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-04-21 20:44:27 -0700 |
commit | 90576ac96303941ffefe50e56aad15ba09459aa8 (patch) | |
tree | b8ee5adadf3e014c499c801ca1d12af1cf1668be | |
parent | 37f6f21b1f65d13c706a5de00e531608fea9ea66 (diff) |
isl: Take a devinfo in lower_storage_image_format instead of an isl_device
We want to call this function from the shader compiler and having a full
isl_device available at that point isn't practical.
Reviewed-by: Chad Versace <[email protected]>
-rw-r--r-- | src/intel/isl/isl.h | 2 | ||||
-rw-r--r-- | src/intel/isl/isl_storage_image.c | 30 | ||||
-rw-r--r-- | src/intel/isl/isl_surface_state.c | 3 | ||||
-rw-r--r-- | src/intel/vulkan/anv_image.c | 2 |
4 files changed, 19 insertions, 18 deletions
diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h index 62d3769feea..6c417b29f4c 100644 --- a/src/intel/isl/isl.h +++ b/src/intel/isl/isl.h @@ -900,7 +900,7 @@ enum isl_format isl_format_rgb_to_rgbx(enum isl_format rgb) ATTRIBUTE_CONST; bool isl_is_storage_image_format(enum isl_format fmt); enum isl_format -isl_lower_storage_image_format(const struct isl_device *dev, +isl_lower_storage_image_format(const struct brw_device_info *devinfo, enum isl_format fmt); static inline bool diff --git a/src/intel/isl/isl_storage_image.c b/src/intel/isl/isl_storage_image.c index 2b5b5cdbaed..8d9bea3f954 100644 --- a/src/intel/isl/isl_storage_image.c +++ b/src/intel/isl/isl_storage_image.c @@ -76,7 +76,7 @@ isl_is_storage_image_format(enum isl_format format) } enum isl_format -isl_lower_storage_image_format(const struct isl_device *dev, +isl_lower_storage_image_format(const struct brw_device_info *devinfo, enum isl_format format) { switch (format) { @@ -100,8 +100,8 @@ isl_lower_storage_image_format(const struct isl_device *dev, case ISL_FORMAT_R32G32_UINT: case ISL_FORMAT_R32G32_SINT: case ISL_FORMAT_R32G32_FLOAT: - return (ISL_DEV_GEN(dev) >= 9 ? format : - ISL_DEV_GEN(dev) >= 8 || dev->info->is_haswell ? + return (devinfo->gen >= 9 ? format : + devinfo->gen >= 8 || devinfo->is_haswell ? ISL_FORMAT_R16G16B16A16_UINT : ISL_FORMAT_R32G32_UINT); @@ -117,31 +117,31 @@ isl_lower_storage_image_format(const struct isl_device *dev, */ case ISL_FORMAT_R8G8B8A8_UINT: case ISL_FORMAT_R8G8B8A8_SINT: - return (ISL_DEV_GEN(dev) >= 9 ? format : - ISL_DEV_GEN(dev) >= 8 || dev->info->is_haswell ? + return (devinfo->gen >= 9 ? format : + devinfo->gen >= 8 || devinfo->is_haswell ? ISL_FORMAT_R8G8B8A8_UINT : ISL_FORMAT_R32_UINT); case ISL_FORMAT_R16G16_UINT: case ISL_FORMAT_R16G16_SINT: case ISL_FORMAT_R16G16_FLOAT: - return (ISL_DEV_GEN(dev) >= 9 ? format : - ISL_DEV_GEN(dev) >= 8 || dev->info->is_haswell ? + return (devinfo->gen >= 9 ? format : + devinfo->gen >= 8 || devinfo->is_haswell ? ISL_FORMAT_R16G16_UINT : ISL_FORMAT_R32_UINT); case ISL_FORMAT_R8G8_UINT: case ISL_FORMAT_R8G8_SINT: - return (ISL_DEV_GEN(dev) >= 9 ? format : - ISL_DEV_GEN(dev) >= 8 || dev->info->is_haswell ? + return (devinfo->gen >= 9 ? format : + devinfo->gen >= 8 || devinfo->is_haswell ? ISL_FORMAT_R8G8_UINT : ISL_FORMAT_R16_UINT); case ISL_FORMAT_R16_UINT: case ISL_FORMAT_R16_FLOAT: case ISL_FORMAT_R16_SINT: - return (ISL_DEV_GEN(dev) >= 9 ? format : ISL_FORMAT_R16_UINT); + return (devinfo->gen >= 9 ? format : ISL_FORMAT_R16_UINT); case ISL_FORMAT_R8_UINT: case ISL_FORMAT_R8_SINT: - return (ISL_DEV_GEN(dev) >= 9 ? format : ISL_FORMAT_R8_UINT); + return (devinfo->gen >= 9 ? format : ISL_FORMAT_R8_UINT); /* Neither the 2/10/10/10 nor the 11/11/10 packed formats are supported * by the hardware. @@ -154,23 +154,23 @@ isl_lower_storage_image_format(const struct isl_device *dev, /* No normalized fixed-point formats are supported by the hardware. */ case ISL_FORMAT_R16G16B16A16_UNORM: case ISL_FORMAT_R16G16B16A16_SNORM: - return (ISL_DEV_GEN(dev) >= 8 || dev->info->is_haswell ? + return (devinfo->gen >= 8 || devinfo->is_haswell ? ISL_FORMAT_R16G16B16A16_UINT : ISL_FORMAT_R32G32_UINT); case ISL_FORMAT_R8G8B8A8_UNORM: case ISL_FORMAT_R8G8B8A8_SNORM: - return (ISL_DEV_GEN(dev) >= 8 || dev->info->is_haswell ? + return (devinfo->gen >= 8 || devinfo->is_haswell ? ISL_FORMAT_R8G8B8A8_UINT : ISL_FORMAT_R32_UINT); case ISL_FORMAT_R16G16_UNORM: case ISL_FORMAT_R16G16_SNORM: - return (ISL_DEV_GEN(dev) >= 8 || dev->info->is_haswell ? + return (devinfo->gen >= 8 || devinfo->is_haswell ? ISL_FORMAT_R16G16_UINT : ISL_FORMAT_R32_UINT); case ISL_FORMAT_R8G8_UNORM: case ISL_FORMAT_R8G8_SNORM: - return (ISL_DEV_GEN(dev) >= 8 || dev->info->is_haswell ? + return (devinfo->gen >= 8 || devinfo->is_haswell ? ISL_FORMAT_R8G8_UINT : ISL_FORMAT_R16_UINT); case ISL_FORMAT_R16_UNORM: diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c index cac59fab78e..dd885313aed 100644 --- a/src/intel/isl/isl_surface_state.c +++ b/src/intel/isl/isl_surface_state.c @@ -308,7 +308,8 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state, } if (info->view->usage & ISL_SURF_USAGE_STORAGE_BIT) { - s.SurfaceFormat = isl_lower_storage_image_format(dev, info->view->format); + s.SurfaceFormat = + isl_lower_storage_image_format(dev->info, info->view->format); } else { s.SurfaceFormat = info->view->format; } diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index db109625316..7236b8146c0 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -678,7 +678,7 @@ void anv_buffer_view_init(struct anv_buffer_view *view, enum isl_format storage_format = has_matching_storage_typed_format(device, view->format) ? - isl_lower_storage_image_format(&device->isl_dev, view->format) : + isl_lower_storage_image_format(&device->info, view->format) : ISL_FORMAT_RAW; anv_fill_buffer_surface_state(device, view->storage_surface_state, |