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 {
|
||||
uint32_t binding;
|
||||
uint32_t strideInBytes;
|
||||
uint32_t stride;
|
||||
VkVertexInputRate inputRate;
|
||||
} VkVertexInputBindingDescription;
|
||||
|
||||
@@ -1606,15 +1606,15 @@ typedef struct VkVertexInputAttributeDescription {
|
||||
uint32_t location;
|
||||
uint32_t binding;
|
||||
VkFormat format;
|
||||
uint32_t offsetInBytes;
|
||||
uint32_t offset;
|
||||
} VkVertexInputAttributeDescription;
|
||||
|
||||
typedef struct VkPipelineVertexInputStateCreateInfo {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t bindingCount;
|
||||
uint32_t vertexBindingDescriptionCount;
|
||||
const VkVertexInputBindingDescription* pVertexBindingDescriptions;
|
||||
uint32_t attributeCount;
|
||||
uint32_t vertexAttributeDescriptionCount;
|
||||
const VkVertexInputAttributeDescription* pVertexAttributeDescriptions;
|
||||
} VkPipelineVertexInputStateCreateInfo;
|
||||
|
||||
|
@@ -264,41 +264,41 @@ anv_device_init_meta_blit_state(struct anv_device *device)
|
||||
|
||||
VkPipelineVertexInputStateCreateInfo vi_create_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
||||
.bindingCount = 2,
|
||||
.vertexBindingDescriptionCount = 2,
|
||||
.pVertexBindingDescriptions = (VkVertexInputBindingDescription[]) {
|
||||
{
|
||||
.binding = 0,
|
||||
.strideInBytes = 0,
|
||||
.stride = 0,
|
||||
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX
|
||||
},
|
||||
{
|
||||
.binding = 1,
|
||||
.strideInBytes = 5 * sizeof(float),
|
||||
.stride = 5 * sizeof(float),
|
||||
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX
|
||||
},
|
||||
},
|
||||
.attributeCount = 3,
|
||||
.vertexAttributeDescriptionCount = 3,
|
||||
.pVertexAttributeDescriptions = (VkVertexInputAttributeDescription[]) {
|
||||
{
|
||||
/* VUE Header */
|
||||
.location = 0,
|
||||
.binding = 0,
|
||||
.format = VK_FORMAT_R32G32B32A32_UINT,
|
||||
.offsetInBytes = 0
|
||||
.offset = 0
|
||||
},
|
||||
{
|
||||
/* Position */
|
||||
.location = 1,
|
||||
.binding = 1,
|
||||
.format = VK_FORMAT_R32G32_SFLOAT,
|
||||
.offsetInBytes = 0
|
||||
.offset = 0
|
||||
},
|
||||
{
|
||||
/* Texture Coordinate */
|
||||
.location = 2,
|
||||
.binding = 1,
|
||||
.format = VK_FORMAT_R32G32B32_SFLOAT,
|
||||
.offsetInBytes = 8
|
||||
.offset = 8
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -241,36 +241,36 @@ init_color_pipeline(struct anv_device *device)
|
||||
|
||||
const VkPipelineVertexInputStateCreateInfo vi_state = {
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
||||
.bindingCount = 1,
|
||||
.vertexBindingDescriptionCount = 1,
|
||||
.pVertexBindingDescriptions = (VkVertexInputBindingDescription[]) {
|
||||
{
|
||||
.binding = 0,
|
||||
.strideInBytes = sizeof(struct color_clear_vattrs),
|
||||
.stride = sizeof(struct color_clear_vattrs),
|
||||
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX
|
||||
},
|
||||
},
|
||||
.attributeCount = 3,
|
||||
.vertexAttributeDescriptionCount = 3,
|
||||
.pVertexAttributeDescriptions = (VkVertexInputAttributeDescription[]) {
|
||||
{
|
||||
/* VUE Header */
|
||||
.location = 0,
|
||||
.binding = 0,
|
||||
.format = VK_FORMAT_R32G32B32A32_UINT,
|
||||
.offsetInBytes = offsetof(struct color_clear_vattrs, vue_header),
|
||||
.offset = offsetof(struct color_clear_vattrs, vue_header),
|
||||
},
|
||||
{
|
||||
/* Position */
|
||||
.location = 1,
|
||||
.binding = 0,
|
||||
.format = VK_FORMAT_R32G32_SFLOAT,
|
||||
.offsetInBytes = offsetof(struct color_clear_vattrs, position),
|
||||
.offset = offsetof(struct color_clear_vattrs, position),
|
||||
},
|
||||
{
|
||||
/* Color */
|
||||
.location = 2,
|
||||
.binding = 0,
|
||||
.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 = {
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
|
||||
.bindingCount = 1,
|
||||
.vertexBindingDescriptionCount = 1,
|
||||
.pVertexBindingDescriptions = (VkVertexInputBindingDescription[]) {
|
||||
{
|
||||
.binding = 0,
|
||||
.strideInBytes = sizeof(struct depthstencil_clear_vattrs),
|
||||
.stride = sizeof(struct depthstencil_clear_vattrs),
|
||||
.inputRate = VK_VERTEX_INPUT_RATE_VERTEX
|
||||
},
|
||||
},
|
||||
.attributeCount = 2,
|
||||
.vertexAttributeDescriptionCount = 2,
|
||||
.pVertexAttributeDescriptions = (VkVertexInputAttributeDescription[]) {
|
||||
{
|
||||
/* VUE Header */
|
||||
.location = 0,
|
||||
.binding = 0,
|
||||
.format = VK_FORMAT_R32G32B32A32_UINT,
|
||||
.offsetInBytes = offsetof(struct depthstencil_clear_vattrs, vue_header),
|
||||
.offset = offsetof(struct depthstencil_clear_vattrs, vue_header),
|
||||
},
|
||||
{
|
||||
/* Position */
|
||||
.location = 1,
|
||||
.binding = 0,
|
||||
.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 =
|
||||
pCreateInfo->pVertexInputState;
|
||||
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 =
|
||||
&vi_info->pVertexBindingDescriptions[i];
|
||||
|
||||
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
|
||||
* 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 ||
|
||||
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;
|
||||
uint32_t *p;
|
||||
|
||||
if (info->attributeCount == 0 && !sgvs)
|
||||
if (info->vertexAttributeDescriptionCount == 0 && !sgvs)
|
||||
return;
|
||||
|
||||
p = anv_batch_emitn(&pipeline->batch, num_dwords,
|
||||
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 =
|
||||
&info->pVertexAttributeDescriptions[i];
|
||||
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,
|
||||
.SourceElementFormat = format->surface_format,
|
||||
.EdgeFlagEnable = false,
|
||||
.SourceElementOffset = desc->offsetInBytes,
|
||||
.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,
|
||||
@@ -77,7 +78,7 @@ gen7_emit_vertex_input(struct anv_pipeline *pipeline,
|
||||
.Component2Control = VFCOMP_STORE_VID,
|
||||
.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,
|
||||
const VkPipelineVertexInputStateCreateInfo *info)
|
||||
{
|
||||
const uint32_t num_dwords = 1 + info->attributeCount * 2;
|
||||
const uint32_t num_dwords = 1 + info->vertexAttributeDescriptionCount * 2;
|
||||
uint32_t *p;
|
||||
|
||||
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,
|
||||
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 =
|
||||
&info->pVertexAttributeDescriptions[i];
|
||||
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,
|
||||
.SourceElementFormat = format->surface_format,
|
||||
.EdgeFlagEnable = false,
|
||||
.SourceElementOffset = desc->offsetInBytes,
|
||||
.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,
|
||||
@@ -75,10 +75,10 @@ emit_vertex_input(struct anv_pipeline *pipeline,
|
||||
anv_batch_emit(&pipeline->batch, GENX(3DSTATE_VF_SGVS),
|
||||
.VertexIDEnable = pipeline->vs_prog_data.uses_vertexid,
|
||||
.VertexIDComponentNumber = 2,
|
||||
.VertexIDElementOffset = info->bindingCount,
|
||||
.VertexIDElementOffset = info->vertexBindingDescriptionCount,
|
||||
.InstanceIDEnable = pipeline->vs_prog_data.uses_instanceid,
|
||||
.InstanceIDComponentNumber = 3,
|
||||
.InstanceIDElementOffset = info->bindingCount);
|
||||
.InstanceIDElementOffset = info->vertexBindingDescriptionCount);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -355,7 +355,7 @@ genX(graphics_pipeline_create)(
|
||||
* inputs. */
|
||||
if (pipeline->vs_simd8 == NO_KERNEL) {
|
||||
pipeline->wm_prog_data.num_varying_inputs =
|
||||
pCreateInfo->pVertexInputState->attributeCount - 2;
|
||||
pCreateInfo->pVertexInputState->vertexAttributeDescriptionCount - 2;
|
||||
}
|
||||
|
||||
assert(pCreateInfo->pVertexInputState);
|
||||
|
Reference in New Issue
Block a user