summaryrefslogtreecommitdiffstats
path: root/src/vulkan/gen8_pipeline.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-12-31 12:00:58 -0800
committerJason Ekstrand <[email protected]>2015-12-31 12:02:08 -0800
commit5318424d4999b49cca84b11bc4d2eb70a7444fb8 (patch)
tree87cabec1b4a0ccc9abfa19d2ab919a5a25083065 /src/vulkan/gen8_pipeline.c
parentc6364495b24531cf2feb9fab356e16d028fd879e (diff)
anv/pipeline: Better vertex input channel setup
First off, it now uses isl formats instead of anv_format. Also, it properly handles integer vs. floating-point default channels and can properly handle alpha-only channels. (Not sure if those are allowed).
Diffstat (limited to 'src/vulkan/gen8_pipeline.c')
-rw-r--r--src/vulkan/gen8_pipeline.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/vulkan/gen8_pipeline.c b/src/vulkan/gen8_pipeline.c
index 5ecc8cfdf0e..ae8ab404746 100644
--- a/src/vulkan/gen8_pipeline.c
+++ b/src/vulkan/gen8_pipeline.c
@@ -69,7 +69,8 @@ emit_vertex_input(struct anv_pipeline *pipeline,
for (uint32_t i = 0; i < info->vertexAttributeDescriptionCount; i++) {
const VkVertexInputAttributeDescription *desc =
&info->pVertexAttributeDescriptions[i];
- const struct anv_format *format = anv_format_for_vk_format(desc->format);
+ enum isl_format format = anv_get_isl_format(desc->format,
+ VK_IMAGE_ASPECT_COLOR_BIT);
assert(desc->binding < 32);
@@ -81,13 +82,13 @@ emit_vertex_input(struct anv_pipeline *pipeline,
struct GENX(VERTEX_ELEMENT_STATE) element = {
.VertexBufferIndex = desc->binding,
.Valid = true,
- .SourceElementFormat = format->surface_format,
+ .SourceElementFormat = format,
.EdgeFlagEnable = false,
.SourceElementOffset = desc->offset,
- .Component0Control = VFCOMP_STORE_SRC,
- .Component1Control = format->num_channels >= 2 ? VFCOMP_STORE_SRC : VFCOMP_STORE_0,
- .Component2Control = format->num_channels >= 3 ? VFCOMP_STORE_SRC : VFCOMP_STORE_0,
- .Component3Control = format->num_channels >= 4 ? VFCOMP_STORE_SRC : VFCOMP_STORE_1_FP
+ .Component0Control = vertex_element_comp_control(format, 0),
+ .Component1Control = vertex_element_comp_control(format, 1),
+ .Component2Control = vertex_element_comp_control(format, 2),
+ .Component3Control = vertex_element_comp_control(format, 3),
};
GENX(VERTEX_ELEMENT_STATE_pack)(NULL, &p[1 + slot * 2], &element);