Closed
Bug 594489
Opened 14 years ago
Closed 14 years ago
webgl shader validator truncates floating point literals?
Categories
(Core :: Graphics: CanvasWebGL, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: mrsmkl, Assigned: bjacob)
References
Details
Attachments
(3 files, 5 obsolete files)
17.11 KB,
patch
|
vlad
:
review+
vlad
:
approval2.0+
|
Details | Diff | Splinter Review |
7.08 KB,
patch
|
Details | Diff | Splinter Review | |
14.06 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.127 Safari/533.4 Build Identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b5) Gecko/20100101 Firefox/4.0b5 There is a problem with floating point literals used in the shaders. It seems as if I use a literal such as 0.5, it is translated into 0.0 at some point. Since I before had problems with my samples, where reloading fixed them, it is probably a problem in the shader validator, which was supposedly only enabled for the first WebGL context. One thing that the validator does seems to be checking that literals such as 1 or 0 are not used as floating point literals. Reproducible: Always Steps to Reproduce: 1. For example change the colors of first lesson from Learning WebGL to 0.99, 0.99, 0.99 instead of 1.0, 1.0, 1.0. Actual Results: Nothing is seen (because the background is black), and 0.99 is truncated into 0.0. Expected Results: Shows white shapes.
Updated•14 years ago
|
Component: General → Canvas: WebGL
Product: Firefox → Core
QA Contact: general → canvas.webgl
Version: unspecified → Trunk
Assignee | ||
Comment 1•14 years ago
|
||
I can't reproduce this issue, either with or without the shader validator (pref webgl.shader_validator). I'm on linux x86-64 / nvidia 195.36). Does the result change for you if you set the preference webgl.shader_validator to false? How did you obtain Firefox and if built from sources, what revision is that? I know you pasted your UA above but the date Gecko/20100101 looks very strange.
Comment 2•14 years ago
|
||
(In reply to comment #1) > but the date Gecko/20100101 looks very strange. The build date in the UA string has been frozen, see http://hacks.mozilla.org/2010/09/final-user-agent-string-for-firefox-4/
Reporter | ||
Comment 3•14 years ago
|
||
(In reply to comment #1) > I can't reproduce this issue, either with or without the shader validator (pref > webgl.shader_validator). I'm on linux x86-64 / nvidia 195.36). > > Does the result change for you if you set the preference webgl.shader_validator > to false? This is just the 4.0 beta 5 for Windows that was released recently. It was a good idea to test webgl.shader_validator parameter, the results indeed change when it is switched confirming that the problem is in the validator. To test the issue easily, I've put a modified version of WebGL Lesson 1 to http://sami-code.110mb.com/gl/lesson1.html. I also tested on Linux (32-bit) with beta 5, and it has the same behaviour, at least when using Mesa (on Windows I have ATI Opengl driver version 6.14.10.9655). Perhaps you have some older version, where the shader validator is only applied to the first context?
Assignee | ||
Comment 4•14 years ago
|
||
The fact that enabling/disabling the shader validator has an effect, means that: - either your shader is not GLSL ES compliant. You will then see messages in the error console (Ctrl+Shift+J) with the validator enabled. - or you hit a bug in the validator/translator. Indeed, this is translating the shader that you write (GLSL ES) into something that can be passed to the driver (GLSL). So if the error console doesn't say anything, you hit a translator bug and we should file a bug.
Reporter | ||
Comment 5•14 years ago
|
||
Ok now I've located the problem. ANGLE uses atof to convert floating point literals, but in fi_FI.utf8 locale, the decimal point is "," and therefore the literals are truncated.
Comment 6•14 years ago
|
||
I'm seeing this as well on Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b6pre) Gecko/20100910 Firefox/4.0b6pre. On locales with decimal comma the ANGLE lexer fails on float literals. A workaround is to use fractions instead of decimals, e.g. 0.4 -> 4.0/10.0, or E-notation: 4e-1. Filed a bug on the ANGLE issue tracker: http://code.google.com/p/angleproject/issues/detail?id=32
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Comment 7•14 years ago
|
||
Thanks a lot for identifying the cause of the problem and filing upstream. This is a very american bug indeed: the C standard library's number parsing functions look fine until you realize that C locales are irremediably broken (since they are shared among all threads). The solution is to use C++ streams and imbue()... will tell that upstream.
Assignee | ||
Comment 8•14 years ago
|
||
I have submitted a patch upstream: http://code.google.com/p/angleproject/issues/detail?id=32#c5
Assignee | ||
Comment 9•14 years ago
|
||
Here's a version of the patch that applies to our copy in mozilla-central. I couldn't try: make didn't pick it up. Could it be that that's still disabled on linux x86-64 ? Vlad, do you think we should apply this until ANGLE applies it?
Reporter | ||
Comment 10•14 years ago
|
||
Just a quick note: make doesn't recompile the parser or lexer automatically, I think you currently have to manually regenerate the cpp-files and put them to angle/generated.
Assignee | ||
Comment 11•14 years ago
|
||
Ah! Thanks. Will try ASAP.
it is also still disabled on x86-64. Taking this in the interim sounds fine -- just make sure you add a .patch file to the gfx/angle directory and add it to the list in gfx/angle/README.mozilla.
Assignee | ||
Comment 13•14 years ago
|
||
OK, patching this locally for now. Sending the patch upstream.
Assignee: nobody → bjacob
Attachment #474368 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #480282 -
Flags: review?(vladimir)
Assignee | ||
Comment 14•14 years ago
|
||
forgot hg add...
Attachment #480282 -
Attachment is obsolete: true
Attachment #480285 -
Flags: review?(vladimir)
Attachment #480282 -
Flags: review?(vladimir)
needs a patch file in gfx/angle, and a line describing the patch in gfx/angle/README.mozilla... also, I believe you need to regenerate the parser from glslang.l (it's not automatic).
Assignee | ||
Comment 16•14 years ago
|
||
Here you go: added patch, regenerated files, edited readme.
Attachment #480285 -
Attachment is obsolete: true
Attachment #481055 -
Flags: review?(vladimir)
Attachment #480285 -
Flags: review?(vladimir)
Comment on attachment 481055 [details] [diff] [review] Fix angle's use of atof Great, thanks!
Attachment #481055 -
Flags: review?(vladimir)
Attachment #481055 -
Flags: review+
Attachment #481055 -
Flags: approval2.0+
Assignee | ||
Comment 18•14 years ago
|
||
ok, so, nonstandard c functions are a crossplatform nightmare. Can't get this stuff to build on linux tryserver even though it's building here on fedora ---> this new patch uses c++ streams instead. Will ask for review once i've tested on windows.
Assignee | ||
Comment 19•14 years ago
|
||
Comment on attachment 481932 [details] [diff] [review] updated patch (using c++ stream) Seems to build fine with msvc 2010. Now running this through the tryserver...
Assignee | ||
Comment 20•14 years ago
|
||
Previous patch didnt have the right buildsystem changes, retrying
Attachment #481932 -
Attachment is obsolete: true
Assignee | ||
Comment 21•14 years ago
|
||
Let's do this in 2 parts: first, the ANGLE fixes....
Attachment #483222 -
Attachment is obsolete: true
Assignee | ||
Comment 22•14 years ago
|
||
... and part 2: Mozilla integration, i.e. generated files, Makefile.in, and copy of part 1 patch under gfx/angle/
Assignee | ||
Comment 23•14 years ago
|
||
Bug 578880 is now preventing me from landing this. Argh!
Comment 24•14 years ago
|
||
Is is fixed now? It seems to be fixed in angle r470.
Assignee | ||
Comment 25•14 years ago
|
||
It is fixed in ANGLE upstream, but bug 578880 is preventing us from syncing our copy of ANGLE.
Assignee | ||
Comment 26•14 years ago
|
||
Should have been fixed by recent update of our ANGLE copy.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•