Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
d43b8d85
Commit
d43b8d85
authored
4 years ago
by
Ptolemy
Browse files
Options
Downloads
Patches
Plain Diff
SL-13019: Add debug logging of shaders used to track down macOSX / OSX GLSL linker errors
parent
a387b38d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llrender/llglslshader.cpp
+39
-0
39 additions, 0 deletions
indra/llrender/llglslshader.cpp
with
39 additions
and
0 deletions
indra/llrender/llglslshader.cpp
+
39
−
0
View file @
d43b8d85
...
@@ -37,6 +37,10 @@
...
@@ -37,6 +37,10 @@
#include
"OpenGL/OpenGL.h"
#include
"OpenGL/OpenGL.h"
#endif
#endif
// Print-print list of shader included source files that are linked together via glAttachObjectARB()
// i.e. On macOS / OSX the AMD GLSL linker will display an error if a varying is left in an undefined state.
#define DEBUG_SHADER_INCLUDES 0
// Lots of STL stuff in here, using namespace std to keep things more readable
// Lots of STL stuff in here, using namespace std to keep things more readable
using
std
::
vector
;
using
std
::
vector
;
using
std
::
pair
;
using
std
::
pair
;
...
@@ -402,6 +406,10 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,
...
@@ -402,6 +406,10 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,
mDefines
[
"OLD_SELECT"
]
=
"1"
;
mDefines
[
"OLD_SELECT"
]
=
"1"
;
#endif
#endif
#if DEBUG_SHADER_INCLUDES
fprintf
(
stderr
,
"--- %s ---
\n
"
,
mName
.
c_str
());
#endif // DEBUG_SHADER_INCLUDES
//compile new source
//compile new source
vector
<
pair
<
string
,
GLenum
>
>::
iterator
fileIter
=
mShaderFiles
.
begin
();
vector
<
pair
<
string
,
GLenum
>
>::
iterator
fileIter
=
mShaderFiles
.
begin
();
for
(
;
fileIter
!=
mShaderFiles
.
end
();
fileIter
++
)
for
(
;
fileIter
!=
mShaderFiles
.
end
();
fileIter
++
)
...
@@ -485,12 +493,36 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,
...
@@ -485,12 +493,36 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,
return
success
;
return
success
;
}
}
#if DEBUG_SHADER_INCLUDES
void
dumpAttachObject
(
const
char
*
func_name
,
GLhandleARB
program_object
,
const
std
::
string
&
object_path
)
{
GLcharARB
*
info_log
;
GLint
info_len_expect
=
0
;
GLint
info_len_actual
=
0
;
glGetObjectParameterivARB
(
program_object
,
GL_OBJECT_INFO_LOG_LENGTH_ARB
,
&
info_len_expect
);
fprintf
(
stderr
,
" * %-20s(), log size: %d, %s
\n
"
,
func_name
,
info_len_expect
,
object_path
.
c_str
());
if
(
info_len_expect
>
0
)
{
fprintf
(
stderr
,
" ========== %s() ==========
\n
"
,
func_name
);
info_log
=
new
GLcharARB
[
info_len_expect
];
glGetInfoLogARB
(
program_object
,
info_len_expect
,
&
info_len_actual
,
info_log
);
fprintf
(
stderr
,
"%s
\n
"
,
info_log
);
delete
[]
info_log
;
}
}
#endif // DEBUG_SHADER_INCLUDES
BOOL
LLGLSLShader
::
attachVertexObject
(
std
::
string
object_path
)
BOOL
LLGLSLShader
::
attachVertexObject
(
std
::
string
object_path
)
{
{
if
(
LLShaderMgr
::
instance
()
->
mVertexShaderObjects
.
count
(
object_path
)
>
0
)
if
(
LLShaderMgr
::
instance
()
->
mVertexShaderObjects
.
count
(
object_path
)
>
0
)
{
{
stop_glerror
();
stop_glerror
();
glAttachObjectARB
(
mProgramObject
,
LLShaderMgr
::
instance
()
->
mVertexShaderObjects
[
object_path
]);
glAttachObjectARB
(
mProgramObject
,
LLShaderMgr
::
instance
()
->
mVertexShaderObjects
[
object_path
]);
#if DEBUG_SHADER_INCLUDES
dumpAttachObject
(
"attachVertexObject"
,
mProgramObject
,
object_path
);
#endif // DEBUG_SHADER_INCLUDES
stop_glerror
();
stop_glerror
();
return
TRUE
;
return
TRUE
;
}
}
...
@@ -507,6 +539,9 @@ BOOL LLGLSLShader::attachFragmentObject(std::string object_path)
...
@@ -507,6 +539,9 @@ BOOL LLGLSLShader::attachFragmentObject(std::string object_path)
{
{
stop_glerror
();
stop_glerror
();
glAttachObjectARB
(
mProgramObject
,
LLShaderMgr
::
instance
()
->
mFragmentShaderObjects
[
object_path
]);
glAttachObjectARB
(
mProgramObject
,
LLShaderMgr
::
instance
()
->
mFragmentShaderObjects
[
object_path
]);
#if DEBUG_SHADER_INCLUDES
dumpAttachObject
(
"attachFragmentObject"
,
mProgramObject
,
object_path
);
#endif // DEBUG_SHADER_INCLUDES
stop_glerror
();
stop_glerror
();
return
TRUE
;
return
TRUE
;
}
}
...
@@ -523,6 +558,10 @@ void LLGLSLShader::attachObject(GLhandleARB object)
...
@@ -523,6 +558,10 @@ void LLGLSLShader::attachObject(GLhandleARB object)
{
{
stop_glerror
();
stop_glerror
();
glAttachObjectARB
(
mProgramObject
,
object
);
glAttachObjectARB
(
mProgramObject
,
object
);
#if DEBUG_SHADER_INCLUDES
std
::
string
object_path
(
"???"
);
dumpAttachObject
(
"attachObject"
,
mProgramObject
,
object_path
);
#endif // DEBUG_SHADER_INCLUDES
stop_glerror
();
stop_glerror
();
}
}
else
else
...
...
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