diff --git a/layers/CMakeLists.txt b/layers/CMakeLists.txt index 94e44ebacfc..590ad9a2f7a 100644 --- a/layers/CMakeLists.txt +++ b/layers/CMakeLists.txt @@ -364,6 +364,9 @@ if (ANDROID) # Required for __android_log_print. Marking as PUBLIC since the tests use __android_log_print as well. target_link_libraries(VkLayer_utils PUBLIC log) + # Required for AHardwareBuffer_describe. Marking as PUBLIC since the tests use AHardwareBuffer_describe as well. + target_link_libraries(VkLayer_utils PUBLIC android) + install(TARGETS vvl DESTINATION ${CMAKE_INSTALL_LIBDIR}) return() diff --git a/layers/gpu_validation/debug_printf.cpp b/layers/gpu_validation/debug_printf.cpp index e93c315e457..67629cf9eef 100644 --- a/layers/gpu_validation/debug_printf.cpp +++ b/layers/gpu_validation/debug_printf.cpp @@ -290,13 +290,9 @@ void debug_printf::Validator::AnalyzeAndGenerateMessages(VkCommandBuffer command // 1 Size of output record, including this word // 2 Shader ID // 3 Instruction Position - // 4 Stage Ordinal - // 5 Stage - specific Info Word 0 - // 6 Stage - specific Info Word 1 - // 7 Stage - specific Info Word 2 - // 8 Printf Format String Id - // 9 Printf Values Word 0 (optional) - // 10 Printf Values Word 1 (optional) + // 4 Printf Format String Id + // 5 Printf Values Word 0 (optional) + // 6 Printf Values Word 1 (optional) uint32_t expect = debug_output_buffer[1]; if (!expect) return; @@ -387,19 +383,17 @@ void debug_printf::Validator::AnalyzeAndGenerateMessages(VkCommandBuffer command } if (verbose) { - std::string stage_message; std::string common_message; std::string filename_message; std::string source_message; - UtilGenerateStageMessage(&debug_output_buffer[index], stage_message); UtilGenerateCommonMessage(report_data, command_buffer, &debug_output_buffer[index], shader_module_handle, pipeline_handle, shader_object_handle, buffer_info.pipeline_bind_point, operation_index, common_message); UtilGenerateSourceMessages(pgm, &debug_output_buffer[index], true, filename_message, source_message); if (use_stdout) { - std::cout << "UNASSIGNED-DEBUG-PRINTF " << common_message.c_str() << " " << stage_message.c_str() << " " + std::cout << "UNASSIGNED-DEBUG-PRINTF " << common_message.c_str() << " " << shader_message.str().c_str() << " " << filename_message.c_str() << " " << source_message.c_str(); } else { - LogInfo("UNASSIGNED-DEBUG-PRINTF", queue, loc, "%s %s %s %s%s", common_message.c_str(), stage_message.c_str(), + LogInfo("UNASSIGNED-DEBUG-PRINTF", queue, loc, "%s %s %s%s", common_message.c_str(), shader_message.str().c_str(), filename_message.c_str(), source_message.c_str()); } } else { @@ -467,9 +461,7 @@ void debug_printf::Validator::PreCallRecordCmdDrawMultiEXT(VkCommandBuffer comma const VkMultiDrawInfoEXT *pVertexInfo, uint32_t instanceCount, uint32_t firstInstance, uint32_t stride, const RecordObject &record_obj) { - for (uint32_t i = 0; i < drawCount; i++) { - AllocateDebugPrintfResources(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS); - } + AllocateDebugPrintfResources(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS); } void debug_printf::Validator::PreCallRecordCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, @@ -482,9 +474,7 @@ void debug_printf::Validator::PreCallRecordCmdDrawMultiIndexedEXT(VkCommandBuffe const VkMultiDrawIndexedInfoEXT *pIndexInfo, uint32_t instanceCount, uint32_t firstInstance, uint32_t stride, const int32_t *pVertexOffset, const RecordObject &record_obj) { - for (uint32_t i = 0; i < drawCount; i++) { - AllocateDebugPrintfResources(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS); - } + AllocateDebugPrintfResources(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS); } void debug_printf::Validator::PreCallRecordCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, diff --git a/layers/gpu_validation/debug_printf.h b/layers/gpu_validation/debug_printf.h index d73e27ceb98..e5761ccc158 100644 --- a/layers/gpu_validation/debug_printf.h +++ b/layers/gpu_validation/debug_printf.h @@ -51,10 +51,6 @@ struct OutputRecord { uint32_t size; uint32_t shader_id; uint32_t instruction_position; - uint32_t stage; - uint32_t stage_word_1; - uint32_t stage_word_2; - uint32_t stage_word_3; uint32_t format_string_id; uint32_t values; }; diff --git a/layers/gpu_validation/gpu_error_message.cpp b/layers/gpu_validation/gpu_error_message.cpp index 05ccb6c4cfb..cd3d8704ffa 100644 --- a/layers/gpu_validation/gpu_error_message.cpp +++ b/layers/gpu_validation/gpu_error_message.cpp @@ -25,8 +25,8 @@ #include // Generate the stage-specific part of the message. -void UtilGenerateStageMessage(const uint32_t *debug_record, std::string &msg) { - using namespace spvtools; +static void GenerateStageMessage(const uint32_t *debug_record, std::string &msg) { + using namespace gpuav::glsl; std::ostringstream strm; switch (debug_record[kInstCommonOutStageIdx]) { case spv::ExecutionModelVertex: { @@ -499,7 +499,7 @@ bool gpuav::Validator::AnalyzeAndGenerateMessages(VkCommandBuffer cmd_buffer, Vk std::string common_message; std::string filename_message; std::string source_message; - UtilGenerateStageMessage(debug_record, stage_message); + GenerateStageMessage(debug_record, stage_message); UtilGenerateCommonMessage(report_data, cmd_buffer, debug_record, shader_module_handle, pipeline_handle, shader_object_handle, cmd_resources.pipeline_bind_point, operation_index, common_message); UtilGenerateSourceMessages(pgm, debug_record, false, filename_message, source_message); @@ -711,4 +711,4 @@ bool gpuav::PreTraceRaysResources::LogValidationMessage(gpuav::Validator &valida } return error_logged; -} \ No newline at end of file +} diff --git a/layers/gpu_validation/gpu_error_message.h b/layers/gpu_validation/gpu_error_message.h index 3cd5c030b4c..1c87101ceeb 100644 --- a/layers/gpu_validation/gpu_error_message.h +++ b/layers/gpu_validation/gpu_error_message.h @@ -17,7 +17,6 @@ #pragma once #include "generated/chassis.h" -void UtilGenerateStageMessage(const uint32_t *debug_record, std::string &msg); void UtilGenerateCommonMessage(const debug_report_data *report_data, const VkCommandBuffer commandBuffer, const uint32_t *debug_record, const VkShaderModule shader_module_handle, const VkPipeline pipeline_handle, const VkShaderEXT shader_object_handle, diff --git a/layers/vulkan/generated/spirv_tools_commit_id.h b/layers/vulkan/generated/spirv_tools_commit_id.h index a5acd06adaa..92f84f8c890 100644 --- a/layers/vulkan/generated/spirv_tools_commit_id.h +++ b/layers/vulkan/generated/spirv_tools_commit_id.h @@ -23,4 +23,4 @@ #pragma once -#define SPIRV_TOOLS_COMMIT_ID "360d469b9eac54d6c6e20f609f9ec35e3a5380ad" +#define SPIRV_TOOLS_COMMIT_ID "b5d60826e9d2ad130fd9eb140ea633c349159952" diff --git a/scripts/known_good.json b/scripts/known_good.json index 1cd4edd7228..d421b205f6d 100755 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -43,7 +43,7 @@ "-DSPIRV_SKIP_TESTS=ON", "-DSPIRV_SKIP_EXECUTABLES=ON" ], - "commit": "360d469b9eac54d6c6e20f609f9ec35e3a5380ad" + "commit": "b5d60826e9d2ad130fd9eb140ea633c349159952" }, { "name": "robin-hood-hashing", diff --git a/tests/unit/debug_printf.cpp b/tests/unit/debug_printf.cpp index c63f7acea98..fc848d3c93f 100644 --- a/tests/unit/debug_printf.cpp +++ b/tests/unit/debug_printf.cpp @@ -110,7 +110,9 @@ TEST_F(NegativeDebugPrintf, BasicUsage) { void main() { float myfloat = 3.1415f; int foo = -135; - if (gl_VertexIndex == 0) { + // referencing gl_InstanceIndex appears to be required to ensure this shader runs multiple times + // when called from vkCmdDrawMultiEXT(). + if (gl_VertexIndex == 0 && gl_InstanceIndex < 10000) { switch(u_info.whichtest) { case 0: debugPrintfEXT("Here are two float values %f, %f", 1.0, myfloat); @@ -433,7 +435,9 @@ TEST_F(NegativeDebugPrintf, GPL) { void main() { float myfloat = 3.1415f; int foo = -135; - if (gl_VertexIndex == 0) { + // referencing gl_InstanceIndex appears to be required to ensure this shader runs multiple times + // when called from vkCmdDrawMultiEXT(). + if (gl_VertexIndex == 0 && gl_InstanceIndex < 10000) { switch(u_info.whichtest) { case 0: debugPrintfEXT("Here are two float values %f, %f", 1.0, myfloat); @@ -1005,7 +1009,9 @@ TEST_F(NegativeDebugPrintf, BasicUsageShaderObjects) { void main() { float myfloat = 3.1415f; int foo = -135; - if (gl_VertexIndex == 0) { + // referencing gl_InstanceIndex appears to be required to ensure this shader runs multiple times + // when called from vkCmdDrawMultiEXT(). + if (gl_VertexIndex == 0 && gl_InstanceIndex < 10000) { switch(u_info.whichtest) { case 0: debugPrintfEXT("Here are two float values %f, %f", 1.0, myfloat);