| 3848 | } |
| 3849 | |
| 3850 | static bool TryLinkProgram(GLuint* ids, int num_ids) |
| 3851 | { |
| 3852 | GLuint tmp_program = glCreateProgram(); |
| 3853 | CHECK_GL_ERROR; |
| 3854 | |
| 3855 | for (int i = 0; i < num_ids; ++i) |
| 3856 | { |
| 3857 | glAttachShader(tmp_program, ids[i]); |
| 3858 | CHECK_GL_ERROR; |
| 3859 | } |
| 3860 | |
| 3861 | glLinkProgram(tmp_program); |
| 3862 | |
| 3863 | bool success = true; |
| 3864 | GLint status; |
| 3865 | glGetProgramiv(tmp_program, GL_LINK_STATUS, &status); |
| 3866 | if (status == 0) |
| 3867 | { |
| 3868 | dmLogError("Unable to link program."); |
| 3869 | GLint logLength; |
| 3870 | glGetProgramiv(tmp_program, GL_INFO_LOG_LENGTH, &logLength); |
| 3871 | if (logLength > 0) |
| 3872 | { |
| 3873 | GLchar *log = (GLchar *)malloc(logLength); |
| 3874 | glGetProgramInfoLog(tmp_program, logLength, &logLength, log); |
| 3875 | dmLogError("%s", log); |
| 3876 | free(log); |
| 3877 | } |
| 3878 | success = false; |
| 3879 | } |
| 3880 | glDeleteProgram(tmp_program); |
| 3881 | |
| 3882 | return success; |
| 3883 | } |
| 3884 | |
| 3885 | static bool ReloadShader(OpenGLContext* context, OpenGLShader* shader, ShaderDesc::Shader* ddf, GLenum type) |
| 3886 | { |
no test coverage detected