| // Copyright (c) 2024-2026 The Khronos Group Inc. |
| // Copyright (c) 2024-2026 Valve Corporation |
| // Copyright (c) 2024-2026 LunarG, Inc. |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| // NOTE: This file doesn't contain any entrypoints and should be compiled with the --no-link option for glslang |
| |
| #version 450 |
| #extension GL_GOOGLE_include_directive : enable |
| #include "common_descriptor_sets.h" |
| #include "error_payload.h" |
| |
| void inst_log_error(const uvec4 stage_info) { |
| if (error_payload.inst_offset != 0) { |
| const uint cmd_id = inst_error_logger_index_buffer.index[0]; |
| const uint cmd_errors_count = atomicAdd(inst_cmd_errors_count_buffer.errors_count[cmd_id], 1); |
| const bool max_cmd_errors_count_reached = cmd_errors_count >= kMaxErrorsPerCmd; |
| if (!max_cmd_errors_count_reached) { |
| |
| uint write_pos = atomicAdd(inst_errors_buffer.written_count, kErrorRecordSize); |
| const bool errors_buffer_not_filled = (write_pos + kErrorRecordSize) <= SpecConstantInstErrorBufferLengthId; |
| |
| if (errors_buffer_not_filled) { |
| inst_errors_buffer.data[write_pos + kHeader_ErrorRecordSizeOffset] = kErrorRecordSize; |
| inst_errors_buffer.data[write_pos + kHeader_ShaderIdErrorOffset] = error_payload.shader_error_encoding; |
| inst_errors_buffer.data[write_pos + kHeader_StageInstructionIdOffset] = error_payload.inst_offset | (stage_info.x << kStageId_Shift); |
| inst_errors_buffer.data[write_pos + kHeader_StageInfoOffset_0] = stage_info.y; |
| inst_errors_buffer.data[write_pos + kHeader_StageInfoOffset_1] = stage_info.z; |
| inst_errors_buffer.data[write_pos + kHeader_StageInfoOffset_2] = stage_info.w; |
| |
| inst_errors_buffer.data[write_pos + kHeader_ActionIdErrorLoggerIdOffset] = (inst_action_index_buffer.index[0] << kActionId_Shift) | inst_error_logger_index_buffer.index[0]; |
| |
| inst_errors_buffer.data[write_pos + kInst_LogError_ParameterOffset_0] = error_payload.parameter_0; |
| inst_errors_buffer.data[write_pos + kInst_LogError_ParameterOffset_1] = error_payload.parameter_1; |
| inst_errors_buffer.data[write_pos + kInst_LogError_ParameterOffset_2] = error_payload.parameter_2; |
| } |
| } |
| } |
| } |