Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
21959ddf
There was an error fetching the commit references. Please try again later.
Commit
21959ddf
authored
6 years ago
by
Subv
Browse files
Options
Downloads
Patches
Plain Diff
GLRenderer: Log the shader source code when program linking fails.
parent
1b5c02fc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/video_core/renderer_opengl/gl_shader_util.h
+27
-0
27 additions, 0 deletions
src/video_core/renderer_opengl/gl_shader_util.h
with
27 additions
and
0 deletions
src/video_core/renderer_opengl/gl_shader_util.h
+
27
−
0
View file @
21959ddf
...
...
@@ -4,6 +4,7 @@
#pragma once
#include
<string>
#include
<vector>
#include
<glad/glad.h>
#include
"common/assert.h"
...
...
@@ -11,6 +12,27 @@
namespace
GLShader
{
/**
* Utility function to log the source code of a list of shaders.
* @param shaders The OpenGL shaders whose source we will print.
*/
template
<
typename
...
T
>
void
LogShaderSource
(
T
...
shaders
)
{
auto
shader_list
=
{
shaders
...};
for
(
const
auto
&
shader
:
shader_list
)
{
if
(
shader
==
0
)
continue
;
GLint
source_length
;
glGetShaderiv
(
shader
,
GL_SHADER_SOURCE_LENGTH
,
&
source_length
);
std
::
string
source
(
source_length
,
' '
);
glGetShaderSource
(
shader
,
source_length
,
nullptr
,
&
source
[
0
]);
NGLOG_INFO
(
Render_OpenGL
,
"Shader source {}"
,
source
);
}
}
/**
* Utility function to create and compile an OpenGL GLSL shader
* @param source String of the GLSL shader program
...
...
@@ -55,6 +77,11 @@ GLuint LoadProgram(bool separable_program, T... shaders) {
}
}
if
(
result
==
GL_FALSE
)
{
// There was a problem linking the shader, print the source for debugging purposes.
LogShaderSource
(
shaders
...);
}
ASSERT_MSG
(
result
==
GL_TRUE
,
"Shader not linked"
);
((
shaders
==
0
?
(
void
)
0
:
glDetachShader
(
program_id
,
shaders
)),
...);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment