summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-08-27 21:39:16 -0700
committerJason Ekstrand <[email protected]>2016-09-12 19:42:57 -0700
commit7ddb21708c800dfbe3cea2df6aaaf7aed852761b (patch)
treed6572da54873cc2f06aeef659aecaa1a868e89ab /src/intel/vulkan
parent376d1dc2f1f5a36fe20ede5defe394b87b385731 (diff)
intel/isl: Add an isl_swizzle structure and use it for isl_view swizzles
This should be more compact than the enum isl_channel_select[4] that we were using before. It's also very convenient because we already had such a structure in the Vulkan driver we just needed to pull it over. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src/intel/vulkan')
-rw-r--r--src/intel/vulkan/anv_formats.c9
-rw-r--r--src/intel/vulkan/anv_image.c20
-rw-r--r--src/intel/vulkan/anv_private.h9
3 files changed, 12 insertions, 26 deletions
diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index a746cd3545b..ff59f479fd0 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -24,13 +24,6 @@
#include "anv_private.h"
#include "vk_format_info.h"
-#define ISL_SWIZZLE(r, g, b, a) { \
- ISL_CHANNEL_SELECT_##r, \
- ISL_CHANNEL_SELECT_##g, \
- ISL_CHANNEL_SELECT_##b, \
- ISL_CHANNEL_SELECT_##a, \
-}
-
#define RGBA ISL_SWIZZLE(RED, GREEN, BLUE, ALPHA)
#define BGRA ISL_SWIZZLE(BLUE, GREEN, RED, ALPHA)
#define RGB1 ISL_SWIZZLE(RED, GREEN, BLUE, ONE)
@@ -283,7 +276,7 @@ anv_get_format(const struct gen_device_info *devinfo, VkFormat vk_format,
format.isl_format = rgbx;
} else {
format.isl_format = isl_format_rgb_to_rgba(format.isl_format);
- format.swizzle = (struct anv_format_swizzle) RGB1;
+ format.swizzle = RGB1;
}
}
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index af6b4ca8511..63b8c86f5c3 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -345,7 +345,7 @@ alloc_surface_state(struct anv_device *device,
static enum isl_channel_select
remap_swizzle(VkComponentSwizzle swizzle, VkComponentSwizzle component,
- struct anv_format_swizzle format_swizzle)
+ struct isl_swizzle format_swizzle)
{
if (swizzle == VK_COMPONENT_SWIZZLE_IDENTITY)
swizzle = component;
@@ -414,15 +414,15 @@ anv_image_view_init(struct anv_image_view *iview,
.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, format.swizzle),
- remap_swizzle(pCreateInfo->components.g,
- VK_COMPONENT_SWIZZLE_G, format.swizzle),
- remap_swizzle(pCreateInfo->components.b,
- VK_COMPONENT_SWIZZLE_B, format.swizzle),
- remap_swizzle(pCreateInfo->components.a,
- VK_COMPONENT_SWIZZLE_A, format.swizzle),
+ .swizzle = {
+ .r = remap_swizzle(pCreateInfo->components.r,
+ VK_COMPONENT_SWIZZLE_R, format.swizzle),
+ .g = remap_swizzle(pCreateInfo->components.g,
+ VK_COMPONENT_SWIZZLE_G, format.swizzle),
+ .b = remap_swizzle(pCreateInfo->components.b,
+ VK_COMPONENT_SWIZZLE_B, format.swizzle),
+ .a = remap_swizzle(pCreateInfo->components.a,
+ VK_COMPONENT_SWIZZLE_A, format.swizzle),
},
};
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 99b3acf1a6a..f32806ca299 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -1621,16 +1621,9 @@ anv_graphics_pipeline_create(VkDevice device,
const VkAllocationCallbacks *alloc,
VkPipeline *pPipeline);
-struct anv_format_swizzle {
- enum isl_channel_select r:4;
- enum isl_channel_select g:4;
- enum isl_channel_select b:4;
- enum isl_channel_select a:4;
-};
-
struct anv_format {
enum isl_format isl_format:16;
- struct anv_format_swizzle swizzle;
+ struct isl_swizzle swizzle;
};
struct anv_format