From c353f05d730d64a43aaa227a5c995be2bb360e9d Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Mon, 4 May 2015 14:04:24 +1200 Subject: shader_checker: add type checking between VF and VS --- layers/shader_checker.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'layers') diff --git a/layers/shader_checker.cpp b/layers/shader_checker.cpp index bb3b9225..a24eb957 100644 --- a/layers/shader_checker.cpp +++ b/layers/shader_checker.cpp @@ -33,6 +33,7 @@ #include "vkLayer.h" #include "layers_config.h" #include "layers_msg.h" +#include "vk_enum_string_helper.h" #include "shader_checker.h" // The following is #included again to catch certain OS-specific functions // being used: @@ -652,7 +653,18 @@ validate_vi_against_vs_inputs(VkPipelineVertexInputCreateInfo const *vi, shader_ it_b++; } else { - /* TODO: type check */ + unsigned attrib_type = get_format_type(it_a->second->format); + unsigned input_type = get_fundamental_type(vs, it_b->second.type_id); + + /* type checking */ + if (attrib_type != FORMAT_TYPE_UNDEFINED && input_type != FORMAT_TYPE_UNDEFINED && attrib_type != input_type) { + char vs_type[1024]; + describe_type(vs_type, vs, it_b->second.type_id); + sprintf(str, "Attribute type of `%s` at location %d does not match VS input type of `%s`", + string_VkFormat(it_a->second->format), a_first, vs_type); + layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, SHADER_CHECKER_INTERFACE_TYPE_MISMATCH, "SC", str); + } + /* OK! */ it_a++; it_b++; -- cgit v1.2.3