aboutsummaryrefslogtreecommitdiff
path: root/layers/shader_validation.cpp
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2018-04-01 10:38:15 -0600
committerMark Lobodzinski <mark@lunarg.com>2018-04-02 14:18:39 -0600
commit651b7cd0e960ce11ae403c81f370205e84548682 (patch)
tree550f12dd34ee14d80bf3c6c00aa15b8cc0c0ebf1 /layers/shader_validation.cpp
parent15c1d014cad11a0099be582ea81ec79a3179b860 (diff)
downloadusermoji-651b7cd0e960ce11ae403c81f370205e84548682.tar.xz
layers: Remove layer prefix from log_msg calls
Change-Id: Iea43bd2f8f2c92d99b5fdf40abe94149a6fb860c
Diffstat (limited to 'layers/shader_validation.cpp')
-rw-r--r--layers/shader_validation.cpp64
1 files changed, 31 insertions, 33 deletions
diff --git a/layers/shader_validation.cpp b/layers/shader_validation.cpp
index e028aa88..368c3d28 100644
--- a/layers/shader_validation.cpp
+++ b/layers/shader_validation.cpp
@@ -741,7 +741,7 @@ static bool validate_vi_consistency(debug_report_data const *report_data, VkPipe
if (binding) {
// TODO: VALIDATION_ERROR_096005cc perhaps?
skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
- SHADER_CHECKER_INCONSISTENT_VI, "SC", "Duplicate vertex input binding descriptions for binding %d",
+ SHADER_CHECKER_INCONSISTENT_VI, "Duplicate vertex input binding descriptions for binding %d",
desc->binding);
} else {
binding = desc;
@@ -779,16 +779,16 @@ static bool validate_vi_against_vs_inputs(debug_report_data const *report_data,
auto b_first = b_at_end ? 0 : it_b->first.first;
if (!a_at_end && (b_at_end || a_first < b_first)) {
if (!used && log_msg(report_data, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT,
- 0, SHADER_CHECKER_OUTPUT_NOT_CONSUMED, "SC",
+ 0, SHADER_CHECKER_OUTPUT_NOT_CONSUMED,
"Vertex attribute at location %d not consumed by vertex shader", a_first)) {
skip = true;
}
used = false;
it_a++;
} else if (!b_at_end && (a_at_end || b_first < a_first)) {
- skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, 0,
- SHADER_CHECKER_INPUT_NOT_PRODUCED, "SC", "Vertex shader consumes input at location %d but not provided",
- b_first);
+ skip |=
+ log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, 0,
+ SHADER_CHECKER_INPUT_NOT_PRODUCED, "Vertex shader consumes input at location %d but not provided", b_first);
it_b++;
} else {
unsigned attrib_type = get_format_type(it_a->second->format);
@@ -797,7 +797,7 @@ static bool validate_vi_against_vs_inputs(debug_report_data const *report_data,
// Type checking
if (!(attrib_type & input_type)) {
skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
- SHADER_CHECKER_INTERFACE_TYPE_MISMATCH, "SC",
+ SHADER_CHECKER_INTERFACE_TYPE_MISMATCH,
"Attribute type of `%s` at location %d does not match vertex shader input type of `%s`",
string_VkFormat(it_a->second->format), a_first, describe_type(vs, it_b->second.type_id).c_str());
}
@@ -843,16 +843,15 @@ static bool validate_fs_outputs_against_render_pass(debug_report_data const *rep
if (!a_at_end && (b_at_end || it_a->first.first < it_b->first)) {
skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
- SHADER_CHECKER_OUTPUT_NOT_CONSUMED, "SC",
+ SHADER_CHECKER_OUTPUT_NOT_CONSUMED,
"fragment shader writes to output location %d with no matching attachment", it_a->first.first);
it_a++;
} else if (!b_at_end && (a_at_end || it_a->first.first > it_b->first)) {
// Only complain if there are unmasked channels for this attachment. If the writemask is 0, it's acceptable for the
// shader to not produce a matching output.
if (pipeline->attachments[it_b->first].colorWriteMask != 0) {
- skip |=
- log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
- SHADER_CHECKER_INPUT_NOT_PRODUCED, "SC", "Attachment %d not written by fragment shader", it_b->first);
+ skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
+ SHADER_CHECKER_INPUT_NOT_PRODUCED, "Attachment %d not written by fragment shader", it_b->first);
}
it_b++;
} else {
@@ -862,7 +861,7 @@ static bool validate_fs_outputs_against_render_pass(debug_report_data const *rep
// Type checking
if (!(output_type & att_type)) {
skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
- SHADER_CHECKER_INTERFACE_TYPE_MISMATCH, "SC",
+ SHADER_CHECKER_INTERFACE_TYPE_MISMATCH,
"Attachment %d of type `%s` does not match fragment shader output type of `%s`", it_b->first,
string_VkFormat(it_b->second), describe_type(fs, it_a->second.type_id).c_str());
}
@@ -1020,7 +1019,7 @@ static bool validate_push_constant_block_against_pipeline(debug_report_data cons
if ((range.stageFlags & stage) == 0) {
skip |=
log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
- SHADER_CHECKER_PUSH_CONSTANT_NOT_ACCESSIBLE_FROM_STAGE, "SC",
+ SHADER_CHECKER_PUSH_CONSTANT_NOT_ACCESSIBLE_FROM_STAGE,
"Push constant range covering variable starting at offset %u not accessible from stage %s",
offset, string_VkShaderStageFlagBits(stage));
}
@@ -1031,7 +1030,7 @@ static bool validate_push_constant_block_against_pipeline(debug_report_data cons
if (!found_range) {
skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
- SHADER_CHECKER_PUSH_CONSTANT_OUT_OF_RANGE, "SC",
+ SHADER_CHECKER_PUSH_CONSTANT_OUT_OF_RANGE,
"Push constant range covering variable starting at offset %u not declared in layout", offset);
}
}
@@ -1068,7 +1067,7 @@ static bool validate_specialization_offsets(debug_report_data const *report_data
// TODO: This is a good place for VALIDATION_ERROR_1360060a.
if (spec->pMapEntries[i].offset + spec->pMapEntries[i].size > spec->dataSize) {
skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, 0,
- VALIDATION_ERROR_1360060c, "SC",
+ VALIDATION_ERROR_1360060c,
"Specialization entry %u (for constant id %u) references memory outside provided specialization "
"data (bytes %u.." PRINTF_SIZE_T_SPECIFIER "; " PRINTF_SIZE_T_SPECIFIER " bytes provided)..",
i, spec->pMapEntries[i].constantID, spec->pMapEntries[i].offset,
@@ -1167,7 +1166,7 @@ static bool descriptor_type_match(shader_module const *module, uint32_t type_id,
static bool require_feature(debug_report_data const *report_data, VkBool32 feature, char const *feature_name) {
if (!feature) {
if (log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
- SHADER_CHECKER_FEATURE_NOT_ENABLED, "SC",
+ SHADER_CHECKER_FEATURE_NOT_ENABLED,
"Shader requires VkPhysicalDeviceFeatures::%s but is not enabled on the device", feature_name)) {
return true;
}
@@ -1179,7 +1178,7 @@ static bool require_feature(debug_report_data const *report_data, VkBool32 featu
static bool require_extension(debug_report_data const *report_data, bool extension, char const *extension_name) {
if (!extension) {
if (log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
- SHADER_CHECKER_FEATURE_NOT_ENABLED, "SC", "Shader requires extension %s but is not enabled on the device",
+ SHADER_CHECKER_FEATURE_NOT_ENABLED, "Shader requires extension %s but is not enabled on the device",
extension_name)) {
return true;
}
@@ -1418,7 +1417,7 @@ static bool validate_pipeline_shader_stage(layer_data *dev_data, VkPipelineShade
auto entrypoint = *out_entrypoint = find_entrypoint(module, pStage->pName, pStage->stage);
if (entrypoint == module->end()) {
if (log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
- VALIDATION_ERROR_10600586, "SC", "No entrypoint found named `%s` for stage %s..", pStage->pName,
+ VALIDATION_ERROR_10600586, "No entrypoint found named `%s` for stage %s..", pStage->pName,
string_VkShaderStageFlagBits(pStage->stage))) {
return true; // no point continuing beyond here, any analysis is just going to be garbage.
}
@@ -1451,24 +1450,24 @@ static bool validate_pipeline_shader_stage(layer_data *dev_data, VkPipelineShade
if (!binding) {
skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
- SHADER_CHECKER_MISSING_DESCRIPTOR, "SC",
+ SHADER_CHECKER_MISSING_DESCRIPTOR,
"Shader uses descriptor slot %u.%u (used as type `%s`) but not declared in pipeline layout",
use.first.first, use.first.second, describe_type(module, use.second.type_id).c_str());
} else if (~binding->stageFlags & pStage->stage) {
skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, 0,
- SHADER_CHECKER_DESCRIPTOR_NOT_ACCESSIBLE_FROM_STAGE, "SC",
+ SHADER_CHECKER_DESCRIPTOR_NOT_ACCESSIBLE_FROM_STAGE,
"Shader uses descriptor slot %u.%u (used as type `%s`) but descriptor not accessible from stage %s",
use.first.first, use.first.second, describe_type(module, use.second.type_id).c_str(),
string_VkShaderStageFlagBits(pStage->stage));
} else if (!descriptor_type_match(module, use.second.type_id, binding->descriptorType, required_descriptor_count)) {
skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
- SHADER_CHECKER_DESCRIPTOR_TYPE_MISMATCH, "SC",
+ SHADER_CHECKER_DESCRIPTOR_TYPE_MISMATCH,
"Type mismatch on descriptor slot %u.%u (used as type `%s`) but descriptor of type %s", use.first.first,
use.first.second, describe_type(module, use.second.type_id).c_str(),
string_VkDescriptorType(binding->descriptorType));
} else if (binding->descriptorCount < required_descriptor_count) {
skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
- SHADER_CHECKER_DESCRIPTOR_TYPE_MISMATCH, "SC",
+ SHADER_CHECKER_DESCRIPTOR_TYPE_MISMATCH,
"Shader expects at least %u descriptors for binding %u.%u (used as type `%s`) but only %u provided",
required_descriptor_count, use.first.first, use.first.second,
describe_type(module, use.second.type_id).c_str(), binding->descriptorCount);
@@ -1490,12 +1489,12 @@ static bool validate_pipeline_shader_stage(layer_data *dev_data, VkPipelineShade
if (index == VK_ATTACHMENT_UNUSED) {
skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
- SHADER_CHECKER_MISSING_INPUT_ATTACHMENT, "SC",
+ SHADER_CHECKER_MISSING_INPUT_ATTACHMENT,
"Shader consumes input attachment index %d but not provided in subpass", use.first);
} else if (!(get_format_type(rpci->pAttachments[index].format) & get_fundamental_type(module, use.second.type_id))) {
skip |=
log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
- SHADER_CHECKER_INPUT_ATTACHMENT_TYPE_MISMATCH, "SC",
+ SHADER_CHECKER_INPUT_ATTACHMENT_TYPE_MISMATCH,
"Subpass input attachment %u format of %s does not match type used in shader `%s`", use.first,
string_VkFormat(rpci->pAttachments[index].format), describe_type(module, use.second.type_id).c_str());
}
@@ -1527,14 +1526,13 @@ static bool validate_interface_between_stages(debug_report_data const *report_da
auto b_first = b_at_end ? std::make_pair(0u, 0u) : b_it->first;
if (b_at_end || ((!a_at_end) && (a_first < b_first))) {
- skip |=
- log_msg(report_data, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
- SHADER_CHECKER_OUTPUT_NOT_CONSUMED, "SC", "%s writes to output location %u.%u which is not consumed by %s",
- producer_stage->name, a_first.first, a_first.second, consumer_stage->name);
+ skip |= log_msg(report_data, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
+ SHADER_CHECKER_OUTPUT_NOT_CONSUMED, "%s writes to output location %u.%u which is not consumed by %s",
+ producer_stage->name, a_first.first, a_first.second, consumer_stage->name);
a_it++;
} else if (a_at_end || a_first > b_first) {
skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
- SHADER_CHECKER_INPUT_NOT_PRODUCED, "SC", "%s consumes input location %u.%u which is not written by %s",
+ SHADER_CHECKER_INPUT_NOT_PRODUCED, "%s consumes input location %u.%u which is not written by %s",
consumer_stage->name, b_first.first, b_first.second, producer_stage->name);
b_it++;
} else {
@@ -1546,20 +1544,20 @@ static bool validate_interface_between_stages(debug_report_data const *report_da
producer_stage->arrayed_output && !a_it->second.is_patch && !a_it->second.is_block_member,
consumer_stage->arrayed_input && !b_it->second.is_patch && !b_it->second.is_block_member, true)) {
skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
- SHADER_CHECKER_INTERFACE_TYPE_MISMATCH, "SC", "Type mismatch on location %u.%u: '%s' vs '%s'",
+ SHADER_CHECKER_INTERFACE_TYPE_MISMATCH, "Type mismatch on location %u.%u: '%s' vs '%s'",
a_first.first, a_first.second, describe_type(producer, a_it->second.type_id).c_str(),
describe_type(consumer, b_it->second.type_id).c_str());
}
if (a_it->second.is_patch != b_it->second.is_patch) {
skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, 0,
- SHADER_CHECKER_INTERFACE_TYPE_MISMATCH, "SC",
+ SHADER_CHECKER_INTERFACE_TYPE_MISMATCH,
"Decoration mismatch on location %u.%u: is per-%s in %s stage but per-%s in %s stage",
a_first.first, a_first.second, a_it->second.is_patch ? "patch" : "vertex", producer_stage->name,
b_it->second.is_patch ? "patch" : "vertex", consumer_stage->name);
}
if (a_it->second.is_relaxed_precision != b_it->second.is_relaxed_precision) {
skip |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, 0,
- SHADER_CHECKER_INTERFACE_TYPE_MISMATCH, "SC",
+ SHADER_CHECKER_INTERFACE_TYPE_MISMATCH,
"Decoration mismatch on location %u.%u: %s and %s stages differ in precision", a_first.first,
a_first.second, producer_stage->name, consumer_stage->name);
}
@@ -1666,7 +1664,7 @@ bool PreCallValidateCreateShaderModule(layer_data *dev_data, VkShaderModuleCreat
if (!have_glsl_shader && (pCreateInfo->codeSize % 4)) {
skip |= log_msg(
- report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, VALIDATION_ERROR_12a00ac0, "SC",
+ report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, VALIDATION_ERROR_12a00ac0,
"SPIR-V module not valid: Codesize must be a multiple of 4 but is " PRINTF_SIZE_T_SPECIFIER ".", pCreateInfo->codeSize);
} else {
auto cache = GetValidationCacheInfo(pCreateInfo);
@@ -1686,7 +1684,7 @@ bool PreCallValidateCreateShaderModule(layer_data *dev_data, VkShaderModuleCreat
if (!have_glsl_shader || (pCreateInfo->pCode[0] == spv::MagicNumber)) {
skip |=
log_msg(report_data, spv_valid == SPV_WARNING ? VK_DEBUG_REPORT_WARNING_BIT_EXT : VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, SHADER_CHECKER_INCONSISTENT_SPIRV, "SC",
+ VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, SHADER_CHECKER_INCONSISTENT_SPIRV,
"SPIR-V module not valid: %s", diag && diag->error ? diag->error : "(no error text)");
}
} else {