vk/0.210.0: Change field names in vertex input structs
This commit is contained in:
@@ -1598,7 +1598,7 @@ typedef struct VkPipelineShaderStageCreateInfo {
|
|||||||
|
|
||||||
typedef struct VkVertexInputBindingDescription {
|
typedef struct VkVertexInputBindingDescription {
|
||||||
uint32_t binding;
|
uint32_t binding;
|
||||||
uint32_t strideInBytes;
|
uint32_t stride;
|
||||||
VkVertexInputRate inputRate;
|
VkVertexInputRate inputRate;
|
||||||
} VkVertexInputBindingDescription;
|
} VkVertexInputBindingDescription;
|
||||||
|
|
||||||
@@ -1606,15 +1606,15 @@ typedef struct VkVertexInputAttributeDescription {
|
|||||||
uint32_t location;
|
uint32_t location;
|
||||||
uint32_t binding;
|
uint32_t binding;
|
||||||
VkFormat format;
|
VkFormat format;
|
||||||
uint32_t offsetInBytes;
|
uint32_t offset;
|
||||||
} VkVertexInputAttributeDescription;
|
} VkVertexInputAttributeDescription;
|
||||||
|
|
||||||
typedef struct VkPipelineVertexInputStateCreateInfo {
|
typedef struct VkPipelineVertexInputStateCreateInfo {
|
||||||
VkStructureType sType;
|
VkStructureType sType;
|
||||||
const void* pNext;
|
const void* pNext;
|
||||||
uint32_t bindingCount;
|
uint32_t vertexBindingDescriptionCount;
|
||||||
const VkVertexInputBindingDescription* pVertexBindingDescriptions;
|
const VkVertexInputBindingDescription* pVertexBindingDescriptions;
|
||||||
uint32_t attributeCount;
|
uint32_t vertexAttributeDescriptionCount;
|
||||||
const VkVertexInputAttributeDescription* pVertexAttributeDescriptions;
|
const VkVertexInputAttributeDescription* pVertexAttributeDescriptions;
|
||||||
} VkPipelineVertexInputStateCreateInfo;
|
} VkPipelineVertexInputStateCreateInfo;
|
||||||
|
|
||||||
|
@@ -264,41 +264,41 @@ anv_device_init_meta_blit_state(struct anv_device *device)
|
|||||||
|
|
||||||
VkPipelineVertexInputStateCreateInfo vi_create_info = {
|
VkPipelineVertexInputStateCreateInfo vi_create_info = {
|
||||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
||||||
.bindingCount = 2,
|
.vertexBindingDescriptionCount = 2,
|
||||||
.pVertexBindingDescriptions = (VkVertexInputBindingDescription[]) {
|
.pVertexBindingDescriptions = (VkVertexInputBindingDescription[]) {
|
||||||
{
|
{
|
||||||
.binding = 0,
|
.binding = 0,
|
||||||
.strideInBytes = 0,
|
.stride = 0,
|
||||||
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX
|
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.binding = 1,
|
.binding = 1,
|
||||||
.strideInBytes = 5 * sizeof(float),
|
.stride = 5 * sizeof(float),
|
||||||
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX
|
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
.attributeCount = 3,
|
.vertexAttributeDescriptionCount = 3,
|
||||||
.pVertexAttributeDescriptions = (VkVertexInputAttributeDescription[]) {
|
.pVertexAttributeDescriptions = (VkVertexInputAttributeDescription[]) {
|
||||||
{
|
{
|
||||||
/* VUE Header */
|
/* VUE Header */
|
||||||
.location = 0,
|
.location = 0,
|
||||||
.binding = 0,
|
.binding = 0,
|
||||||
.format = VK_FORMAT_R32G32B32A32_UINT,
|
.format = VK_FORMAT_R32G32B32A32_UINT,
|
||||||
.offsetInBytes = 0
|
.offset = 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* Position */
|
/* Position */
|
||||||
.location = 1,
|
.location = 1,
|
||||||
.binding = 1,
|
.binding = 1,
|
||||||
.format = VK_FORMAT_R32G32_SFLOAT,
|
.format = VK_FORMAT_R32G32_SFLOAT,
|
||||||
.offsetInBytes = 0
|
.offset = 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* Texture Coordinate */
|
/* Texture Coordinate */
|
||||||
.location = 2,
|
.location = 2,
|
||||||
.binding = 1,
|
.binding = 1,
|
||||||
.format = VK_FORMAT_R32G32B32_SFLOAT,
|
.format = VK_FORMAT_R32G32B32_SFLOAT,
|
||||||
.offsetInBytes = 8
|
.offset = 8
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -241,36 +241,36 @@ init_color_pipeline(struct anv_device *device)
|
|||||||
|
|
||||||
const VkPipelineVertexInputStateCreateInfo vi_state = {
|
const VkPipelineVertexInputStateCreateInfo vi_state = {
|
||||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
||||||
.bindingCount = 1,
|
.vertexBindingDescriptionCount = 1,
|
||||||
.pVertexBindingDescriptions = (VkVertexInputBindingDescription[]) {
|
.pVertexBindingDescriptions = (VkVertexInputBindingDescription[]) {
|
||||||
{
|
{
|
||||||
.binding = 0,
|
.binding = 0,
|
||||||
.strideInBytes = sizeof(struct color_clear_vattrs),
|
.stride = sizeof(struct color_clear_vattrs),
|
||||||
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX
|
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
.attributeCount = 3,
|
.vertexAttributeDescriptionCount = 3,
|
||||||
.pVertexAttributeDescriptions = (VkVertexInputAttributeDescription[]) {
|
.pVertexAttributeDescriptions = (VkVertexInputAttributeDescription[]) {
|
||||||
{
|
{
|
||||||
/* VUE Header */
|
/* VUE Header */
|
||||||
.location = 0,
|
.location = 0,
|
||||||
.binding = 0,
|
.binding = 0,
|
||||||
.format = VK_FORMAT_R32G32B32A32_UINT,
|
.format = VK_FORMAT_R32G32B32A32_UINT,
|
||||||
.offsetInBytes = offsetof(struct color_clear_vattrs, vue_header),
|
.offset = offsetof(struct color_clear_vattrs, vue_header),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* Position */
|
/* Position */
|
||||||
.location = 1,
|
.location = 1,
|
||||||
.binding = 0,
|
.binding = 0,
|
||||||
.format = VK_FORMAT_R32G32_SFLOAT,
|
.format = VK_FORMAT_R32G32_SFLOAT,
|
||||||
.offsetInBytes = offsetof(struct color_clear_vattrs, position),
|
.offset = offsetof(struct color_clear_vattrs, position),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* Color */
|
/* Color */
|
||||||
.location = 2,
|
.location = 2,
|
||||||
.binding = 0,
|
.binding = 0,
|
||||||
.format = VK_FORMAT_R32G32B32A32_SFLOAT,
|
.format = VK_FORMAT_R32G32B32A32_SFLOAT,
|
||||||
.offsetInBytes = offsetof(struct color_clear_vattrs, color),
|
.offset = offsetof(struct color_clear_vattrs, color),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -424,29 +424,29 @@ create_depthstencil_pipeline(struct anv_device *device,
|
|||||||
|
|
||||||
const VkPipelineVertexInputStateCreateInfo vi_state = {
|
const VkPipelineVertexInputStateCreateInfo vi_state = {
|
||||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
||||||
.bindingCount = 1,
|
.vertexBindingDescriptionCount = 1,
|
||||||
.pVertexBindingDescriptions = (VkVertexInputBindingDescription[]) {
|
.pVertexBindingDescriptions = (VkVertexInputBindingDescription[]) {
|
||||||
{
|
{
|
||||||
.binding = 0,
|
.binding = 0,
|
||||||
.strideInBytes = sizeof(struct depthstencil_clear_vattrs),
|
.stride = sizeof(struct depthstencil_clear_vattrs),
|
||||||
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX
|
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
.attributeCount = 2,
|
.vertexAttributeDescriptionCount = 2,
|
||||||
.pVertexAttributeDescriptions = (VkVertexInputAttributeDescription[]) {
|
.pVertexAttributeDescriptions = (VkVertexInputAttributeDescription[]) {
|
||||||
{
|
{
|
||||||
/* VUE Header */
|
/* VUE Header */
|
||||||
.location = 0,
|
.location = 0,
|
||||||
.binding = 0,
|
.binding = 0,
|
||||||
.format = VK_FORMAT_R32G32B32A32_UINT,
|
.format = VK_FORMAT_R32G32B32A32_UINT,
|
||||||
.offsetInBytes = offsetof(struct depthstencil_clear_vattrs, vue_header),
|
.offset = offsetof(struct depthstencil_clear_vattrs, vue_header),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/* Position */
|
/* Position */
|
||||||
.location = 1,
|
.location = 1,
|
||||||
.binding = 0,
|
.binding = 0,
|
||||||
.format = VK_FORMAT_R32G32_SFLOAT,
|
.format = VK_FORMAT_R32G32_SFLOAT,
|
||||||
.offsetInBytes = offsetof(struct depthstencil_clear_vattrs, position),
|
.offset = offsetof(struct depthstencil_clear_vattrs, position),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@@ -1034,12 +1034,12 @@ anv_pipeline_init(struct anv_pipeline *pipeline, struct anv_device *device,
|
|||||||
const VkPipelineVertexInputStateCreateInfo *vi_info =
|
const VkPipelineVertexInputStateCreateInfo *vi_info =
|
||||||
pCreateInfo->pVertexInputState;
|
pCreateInfo->pVertexInputState;
|
||||||
pipeline->vb_used = 0;
|
pipeline->vb_used = 0;
|
||||||
for (uint32_t i = 0; i < vi_info->bindingCount; i++) {
|
for (uint32_t i = 0; i < vi_info->vertexBindingDescriptionCount; i++) {
|
||||||
const VkVertexInputBindingDescription *desc =
|
const VkVertexInputBindingDescription *desc =
|
||||||
&vi_info->pVertexBindingDescriptions[i];
|
&vi_info->pVertexBindingDescriptions[i];
|
||||||
|
|
||||||
pipeline->vb_used |= 1 << desc->binding;
|
pipeline->vb_used |= 1 << desc->binding;
|
||||||
pipeline->binding_stride[desc->binding] = desc->strideInBytes;
|
pipeline->binding_stride[desc->binding] = desc->stride;
|
||||||
|
|
||||||
/* Step rate is programmed per vertex element (attribute), not
|
/* Step rate is programmed per vertex element (attribute), not
|
||||||
* binding. Set up a map of which bindings step per instance, for
|
* binding. Set up a map of which bindings step per instance, for
|
||||||
|
@@ -38,17 +38,18 @@ gen7_emit_vertex_input(struct anv_pipeline *pipeline,
|
|||||||
{
|
{
|
||||||
const bool sgvs = pipeline->vs_prog_data.uses_vertexid ||
|
const bool sgvs = pipeline->vs_prog_data.uses_vertexid ||
|
||||||
pipeline->vs_prog_data.uses_instanceid;
|
pipeline->vs_prog_data.uses_instanceid;
|
||||||
const uint32_t element_count = info->attributeCount + (sgvs ? 1 : 0);
|
const uint32_t element_count =
|
||||||
|
info->vertexAttributeDescriptionCount + (sgvs ? 1 : 0);
|
||||||
const uint32_t num_dwords = 1 + element_count * 2;
|
const uint32_t num_dwords = 1 + element_count * 2;
|
||||||
uint32_t *p;
|
uint32_t *p;
|
||||||
|
|
||||||
if (info->attributeCount == 0 && !sgvs)
|
if (info->vertexAttributeDescriptionCount == 0 && !sgvs)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p = anv_batch_emitn(&pipeline->batch, num_dwords,
|
p = anv_batch_emitn(&pipeline->batch, num_dwords,
|
||||||
GEN7_3DSTATE_VERTEX_ELEMENTS);
|
GEN7_3DSTATE_VERTEX_ELEMENTS);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < info->attributeCount; i++) {
|
for (uint32_t i = 0; i < info->vertexAttributeDescriptionCount; i++) {
|
||||||
const VkVertexInputAttributeDescription *desc =
|
const VkVertexInputAttributeDescription *desc =
|
||||||
&info->pVertexAttributeDescriptions[i];
|
&info->pVertexAttributeDescriptions[i];
|
||||||
const struct anv_format *format = anv_format_for_vk_format(desc->format);
|
const struct anv_format *format = anv_format_for_vk_format(desc->format);
|
||||||
@@ -58,7 +59,7 @@ gen7_emit_vertex_input(struct anv_pipeline *pipeline,
|
|||||||
.Valid = true,
|
.Valid = true,
|
||||||
.SourceElementFormat = format->surface_format,
|
.SourceElementFormat = format->surface_format,
|
||||||
.EdgeFlagEnable = false,
|
.EdgeFlagEnable = false,
|
||||||
.SourceElementOffset = desc->offsetInBytes,
|
.SourceElementOffset = desc->offset,
|
||||||
.Component0Control = VFCOMP_STORE_SRC,
|
.Component0Control = VFCOMP_STORE_SRC,
|
||||||
.Component1Control = format->num_channels >= 2 ? VFCOMP_STORE_SRC : VFCOMP_STORE_0,
|
.Component1Control = format->num_channels >= 2 ? VFCOMP_STORE_SRC : VFCOMP_STORE_0,
|
||||||
.Component2Control = format->num_channels >= 3 ? VFCOMP_STORE_SRC : VFCOMP_STORE_0,
|
.Component2Control = format->num_channels >= 3 ? VFCOMP_STORE_SRC : VFCOMP_STORE_0,
|
||||||
@@ -77,7 +78,7 @@ gen7_emit_vertex_input(struct anv_pipeline *pipeline,
|
|||||||
.Component2Control = VFCOMP_STORE_VID,
|
.Component2Control = VFCOMP_STORE_VID,
|
||||||
.Component3Control = VFCOMP_STORE_IID
|
.Component3Control = VFCOMP_STORE_IID
|
||||||
};
|
};
|
||||||
GEN7_VERTEX_ELEMENT_STATE_pack(NULL, &p[1 + info->attributeCount * 2], &element);
|
GEN7_VERTEX_ELEMENT_STATE_pack(NULL, &p[1 + info->vertexAttributeDescriptionCount * 2], &element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -36,17 +36,17 @@ static void
|
|||||||
emit_vertex_input(struct anv_pipeline *pipeline,
|
emit_vertex_input(struct anv_pipeline *pipeline,
|
||||||
const VkPipelineVertexInputStateCreateInfo *info)
|
const VkPipelineVertexInputStateCreateInfo *info)
|
||||||
{
|
{
|
||||||
const uint32_t num_dwords = 1 + info->attributeCount * 2;
|
const uint32_t num_dwords = 1 + info->vertexAttributeDescriptionCount * 2;
|
||||||
uint32_t *p;
|
uint32_t *p;
|
||||||
|
|
||||||
static_assert(ANV_GEN >= 8, "should be compiling this for gen < 8");
|
static_assert(ANV_GEN >= 8, "should be compiling this for gen < 8");
|
||||||
|
|
||||||
if (info->attributeCount > 0) {
|
if (info->vertexAttributeDescriptionCount > 0) {
|
||||||
p = anv_batch_emitn(&pipeline->batch, num_dwords,
|
p = anv_batch_emitn(&pipeline->batch, num_dwords,
|
||||||
GENX(3DSTATE_VERTEX_ELEMENTS));
|
GENX(3DSTATE_VERTEX_ELEMENTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint32_t i = 0; i < info->attributeCount; i++) {
|
for (uint32_t i = 0; i < info->vertexAttributeDescriptionCount; i++) {
|
||||||
const VkVertexInputAttributeDescription *desc =
|
const VkVertexInputAttributeDescription *desc =
|
||||||
&info->pVertexAttributeDescriptions[i];
|
&info->pVertexAttributeDescriptions[i];
|
||||||
const struct anv_format *format = anv_format_for_vk_format(desc->format);
|
const struct anv_format *format = anv_format_for_vk_format(desc->format);
|
||||||
@@ -56,7 +56,7 @@ emit_vertex_input(struct anv_pipeline *pipeline,
|
|||||||
.Valid = true,
|
.Valid = true,
|
||||||
.SourceElementFormat = format->surface_format,
|
.SourceElementFormat = format->surface_format,
|
||||||
.EdgeFlagEnable = false,
|
.EdgeFlagEnable = false,
|
||||||
.SourceElementOffset = desc->offsetInBytes,
|
.SourceElementOffset = desc->offset,
|
||||||
.Component0Control = VFCOMP_STORE_SRC,
|
.Component0Control = VFCOMP_STORE_SRC,
|
||||||
.Component1Control = format->num_channels >= 2 ? VFCOMP_STORE_SRC : VFCOMP_STORE_0,
|
.Component1Control = format->num_channels >= 2 ? VFCOMP_STORE_SRC : VFCOMP_STORE_0,
|
||||||
.Component2Control = format->num_channels >= 3 ? VFCOMP_STORE_SRC : VFCOMP_STORE_0,
|
.Component2Control = format->num_channels >= 3 ? VFCOMP_STORE_SRC : VFCOMP_STORE_0,
|
||||||
@@ -75,10 +75,10 @@ emit_vertex_input(struct anv_pipeline *pipeline,
|
|||||||
anv_batch_emit(&pipeline->batch, GENX(3DSTATE_VF_SGVS),
|
anv_batch_emit(&pipeline->batch, GENX(3DSTATE_VF_SGVS),
|
||||||
.VertexIDEnable = pipeline->vs_prog_data.uses_vertexid,
|
.VertexIDEnable = pipeline->vs_prog_data.uses_vertexid,
|
||||||
.VertexIDComponentNumber = 2,
|
.VertexIDComponentNumber = 2,
|
||||||
.VertexIDElementOffset = info->bindingCount,
|
.VertexIDElementOffset = info->vertexBindingDescriptionCount,
|
||||||
.InstanceIDEnable = pipeline->vs_prog_data.uses_instanceid,
|
.InstanceIDEnable = pipeline->vs_prog_data.uses_instanceid,
|
||||||
.InstanceIDComponentNumber = 3,
|
.InstanceIDComponentNumber = 3,
|
||||||
.InstanceIDElementOffset = info->bindingCount);
|
.InstanceIDElementOffset = info->vertexBindingDescriptionCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -355,7 +355,7 @@ genX(graphics_pipeline_create)(
|
|||||||
* inputs. */
|
* inputs. */
|
||||||
if (pipeline->vs_simd8 == NO_KERNEL) {
|
if (pipeline->vs_simd8 == NO_KERNEL) {
|
||||||
pipeline->wm_prog_data.num_varying_inputs =
|
pipeline->wm_prog_data.num_varying_inputs =
|
||||||
pCreateInfo->pVertexInputState->attributeCount - 2;
|
pCreateInfo->pVertexInputState->vertexAttributeDescriptionCount - 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(pCreateInfo->pVertexInputState);
|
assert(pCreateInfo->pVertexInputState);
|
||||||
|
Reference in New Issue
Block a user