| 9 | ValidationStage::~ValidationStage() {} |
| 10 | |
| 11 | void ValidationStage::Run(std::vector<ShaderInformation>& information_list) { |
| 12 | |
| 13 | // We assume that all ShaderInformation object have the same ProgramId |
| 14 | const auto& first = information_list.at(0); |
| 15 | const GLuint shader_program = first.ProgramId; |
| 16 | glValidateProgram(shader_program); |
| 17 | |
| 18 | GLint validate_status; |
| 19 | glGetProgramiv(shader_program, GL_VALIDATE_STATUS, &validate_status); |
| 20 | if (validate_status == GL_FALSE) { |
| 21 | |
| 22 | GLint log_info_length = 0; |
| 23 | glGetProgramiv(shader_program, GL_INFO_LOG_LENGTH, &log_info_length); |
| 24 | |
| 25 | std::vector<GLchar> log_message(log_info_length); |
| 26 | glGetProgramInfoLog(shader_program, log_info_length, &log_info_length, &log_message[0]); |
| 27 | |
| 28 | this->m_information.IsSuccess = this->m_information.IsSuccess && false; |
| 29 | this->m_information.ErrorMessage.append(std::begin(log_message), std::end(log_message)); |
| 30 | ZENGINE_CORE_ERROR("------> Shader Program is invalid"); |
| 31 | } |
| 32 | |
| 33 | if (!this->m_information.IsSuccess) { |
| 34 | ZENGINE_CORE_ERROR("------> Validation stage completed with errors"); |
| 35 | ZENGINE_CORE_ERROR("------> {}", this->m_information.ErrorMessage); |
| 36 | return; |
| 37 | } |
| 38 | } |
| 39 | } // namespace ZEngine::Rendering::Shaders::Compilers |
nothing calls this directly
no outgoing calls
no test coverage detected