-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve shader logging #1241
Improve shader logging #1241
Conversation
I have tested this on Nvidia and Intel (the latter sometimes reports incorrect line numbers though...), so just need someone to test with AMD. |
Mesa is probably all the same whatever the hardware (AMD, Nvidia, Intel, etc.), and Mesa is probably different different to Windows/macOS proprietary AMD even on AMD. With some luck AMD OGLP on Linux is same as AMD on Windows and macOS. On Windows and Linux, one may try Mesa llvmpipe as a generic Mesa driver. |
22a34c2
to
2e939f8
Compare
eefb88c
to
65debc0
Compare
Guess I'll wait for this to be rebased on #1242 :) |
72520a0
to
11c1e04
Compare
Rebased. This now uses the functionality added in #1242. |
11c1e04
to
144dc73
Compare
144dc73
to
8ff9b82
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat, works for me on Nvidia and Intel. Well, sort of works on Intel, as promised :)
src/engine/renderer/gl_shader.h
Outdated
_shaderManager( manager ) | ||
{} | ||
{ | ||
size_t lineCount = std::count( text.begin(), text.end(), '\n' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is a text with 0 newlines a special case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They either added a newline if empty or affected which line was reported by the driver, I'll add a comment for whichever it was.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is actually because each \n
corresponds to 2 lines so any header with at least 1 needs to have its line count increased by 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The driver can't know whether the input had an empty string concatenated in it. Maybe it's just the "compat header" adding one by being empty, canceling out the -1 subtracted from all the line count sums.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I checked everything again, and it turns out that what was throwing me off were the shader compile macros. They're never passed to InitShader()
, but they are added when the shader code is actually sent to the driver to compile. This is a problem on master as well w. r. t. #insert getting incorrect line numbers because of this, so I've removed the erroneus line calculation, but the bug resulting from macros is still there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've opened an issue for it: #1339. I consider that out of scope here though, since this pr is about logging.
6f3d0e5
to
bd7364d
Compare
src/engine/renderer/gl_shader.h
Outdated
_shaderManager( manager ) | ||
{} | ||
{ | ||
size_t lineCount = std::count( text.begin(), text.end(), '\n' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The driver can't know whether the input had an empty string concatenated in it. Maybe it's just the "compat header" adding one by being empty, canceling out the -1 subtracted from all the line count sums.
bd7364d
to
4226c2f
Compare
4226c2f
to
cadb606
Compare
Parse info logs on shader compilation failure in an implementation-dependent way. Inserts a line like "------^------" into the log pointing to the exact place of the error or "^^^^^^^" if only the line is known. Also reorganised some code a bit due to the changes.
cadb606
to
f63c03c
Compare
LGTM |
Parse info logs on shader compilation failure in an implementation-dependent way, which poduces an output like this:
If the exact character is not known, the line will just be like "^^^^^^^^^^".
Also reorganised some code a bit due to changes. Removed
BuildGPUShaderText()
since it was just unnecesserily fragmenting the code at this point.