vk/0.210.0: Rework texture view component mapping
This commit is contained in:
@@ -467,18 +467,19 @@ typedef enum VkImageViewType {
|
|||||||
VK_IMAGE_VIEW_TYPE_MAX_ENUM = 0x7FFFFFFF
|
VK_IMAGE_VIEW_TYPE_MAX_ENUM = 0x7FFFFFFF
|
||||||
} VkImageViewType;
|
} VkImageViewType;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum VkComponentSwizzle {
|
||||||
VK_CHANNEL_SWIZZLE_ZERO = 0,
|
VK_COMPONENT_SWIZZLE_IDENTITY = 0,
|
||||||
VK_CHANNEL_SWIZZLE_ONE = 1,
|
VK_COMPONENT_SWIZZLE_ZERO = 1,
|
||||||
VK_CHANNEL_SWIZZLE_R = 2,
|
VK_COMPONENT_SWIZZLE_ONE = 2,
|
||||||
VK_CHANNEL_SWIZZLE_G = 3,
|
VK_COMPONENT_SWIZZLE_R = 3,
|
||||||
VK_CHANNEL_SWIZZLE_B = 4,
|
VK_COMPONENT_SWIZZLE_G = 4,
|
||||||
VK_CHANNEL_SWIZZLE_A = 5,
|
VK_COMPONENT_SWIZZLE_B = 5,
|
||||||
VK_CHANNEL_SWIZZLE_BEGIN_RANGE = VK_CHANNEL_SWIZZLE_ZERO,
|
VK_COMPONENT_SWIZZLE_A = 6,
|
||||||
VK_CHANNEL_SWIZZLE_END_RANGE = VK_CHANNEL_SWIZZLE_A,
|
VK_COMPONENT_SWIZZLE_BEGIN_RANGE = VK_COMPONENT_SWIZZLE_IDENTITY,
|
||||||
VK_CHANNEL_SWIZZLE_NUM = (VK_CHANNEL_SWIZZLE_A - VK_CHANNEL_SWIZZLE_ZERO + 1),
|
VK_COMPONENT_SWIZZLE_END_RANGE = VK_COMPONENT_SWIZZLE_A,
|
||||||
VK_CHANNEL_SWIZZLE_MAX_ENUM = 0x7FFFFFFF
|
VK_COMPONENT_SWIZZLE_RANGE_SIZE = (VK_COMPONENT_SWIZZLE_A - VK_COMPONENT_SWIZZLE_IDENTITY + 1),
|
||||||
} VkChannelSwizzle;
|
VK_COMPONENT_SWIZZLE_MAX_ENUM = 0x7FFFFFFF
|
||||||
|
} VkComponentSwizzle;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
VK_SHADER_STAGE_VERTEX = 0,
|
VK_SHADER_STAGE_VERTEX = 0,
|
||||||
@@ -1493,12 +1494,12 @@ typedef struct {
|
|||||||
VkDeviceSize depthPitch;
|
VkDeviceSize depthPitch;
|
||||||
} VkSubresourceLayout;
|
} VkSubresourceLayout;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct VkComponentMapping {
|
||||||
VkChannelSwizzle r;
|
VkComponentSwizzle r;
|
||||||
VkChannelSwizzle g;
|
VkComponentSwizzle g;
|
||||||
VkChannelSwizzle b;
|
VkComponentSwizzle b;
|
||||||
VkChannelSwizzle a;
|
VkComponentSwizzle a;
|
||||||
} VkChannelMapping;
|
} VkComponentMapping;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
VkImageAspectFlags aspectMask;
|
VkImageAspectFlags aspectMask;
|
||||||
@@ -1514,7 +1515,7 @@ typedef struct {
|
|||||||
VkImage image;
|
VkImage image;
|
||||||
VkImageViewType viewType;
|
VkImageViewType viewType;
|
||||||
VkFormat format;
|
VkFormat format;
|
||||||
VkChannelMapping channels;
|
VkComponentMapping components;
|
||||||
VkImageSubresourceRange subresourceRange;
|
VkImageSubresourceRange subresourceRange;
|
||||||
VkImageViewCreateFlags flags;
|
VkImageViewCreateFlags flags;
|
||||||
} VkImageViewCreateInfo;
|
} VkImageViewCreateInfo;
|
||||||
|
@@ -474,14 +474,14 @@ anv_validate_CreateImageView(VkDevice _device,
|
|||||||
view_format_info = anv_format_for_vk_format(pCreateInfo->format);
|
view_format_info = anv_format_for_vk_format(pCreateInfo->format);
|
||||||
|
|
||||||
/* Validate channel swizzles. */
|
/* Validate channel swizzles. */
|
||||||
assert(pCreateInfo->channels.r >= VK_CHANNEL_SWIZZLE_BEGIN_RANGE);
|
assert(pCreateInfo->components.r >= VK_COMPONENT_SWIZZLE_BEGIN_RANGE);
|
||||||
assert(pCreateInfo->channels.r <= VK_CHANNEL_SWIZZLE_END_RANGE);
|
assert(pCreateInfo->components.r <= VK_COMPONENT_SWIZZLE_END_RANGE);
|
||||||
assert(pCreateInfo->channels.g >= VK_CHANNEL_SWIZZLE_BEGIN_RANGE);
|
assert(pCreateInfo->components.g >= VK_COMPONENT_SWIZZLE_BEGIN_RANGE);
|
||||||
assert(pCreateInfo->channels.g <= VK_CHANNEL_SWIZZLE_END_RANGE);
|
assert(pCreateInfo->components.g <= VK_COMPONENT_SWIZZLE_END_RANGE);
|
||||||
assert(pCreateInfo->channels.b >= VK_CHANNEL_SWIZZLE_BEGIN_RANGE);
|
assert(pCreateInfo->components.b >= VK_COMPONENT_SWIZZLE_BEGIN_RANGE);
|
||||||
assert(pCreateInfo->channels.b <= VK_CHANNEL_SWIZZLE_END_RANGE);
|
assert(pCreateInfo->components.b <= VK_COMPONENT_SWIZZLE_END_RANGE);
|
||||||
assert(pCreateInfo->channels.a >= VK_CHANNEL_SWIZZLE_BEGIN_RANGE);
|
assert(pCreateInfo->components.a >= VK_COMPONENT_SWIZZLE_BEGIN_RANGE);
|
||||||
assert(pCreateInfo->channels.a <= VK_CHANNEL_SWIZZLE_END_RANGE);
|
assert(pCreateInfo->components.a <= VK_COMPONENT_SWIZZLE_END_RANGE);
|
||||||
|
|
||||||
/* Validate subresource. */
|
/* Validate subresource. */
|
||||||
assert(subresource->aspectMask != 0);
|
assert(subresource->aspectMask != 0);
|
||||||
|
@@ -698,12 +698,6 @@ do_buffer_copy(struct anv_cmd_buffer *cmd_buffer,
|
|||||||
.image = src_image,
|
.image = src_image,
|
||||||
.viewType = VK_IMAGE_VIEW_TYPE_2D,
|
.viewType = VK_IMAGE_VIEW_TYPE_2D,
|
||||||
.format = copy_format,
|
.format = copy_format,
|
||||||
.channels = {
|
|
||||||
VK_CHANNEL_SWIZZLE_R,
|
|
||||||
VK_CHANNEL_SWIZZLE_G,
|
|
||||||
VK_CHANNEL_SWIZZLE_B,
|
|
||||||
VK_CHANNEL_SWIZZLE_A
|
|
||||||
},
|
|
||||||
.subresourceRange = {
|
.subresourceRange = {
|
||||||
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
.baseMipLevel = 0,
|
.baseMipLevel = 0,
|
||||||
@@ -721,12 +715,6 @@ do_buffer_copy(struct anv_cmd_buffer *cmd_buffer,
|
|||||||
.image = dest_image,
|
.image = dest_image,
|
||||||
.viewType = VK_IMAGE_VIEW_TYPE_2D,
|
.viewType = VK_IMAGE_VIEW_TYPE_2D,
|
||||||
.format = copy_format,
|
.format = copy_format,
|
||||||
.channels = {
|
|
||||||
.r = VK_CHANNEL_SWIZZLE_R,
|
|
||||||
.g = VK_CHANNEL_SWIZZLE_G,
|
|
||||||
.b = VK_CHANNEL_SWIZZLE_B,
|
|
||||||
.a = VK_CHANNEL_SWIZZLE_A,
|
|
||||||
},
|
|
||||||
.subresourceRange = {
|
.subresourceRange = {
|
||||||
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
.baseMipLevel = 0,
|
.baseMipLevel = 0,
|
||||||
@@ -858,12 +846,6 @@ void anv_CmdCopyImage(
|
|||||||
.image = srcImage,
|
.image = srcImage,
|
||||||
.viewType = src_iview_type,
|
.viewType = src_iview_type,
|
||||||
.format = src_image->format->vk_format,
|
.format = src_image->format->vk_format,
|
||||||
.channels = {
|
|
||||||
VK_CHANNEL_SWIZZLE_R,
|
|
||||||
VK_CHANNEL_SWIZZLE_G,
|
|
||||||
VK_CHANNEL_SWIZZLE_B,
|
|
||||||
VK_CHANNEL_SWIZZLE_A
|
|
||||||
},
|
|
||||||
.subresourceRange = {
|
.subresourceRange = {
|
||||||
.aspectMask = 1 << pRegions[r].srcSubresource.aspect,
|
.aspectMask = 1 << pRegions[r].srcSubresource.aspect,
|
||||||
.baseMipLevel = pRegions[r].srcSubresource.mipLevel,
|
.baseMipLevel = pRegions[r].srcSubresource.mipLevel,
|
||||||
@@ -908,12 +890,6 @@ void anv_CmdCopyImage(
|
|||||||
.image = destImage,
|
.image = destImage,
|
||||||
.viewType = VK_IMAGE_VIEW_TYPE_2D,
|
.viewType = VK_IMAGE_VIEW_TYPE_2D,
|
||||||
.format = dest_image->format->vk_format,
|
.format = dest_image->format->vk_format,
|
||||||
.channels = {
|
|
||||||
VK_CHANNEL_SWIZZLE_R,
|
|
||||||
VK_CHANNEL_SWIZZLE_G,
|
|
||||||
VK_CHANNEL_SWIZZLE_B,
|
|
||||||
VK_CHANNEL_SWIZZLE_A
|
|
||||||
},
|
|
||||||
.subresourceRange = {
|
.subresourceRange = {
|
||||||
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
.baseMipLevel = pRegions[r].destSubresource.mipLevel,
|
.baseMipLevel = pRegions[r].destSubresource.mipLevel,
|
||||||
@@ -970,12 +946,6 @@ void anv_CmdBlitImage(
|
|||||||
.image = srcImage,
|
.image = srcImage,
|
||||||
.viewType = src_iview_type,
|
.viewType = src_iview_type,
|
||||||
.format = src_image->format->vk_format,
|
.format = src_image->format->vk_format,
|
||||||
.channels = {
|
|
||||||
VK_CHANNEL_SWIZZLE_R,
|
|
||||||
VK_CHANNEL_SWIZZLE_G,
|
|
||||||
VK_CHANNEL_SWIZZLE_B,
|
|
||||||
VK_CHANNEL_SWIZZLE_A
|
|
||||||
},
|
|
||||||
.subresourceRange = {
|
.subresourceRange = {
|
||||||
.aspectMask = 1 << pRegions[r].srcSubresource.aspect,
|
.aspectMask = 1 << pRegions[r].srcSubresource.aspect,
|
||||||
.baseMipLevel = pRegions[r].srcSubresource.mipLevel,
|
.baseMipLevel = pRegions[r].srcSubresource.mipLevel,
|
||||||
@@ -1010,12 +980,6 @@ void anv_CmdBlitImage(
|
|||||||
.image = destImage,
|
.image = destImage,
|
||||||
.viewType = VK_IMAGE_VIEW_TYPE_2D,
|
.viewType = VK_IMAGE_VIEW_TYPE_2D,
|
||||||
.format = dest_image->format->vk_format,
|
.format = dest_image->format->vk_format,
|
||||||
.channels = {
|
|
||||||
VK_CHANNEL_SWIZZLE_R,
|
|
||||||
VK_CHANNEL_SWIZZLE_G,
|
|
||||||
VK_CHANNEL_SWIZZLE_B,
|
|
||||||
VK_CHANNEL_SWIZZLE_A
|
|
||||||
},
|
|
||||||
.subresourceRange = {
|
.subresourceRange = {
|
||||||
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
.baseMipLevel = pRegions[r].destSubresource.mipLevel,
|
.baseMipLevel = pRegions[r].destSubresource.mipLevel,
|
||||||
@@ -1133,12 +1097,6 @@ void anv_CmdCopyBufferToImage(
|
|||||||
.image = anv_image_to_handle(src_image),
|
.image = anv_image_to_handle(src_image),
|
||||||
.viewType = VK_IMAGE_VIEW_TYPE_2D,
|
.viewType = VK_IMAGE_VIEW_TYPE_2D,
|
||||||
.format = proxy_format,
|
.format = proxy_format,
|
||||||
.channels = {
|
|
||||||
VK_CHANNEL_SWIZZLE_R,
|
|
||||||
VK_CHANNEL_SWIZZLE_G,
|
|
||||||
VK_CHANNEL_SWIZZLE_B,
|
|
||||||
VK_CHANNEL_SWIZZLE_A
|
|
||||||
},
|
|
||||||
.subresourceRange = {
|
.subresourceRange = {
|
||||||
.aspectMask = 1 << proxy_aspect,
|
.aspectMask = 1 << proxy_aspect,
|
||||||
.baseMipLevel = 0,
|
.baseMipLevel = 0,
|
||||||
@@ -1156,12 +1114,6 @@ void anv_CmdCopyBufferToImage(
|
|||||||
.image = anv_image_to_handle(dest_image),
|
.image = anv_image_to_handle(dest_image),
|
||||||
.viewType = VK_IMAGE_VIEW_TYPE_2D,
|
.viewType = VK_IMAGE_VIEW_TYPE_2D,
|
||||||
.format = proxy_format,
|
.format = proxy_format,
|
||||||
.channels = {
|
|
||||||
VK_CHANNEL_SWIZZLE_R,
|
|
||||||
VK_CHANNEL_SWIZZLE_G,
|
|
||||||
VK_CHANNEL_SWIZZLE_B,
|
|
||||||
VK_CHANNEL_SWIZZLE_A
|
|
||||||
},
|
|
||||||
.subresourceRange = {
|
.subresourceRange = {
|
||||||
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
.baseMipLevel = pRegions[r].imageSubresource.mipLevel,
|
.baseMipLevel = pRegions[r].imageSubresource.mipLevel,
|
||||||
@@ -1233,12 +1185,6 @@ void anv_CmdCopyImageToBuffer(
|
|||||||
.image = srcImage,
|
.image = srcImage,
|
||||||
.viewType = src_iview_type,
|
.viewType = src_iview_type,
|
||||||
.format = src_image->format->vk_format,
|
.format = src_image->format->vk_format,
|
||||||
.channels = {
|
|
||||||
VK_CHANNEL_SWIZZLE_R,
|
|
||||||
VK_CHANNEL_SWIZZLE_G,
|
|
||||||
VK_CHANNEL_SWIZZLE_B,
|
|
||||||
VK_CHANNEL_SWIZZLE_A
|
|
||||||
},
|
|
||||||
.subresourceRange = {
|
.subresourceRange = {
|
||||||
.aspectMask = 1 << pRegions[r].imageSubresource.aspect,
|
.aspectMask = 1 << pRegions[r].imageSubresource.aspect,
|
||||||
.baseMipLevel = pRegions[r].imageSubresource.mipLevel,
|
.baseMipLevel = pRegions[r].imageSubresource.mipLevel,
|
||||||
@@ -1279,12 +1225,6 @@ void anv_CmdCopyImageToBuffer(
|
|||||||
.image = anv_image_to_handle(dest_image),
|
.image = anv_image_to_handle(dest_image),
|
||||||
.viewType = VK_IMAGE_VIEW_TYPE_2D,
|
.viewType = VK_IMAGE_VIEW_TYPE_2D,
|
||||||
.format = dest_format,
|
.format = dest_format,
|
||||||
.channels = {
|
|
||||||
VK_CHANNEL_SWIZZLE_R,
|
|
||||||
VK_CHANNEL_SWIZZLE_G,
|
|
||||||
VK_CHANNEL_SWIZZLE_B,
|
|
||||||
VK_CHANNEL_SWIZZLE_A
|
|
||||||
},
|
|
||||||
.subresourceRange = {
|
.subresourceRange = {
|
||||||
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
.baseMipLevel = 0,
|
.baseMipLevel = 0,
|
||||||
|
@@ -701,12 +701,6 @@ void anv_CmdClearColorImage(
|
|||||||
.image = _image,
|
.image = _image,
|
||||||
.viewType = VK_IMAGE_VIEW_TYPE_2D,
|
.viewType = VK_IMAGE_VIEW_TYPE_2D,
|
||||||
.format = image->format->vk_format,
|
.format = image->format->vk_format,
|
||||||
.channels = {
|
|
||||||
VK_CHANNEL_SWIZZLE_R,
|
|
||||||
VK_CHANNEL_SWIZZLE_G,
|
|
||||||
VK_CHANNEL_SWIZZLE_B,
|
|
||||||
VK_CHANNEL_SWIZZLE_A
|
|
||||||
},
|
|
||||||
.subresourceRange = {
|
.subresourceRange = {
|
||||||
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
||||||
.baseMipLevel = pRanges[r].baseMipLevel + l,
|
.baseMipLevel = pRanges[r].baseMipLevel + l,
|
||||||
|
@@ -182,15 +182,24 @@ static const uint8_t anv_valign[] = {
|
|||||||
[4] = VALIGN_4,
|
[4] = VALIGN_4,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t vk_to_gen_swizzle[] = {
|
static const uint32_t vk_to_gen_swizzle_map[] = {
|
||||||
[VK_CHANNEL_SWIZZLE_ZERO] = SCS_ZERO,
|
[VK_COMPONENT_SWIZZLE_ZERO] = SCS_ZERO,
|
||||||
[VK_CHANNEL_SWIZZLE_ONE] = SCS_ONE,
|
[VK_COMPONENT_SWIZZLE_ONE] = SCS_ONE,
|
||||||
[VK_CHANNEL_SWIZZLE_R] = SCS_RED,
|
[VK_COMPONENT_SWIZZLE_R] = SCS_RED,
|
||||||
[VK_CHANNEL_SWIZZLE_G] = SCS_GREEN,
|
[VK_COMPONENT_SWIZZLE_G] = SCS_GREEN,
|
||||||
[VK_CHANNEL_SWIZZLE_B] = SCS_BLUE,
|
[VK_COMPONENT_SWIZZLE_B] = SCS_BLUE,
|
||||||
[VK_CHANNEL_SWIZZLE_A] = SCS_ALPHA
|
[VK_COMPONENT_SWIZZLE_A] = SCS_ALPHA
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static uint32_t
|
||||||
|
vk_to_gen_swizzle(VkComponentSwizzle swizzle, VkComponentSwizzle component)
|
||||||
|
{
|
||||||
|
if (swizzle == VK_COMPONENT_SWIZZLE_IDENTITY)
|
||||||
|
return vk_to_gen_swizzle_map[component];
|
||||||
|
else
|
||||||
|
return vk_to_gen_swizzle_map[swizzle];
|
||||||
|
}
|
||||||
|
|
||||||
GENX_FUNC(GEN7, GEN75) void
|
GENX_FUNC(GEN7, GEN75) void
|
||||||
genX(image_view_init)(struct anv_image_view *iview,
|
genX(image_view_init)(struct anv_image_view *iview,
|
||||||
struct anv_device *device,
|
struct anv_device *device,
|
||||||
@@ -263,10 +272,14 @@ genX(image_view_init)(struct anv_image_view *iview,
|
|||||||
|
|
||||||
.MCSEnable = false,
|
.MCSEnable = false,
|
||||||
# if (ANV_IS_HASWELL)
|
# if (ANV_IS_HASWELL)
|
||||||
.ShaderChannelSelectR = vk_to_gen_swizzle[pCreateInfo->channels.r],
|
.ShaderChannelSelectR = vk_to_gen_swizzle(pCreateInfo->components.r,
|
||||||
.ShaderChannelSelectG = vk_to_gen_swizzle[pCreateInfo->channels.g],
|
VK_COMPONENT_SWIZZLE_R),
|
||||||
.ShaderChannelSelectB = vk_to_gen_swizzle[pCreateInfo->channels.b],
|
.ShaderChannelSelectG = vk_to_gen_swizzle(pCreateInfo->components.g,
|
||||||
.ShaderChannelSelectA = vk_to_gen_swizzle[pCreateInfo->channels.a],
|
VK_COMPONENT_SWIZZLE_G),
|
||||||
|
.ShaderChannelSelectB = vk_to_gen_swizzle(pCreateInfo->components.b,
|
||||||
|
VK_COMPONENT_SWIZZLE_B),
|
||||||
|
.ShaderChannelSelectA = vk_to_gen_swizzle(pCreateInfo->components.a,
|
||||||
|
VK_COMPONENT_SWIZZLE_A),
|
||||||
# else /* XXX: Seriously? */
|
# else /* XXX: Seriously? */
|
||||||
.RedClearColor = 0,
|
.RedClearColor = 0,
|
||||||
.GreenClearColor = 0,
|
.GreenClearColor = 0,
|
||||||
|
@@ -87,6 +87,24 @@ alloc_surface_state(struct anv_device *device,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const uint32_t vk_to_gen_swizzle_map[] = {
|
||||||
|
[VK_COMPONENT_SWIZZLE_ZERO] = SCS_ZERO,
|
||||||
|
[VK_COMPONENT_SWIZZLE_ONE] = SCS_ONE,
|
||||||
|
[VK_COMPONENT_SWIZZLE_R] = SCS_RED,
|
||||||
|
[VK_COMPONENT_SWIZZLE_G] = SCS_GREEN,
|
||||||
|
[VK_COMPONENT_SWIZZLE_B] = SCS_BLUE,
|
||||||
|
[VK_COMPONENT_SWIZZLE_A] = SCS_ALPHA
|
||||||
|
};
|
||||||
|
|
||||||
|
static uint32_t
|
||||||
|
vk_to_gen_swizzle(VkComponentSwizzle swizzle, VkComponentSwizzle component)
|
||||||
|
{
|
||||||
|
if (swizzle == VK_COMPONENT_SWIZZLE_IDENTITY)
|
||||||
|
return vk_to_gen_swizzle_map[component];
|
||||||
|
else
|
||||||
|
return vk_to_gen_swizzle_map[swizzle];
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
genX(image_view_init)(struct anv_image_view *iview,
|
genX(image_view_init)(struct anv_image_view *iview,
|
||||||
struct anv_device *device,
|
struct anv_device *device,
|
||||||
@@ -156,15 +174,6 @@ genX(image_view_init)(struct anv_image_view *iview,
|
|||||||
unreachable(!"bad VkImageType");
|
unreachable(!"bad VkImageType");
|
||||||
}
|
}
|
||||||
|
|
||||||
static const uint32_t vk_to_gen_swizzle[] = {
|
|
||||||
[VK_CHANNEL_SWIZZLE_ZERO] = SCS_ZERO,
|
|
||||||
[VK_CHANNEL_SWIZZLE_ONE] = SCS_ONE,
|
|
||||||
[VK_CHANNEL_SWIZZLE_R] = SCS_RED,
|
|
||||||
[VK_CHANNEL_SWIZZLE_G] = SCS_GREEN,
|
|
||||||
[VK_CHANNEL_SWIZZLE_B] = SCS_BLUE,
|
|
||||||
[VK_CHANNEL_SWIZZLE_A] = SCS_ALPHA
|
|
||||||
};
|
|
||||||
|
|
||||||
static const uint8_t isl_to_gen_tiling[] = {
|
static const uint8_t isl_to_gen_tiling[] = {
|
||||||
[ISL_TILING_LINEAR] = LINEAR,
|
[ISL_TILING_LINEAR] = LINEAR,
|
||||||
[ISL_TILING_X] = XMAJOR,
|
[ISL_TILING_X] = XMAJOR,
|
||||||
@@ -212,10 +221,14 @@ genX(image_view_init)(struct anv_image_view *iview,
|
|||||||
.GreenClearColor = 0,
|
.GreenClearColor = 0,
|
||||||
.BlueClearColor = 0,
|
.BlueClearColor = 0,
|
||||||
.AlphaClearColor = 0,
|
.AlphaClearColor = 0,
|
||||||
.ShaderChannelSelectRed = vk_to_gen_swizzle[pCreateInfo->channels.r],
|
.ShaderChannelSelectRed = vk_to_gen_swizzle(pCreateInfo->components.r,
|
||||||
.ShaderChannelSelectGreen = vk_to_gen_swizzle[pCreateInfo->channels.g],
|
VK_COMPONENT_SWIZZLE_R),
|
||||||
.ShaderChannelSelectBlue = vk_to_gen_swizzle[pCreateInfo->channels.b],
|
.ShaderChannelSelectGreen = vk_to_gen_swizzle(pCreateInfo->components.g,
|
||||||
.ShaderChannelSelectAlpha = vk_to_gen_swizzle[pCreateInfo->channels.a],
|
VK_COMPONENT_SWIZZLE_G),
|
||||||
|
.ShaderChannelSelectBlue = vk_to_gen_swizzle(pCreateInfo->components.b,
|
||||||
|
VK_COMPONENT_SWIZZLE_B),
|
||||||
|
.ShaderChannelSelectAlpha = vk_to_gen_swizzle(pCreateInfo->components.a,
|
||||||
|
VK_COMPONENT_SWIZZLE_A),
|
||||||
.ResourceMinLOD = 0.0,
|
.ResourceMinLOD = 0.0,
|
||||||
.SurfaceBaseAddress = { NULL, iview->offset },
|
.SurfaceBaseAddress = { NULL, iview->offset },
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user