|
13 | 13 | * limitations under the License. |
14 | 14 | */ |
15 | 15 |
|
| 16 | +#include "generated/spirv_grammar_helper.h" |
16 | 17 | #include "gpuav/core/gpuav.h" |
17 | 18 | #include "gpuav/resources/gpuav_state_trackers.h" |
18 | 19 | #include "gpuav/shaders/gpuav_error_codes.h" |
@@ -41,95 +42,87 @@ void RegisterRayHitObjectValidation(Validator &gpuav, CommandBufferSubState &cb) |
41 | 42 | std::ostringstream strm; |
42 | 43 |
|
43 | 44 | const uint32_t error_sub_code = GetSubError(error_record); |
44 | | - // opcode_type: 0 = OpHitObjectTraceRayEXT, 1 = OpHitObjectTraceReorderExecuteEXT, |
45 | | - // 2 = OpHitObjectTraceRayMotionEXT, 3 = OpHitObjectTraceMotionReorderExecuteEXT |
46 | | - const uint32_t opcode_type = error_record[kInstRayHitObjectOpcodeType]; |
47 | | - const char* opcode_name = "OpHitObjectTraceRayEXT"; |
48 | | - if (opcode_type == 1) { |
49 | | - opcode_name = "OpHitObjectTraceReorderExecuteEXT"; |
50 | | - } else if (opcode_type == 2) { |
51 | | - opcode_name = "OpHitObjectTraceRayMotionEXT"; |
52 | | - } else if (opcode_type == 3) { |
53 | | - opcode_name = "OpHitObjectTraceMotionReorderExecuteEXT"; |
54 | | - } |
| 45 | + const uint32_t opcode = error_record[kInstLogErrorParameterOffset_1]; |
55 | 46 |
|
56 | 47 | switch (error_sub_code) { |
57 | 48 | case kErrorSubCodeRayHitObjectNegativeMin: { |
58 | 49 | // TODO - Figure a way to properly use GLSL floatBitsToUint and print the float values |
59 | | - strm << opcode_name << " operand Ray Tmin value is negative. "; |
| 50 | + strm << string_SpvOpcode(opcode) << " operand Ray Tmin value is negative. "; |
60 | 51 | out_vuid_msg = "VUID-RuntimeSpirv-OpHitObjectTraceRayEXT-11879"; |
61 | 52 | } break; |
62 | 53 | case kErrorSubCodeRayHitObjectNegativeMax: { |
63 | | - strm << opcode_name << " operand Ray Tmax value is negative. "; |
| 54 | + strm << string_SpvOpcode(opcode) << " operand Ray Tmax value is negative. "; |
64 | 55 | out_vuid_msg = "VUID-RuntimeSpirv-OpHitObjectTraceRayEXT-11879"; |
65 | 56 | } break; |
66 | 57 | case kErrorSubCodeRayHitObjectMinMax: { |
67 | | - strm << opcode_name << " operand Ray Tmax is less than RayTmin. "; |
| 58 | + strm << string_SpvOpcode(opcode) << " operand Ray Tmax is less than RayTmin. "; |
68 | 59 | out_vuid_msg = "VUID-RuntimeSpirv-OpHitObjectTraceRayEXT-11880"; |
69 | 60 | } break; |
70 | 61 | case kErrorSubCodeRayHitObjectMinNaN: { |
71 | | - strm << opcode_name << " operand Ray Tmin is NaN. "; |
| 62 | + strm << string_SpvOpcode(opcode) << " operand Ray Tmin is NaN. "; |
72 | 63 | out_vuid_msg = "VUID-RuntimeSpirv-OpHitObjectTraceRayEXT-11881"; |
73 | 64 | } break; |
74 | 65 | case kErrorSubCodeRayHitObjectMaxNaN: { |
75 | | - strm << opcode_name << " operand Ray Tmax is NaN. "; |
| 66 | + strm << string_SpvOpcode(opcode) << " operand Ray Tmax is NaN. "; |
76 | 67 | out_vuid_msg = "VUID-RuntimeSpirv-OpHitObjectTraceRayEXT-11881"; |
77 | 68 | } break; |
78 | 69 | case kErrorSubCodeRayHitObjectOriginNaN: { |
79 | | - strm << opcode_name << " operand Ray Origin contains a NaN. "; |
| 70 | + strm << string_SpvOpcode(opcode) << " operand Ray Origin contains a NaN. "; |
80 | 71 | out_vuid_msg = "VUID-RuntimeSpirv-OpHitObjectTraceRayEXT-11881"; |
81 | 72 | } break; |
82 | 73 | case kErrorSubCodeRayHitObjectDirectionNaN: { |
83 | | - strm << opcode_name << " operand Ray Direction contains a NaN. "; |
| 74 | + strm << string_SpvOpcode(opcode) << " operand Ray Direction contains a NaN. "; |
84 | 75 | out_vuid_msg = "VUID-RuntimeSpirv-OpHitObjectTraceRayEXT-11881"; |
85 | 76 | } break; |
86 | 77 | case kErrorSubCodeRayHitObjectOriginFinite: { |
87 | | - strm << opcode_name << " operand Ray Origin contains a non-finite value. "; |
| 78 | + strm << string_SpvOpcode(opcode) << " operand Ray Origin contains a non-finite value. "; |
88 | 79 | out_vuid_msg = "VUID-RuntimeSpirv-OpHitObjectTraceRayEXT-11878"; |
89 | 80 | } break; |
90 | 81 | case kErrorSubCodeRayHitObjectDirectionFinite: { |
91 | | - strm << opcode_name << " operand Ray Direction contains a non-finite value. "; |
| 82 | + strm << string_SpvOpcode(opcode) << " operand Ray Direction contains a non-finite value. "; |
92 | 83 | out_vuid_msg = "VUID-RuntimeSpirv-OpHitObjectTraceRayEXT-11878"; |
93 | 84 | } break; |
94 | 85 | case kErrorSubCodeRayHitObjectBothSkip: { |
95 | | - const uint32_t value = error_record[kInstRayHitObjectParamOffset_0]; |
96 | | - strm << opcode_name << " operand Ray Flags is 0x" << std::hex << value << ". "; |
| 86 | + const uint32_t value = error_record[kInstLogErrorParameterOffset_0]; |
| 87 | + strm << string_SpvOpcode(opcode) << " operand Ray Flags is 0x" << std::hex << value << ". "; |
97 | 88 | out_vuid_msg = "VUID-RuntimeSpirv-OpHitObjectTraceRayEXT-11883"; |
98 | 89 | } break; |
99 | 90 | case kErrorSubCodeRayHitObjectSkipCull: { |
100 | | - const uint32_t value = error_record[kInstRayHitObjectParamOffset_0]; |
101 | | - strm << opcode_name << " operand Ray Flags is 0x" << std::hex << value << ". "; |
| 91 | + const uint32_t value = error_record[kInstLogErrorParameterOffset_0]; |
| 92 | + strm << string_SpvOpcode(opcode) << " operand Ray Flags is 0x" << std::hex << value << ". "; |
102 | 93 | out_vuid_msg = "VUID-RuntimeSpirv-OpHitObjectTraceRayEXT-11884"; |
103 | 94 | } break; |
104 | 95 | case kErrorSubCodeRayHitObjectOpaque: { |
105 | | - const uint32_t value = error_record[kInstRayHitObjectParamOffset_0]; |
106 | | - strm << opcode_name << " operand Ray Flags is 0x" << std::hex << value << ". "; |
| 96 | + const uint32_t value = error_record[kInstLogErrorParameterOffset_0]; |
| 97 | + strm << string_SpvOpcode(opcode) << " operand Ray Flags is 0x" << std::hex << value << ". "; |
107 | 98 | out_vuid_msg = "VUID-RuntimeSpirv-OpHitObjectTraceRayEXT-11885"; |
108 | 99 | } break; |
109 | 100 | case kErrorSubCodeRayHitObjectSkipTrianglesWithPipelineSkipAABBs: { |
110 | | - const uint32_t value = error_record[kInstRayHitObjectParamOffset_0]; |
111 | | - strm << opcode_name << " operand Ray Flags (0x" << std::hex << value |
112 | | - << ") contains SkipTrianglesKHR, but pipeline was created with VK_PIPELINE_CREATE_RAY_TRACING_SKIP_AABBS_BIT_KHR. "; |
| 101 | + const uint32_t value = error_record[kInstLogErrorParameterOffset_0]; |
| 102 | + strm << string_SpvOpcode(opcode) << " operand Ray Flags (0x" << std::hex << value |
| 103 | + << ") contains SkipTrianglesKHR, but pipeline was created with " |
| 104 | + "VK_PIPELINE_CREATE_RAY_TRACING_SKIP_AABBS_BIT_KHR. "; |
113 | 105 | out_vuid_msg = "VUID-RuntimeSpirv-OpHitObjectTraceRayEXT-11886"; |
114 | 106 | } break; |
115 | 107 | case kErrorSubCodeRayHitObjectSkipAABBsWithPipelineSkipTriangles: { |
116 | | - const uint32_t value = error_record[kInstRayHitObjectParamOffset_0]; |
117 | | - strm << opcode_name << " operand Ray Flags (0x" << std::hex << value |
118 | | - << ") contains SkipAABBsKHR, but pipeline was created with VK_PIPELINE_CREATE_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR. "; |
| 108 | + const uint32_t value = error_record[kInstLogErrorParameterOffset_0]; |
| 109 | + strm << string_SpvOpcode(opcode) << " operand Ray Flags (0x" << std::hex << value |
| 110 | + << ") contains SkipAABBsKHR, but pipeline was created with " |
| 111 | + "VK_PIPELINE_CREATE_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR. "; |
119 | 112 | out_vuid_msg = "VUID-RuntimeSpirv-OpHitObjectTraceRayEXT-11887"; |
120 | 113 | } break; |
| 114 | + case kErrorSubCodeRayHitObjectTimeOutOfRange: { |
| 115 | + strm << string_SpvOpcode(opcode) << " operand time is not between 0.0 and 1.0. "; |
| 116 | + out_vuid_msg = "VUID-RuntimeSpirv-OpHitObjectTraceRayEXT-11882"; |
| 117 | + } break; |
121 | 118 | case kErrorSubCodeRayHitObjectSBTIndexExceedsLimit: { |
122 | 119 | // For this case, param_0 contains the SBT index and opcode_type slot contains the max SBT index |
123 | | - const uint32_t sbt_index = error_record[kInstRayHitObjectParamOffset_0]; |
124 | | - const uint32_t max_sbt_index = error_record[kInstRayHitObjectOpcodeType]; |
| 120 | + const uint32_t sbt_index = error_record[kInstLogErrorParameterOffset_0]; |
| 121 | + const uint32_t max_sbt_index = error_record[kInstLogErrorParameterOffset_1]; |
125 | 122 | strm << "OpHitObjectSetShaderBindingTableRecordIndexEXT SBT index (" << std::dec << sbt_index |
126 | 123 | << ") exceeds VkPhysicalDeviceRayTracingInvocationReorderPropertiesEXT::maxShaderBindingTableRecordIndex (" << max_sbt_index << "). "; |
127 | 124 | out_vuid_msg = "VUID-RuntimeSpirv-maxShaderBindingTableRecordIndex-11888"; |
128 | 125 | } break; |
129 | | - case kErrorSubCodeRayHitObjectTimeOutOfRange: { |
130 | | - strm << opcode_name << " operand time is not between 0.0 and 1.0. "; |
131 | | - out_vuid_msg = "VUID-RuntimeSpirv-OpHitObjectTraceRayEXT-11882"; |
132 | | - } break; |
133 | 126 | default: |
134 | 127 | error_found = false; |
135 | 128 | break; |
|
0 commit comments