aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2016-11-16 11:12:30 -0700
committerMark Lobodzinski <mark@lunarg.com>2016-11-16 13:01:55 -0700
commite7324857faf0ec5c3abf555302b062e1c37553ec (patch)
tree4b4daf1746e3f0fa10414dbf978e9f215d59011a /layers/core_validation.cpp
parent8c8cd92b22ec2f608365cc3b47328906aa52a02b (diff)
downloadusermoji-e7324857faf0ec5c3abf555302b062e1c37553ec.tar.xz
layers: GH1143, Validate vertex attribute formats
Formats specified as vertex attributes (createGraphicsPipelines-> pCreateInfos->pVertexInputState->pVertexAttributeDescriptions.format) must have the VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT set. Change-Id: I907c37e2edbcfb7bcb405f912cea8d215acccb11
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 5e85df49..2a8f3820 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -6784,10 +6784,26 @@ void set_pipeline_state(PIPELINE_STATE *pPipe) {
static bool PreCallCreateGraphicsPipelines(layer_data *device_data, uint32_t count,
const VkGraphicsPipelineCreateInfo *create_infos, vector<PIPELINE_STATE *> &pipe_state) {
bool skip = false;
- layer_data *phy_dev_data = get_my_data_ptr(get_dispatch_key(device_data->instance_data), layer_data_map);
+ instance_layer_data *instance_data = get_my_data_ptr(get_dispatch_key(device_data->instance_data->instance), instance_layer_data_map);
for (uint32_t i = 0; i < count; i++) {
skip |= verifyPipelineCreateState(device_data, pipe_state, i);
+ if (create_infos[i].pVertexInputState != NULL) {
+ for (uint32_t j = 0; j < create_infos[i].pVertexInputState->vertexAttributeDescriptionCount; j++) {
+ VkFormat format = create_infos[i].pVertexInputState->pVertexAttributeDescriptions[j].format;
+ // Internal call to get format info. Still goes through layers, could potentially go directly to ICD.
+ VkFormatProperties properties;
+ instance_data->dispatch_table.GetPhysicalDeviceFormatProperties(device_data->physical_device, format, &properties);
+ if ((properties.bufferFeatures & VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT) == 0) {
+ skip |= log_msg(
+ device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
+ __LINE__, VALIDATION_ERROR_01413, "IMAGE",
+ "vkCreateGraphicsPipelines: pCreateInfo[%d].pVertexInputState->vertexAttributeDescriptions[%d].format "
+ "(%s) is not a supported vertex buffer format. %s",
+ i, j, string_VkFormat(format), validation_error_map[VALIDATION_ERROR_01413]);
+ }
+ }
+ }
}
return skip;
}