bugzilla.mozilla.org has resumed normal operation. Attachments prior to 2014 will be unavailable for a few days. This is tracked in Bug 1475801.
Please report any other irregularities here.

Recompiling shaders when highlighting is very heavy and loses cached state

RESOLVED FIXED in Firefox 27

Status

DevTools
WebGL Shader Editor
P2
normal
RESOLVED FIXED
5 years ago
a month ago

People

(Reporter: vporof, Assigned: vporof)

Tracking

unspecified
Firefox 28
Dependency tree / graph

Firefox Tracking Flags

(firefox26 unaffected, firefox27 fixed, firefox28 fixed)

Details

(Whiteboard: [qa-])

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

5 years ago
To highlight rendered geometry in red when hovering a program, the responsible fragment shaders are replaced with a simple draw-all-things-in-plain-red alternative.

This is very bulky, awkward and can slow down rendering when compiling the new/old sources. Terrible, considering the fact that it happens when the mouse moves.

Moreover, because the simplified draw-all-things-in-plain-red fragment shader doesn't contain any uniforms, the client will lose any cached state, which is unrecovered when recompiling back the old source ("unhighlighting").

This is especially obvious with the unreal engine demo. After highighting the first ten shaders, you'll notice that almost all textures look different, the prebaked lighting is lost etc.

The fix would be to go through a completely different route for highlighting. Compiling things is costly, but changing blending parameters is pretty much free.
(Assignee)

Updated

5 years ago
Priority: -- → P2
(Assignee)

Comment 1

5 years ago
Created attachment 833428 [details] [diff] [review]
webgl-highlight.patch

This does the trick. Uses blending hacks to achieve the same effects without recompiling fragment shaders.
(Assignee)

Updated

5 years ago
Assignee: nobody → vporof
Status: NEW → ASSIGNED
(Assignee)

Comment 2

5 years ago
Created attachment 8333728 [details] [diff] [review]
webgl-highlight.patch

Try is green. Changes are straightforward.
Attachment #833428 - Attachment is obsolete: true
Attachment #8333728 - Flags: review?(rcampbell)
Comment on attachment 8333728 [details] [diff] [review]
webgl-highlight.patch

Review of attachment 8333728 [details] [diff] [review]:
-----------------------------------------------------------------

sure!

::: browser/devtools/shadereditor/test/browser_se_programs-blackbox-01.js
@@ +137,2 @@
>    yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 255, g: 255, b: 0, a: 255 }, true, "#canvas1");
> +  yield ensurePixelIs(debuggee, { x: 127, y: 127 }, { r: 0, g: 0, b: 64, a: 255 }, true, "#canvas2");

matching highlight pixel colors?
Attachment #8333728 - Flags: review?(rcampbell) → review+
(Assignee)

Updated

5 years ago
Depends on: 937627
(Assignee)

Comment 5

5 years ago
Comment on attachment 8333728 [details] [diff] [review]
webgl-highlight.patch

[Approval Request Comment]
Bug caused by (feature/regressing bug #): New feature (bug 910953)
User impact if declined: Using this tool in a certain way might break some pages with WebGL content. The Shader Editor is a novelty tool and no other browser has it, so WebGL devs might heavily depend on it. It'd be nice if their pages didn't start acting weirdly during development. This patch fixes this issue, and depends on bug 937627.
Testing completed (on m-c, etc.): locally, fx-team
Risk to taking this patch (and alternatives if risky): None
String or IDL/UUID changes made by this patch: None
Attachment #8333728 - Flags: approval-mozilla-aurora?
(Assignee)

Updated

5 years ago
Blocks: 943596
https://hg.mozilla.org/mozilla-central/rev/0abfe7ea3533
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 28

Updated

5 years ago
Attachment #8333728 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
https://hg.mozilla.org/releases/mozilla-aurora/rev/56f4f6a8d4d9
status-firefox27: --- → fixed
status-firefox28: --- → fixed
(Assignee)

Updated

5 years ago
status-firefox26: --- → unaffected
Whiteboard: [qa-]

Updated

a month ago
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.