Closed Bug 1310222 Opened 3 years ago Closed 3 years ago

MAX_TEXTURE_SIZE on Firefox is much smaller than Chrome

Categories

(Core :: Canvas: WebGL, defect, P1)

Unspecified
macOS
defect

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox52 --- affected
firefox55 --- fixed

People

(Reporter: xidorn, Assigned: jgilbert)

References

Details

(Whiteboard: [gfx-noted])

Attachments

(2 files, 1 obsolete file)

On my MBP MacBook Pro (Retina, 15-inch, Late 2013), when I run the following commands in Web Console:
> var canvas = document.createElement('canvas');
> var gl = canvas.getContext('webgl');
> gl.getParameter(gl.MAX_TEXTURE_SIZE)

Firefox returns 4096, while Chrome returns 16384.

This machine has two graphics card: one is the builtin Intel Iris Pro, the other is NVIDIA GeForce GT 750M. Maybe Firefox doesn't try to use the more powerful one?
And yeah, it seems Chrome is using the NVIDIA one, because if I further input
> var debugInfo = gl.getExtension('WEBGL_debug_renderer_info');
> gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL)
Chrome returns "NVIDIA Corporation", while in Firefox, debugInfo itself is null.
OS: Unspecified → Mac OS X
Priority: -- → P4
Whiteboard: [gfx-noted]
I first reported this over three years ago on WebGL Dev.  It's not just MAX_TEXTURE_SIZE, it's also MAX_RENDERBUFFER_SIZE.  So on a 5K display, this is highly problematic.
The texture and render buffer sizes were restricted due to Mac Intel driver
bugs in bug 737182 and bug 684882. Chrome and Safari do not cap the size so
it seems likely that this is no longer an issue (although it would be good to
confirm that Apple has indeed fixed the driver).

On macOS 10.12 with a Late 2016 MacBook Pro, I forced the integrated GPU and
ran:

  var canvas = document.createElement('canvas');
  var gl = canvas.getContext('webgl');
  console.log(gl.getParameter(gl.MAX_TEXTURE_SIZE),
              gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE),
              gl.getParameter(gl.MAX_RENDERBUFFER_SIZE));

Chrome, Safari, and Firefox (with this patch applied) all print:

  16384 16384 16384

Also confirmed that the following test cases do not result in texture
corruption:

- attachment 607633 [details] (from bug 737182)
- https://threejs.org/examples/?q=car#webgl_materials_cars (from bug 684882)
Attachment #8865219 - Flags: review?(b56girard)
Assignee: nobody → birunthan
Status: NEW → ASSIGNED
I should add that the 4K limits posted were when I was running with the Nvidia GPU and not the Intel GPU of the 15" Macbook Pro just like the poster of this bug.  If there bugs in the drivers, then Chrome isn't guarding against that and neither is Safari.
There are two problems in that limiting code.  One is that the detection of the GPU seems to be wrong.  It's detecting and applying Intel limits when I'm running on Nvidia GPU.  The other is that your patch has fixed the limits for Intel, but left the Nvidia limits of 8191, which means that we can only get to 4096 on Nvidia parts for power-of-two texture sizes.

Here's one of the original positing I made to WebGL Dev for context.
https://groups.google.com/forum/#!topic/webgl-dev-list/AHONvz3oQTo
Comment on attachment 8865219 [details] [diff] [review]
Remove MAX_TEXTURE_SIZE/MAX_CUBE_MAP_TEXTURE_SIZE limit for Mac Intel hardware

Probably want a more active maintainer to review this that knows how this has evolved.
Attachment #8865219 - Flags: review?(b56girard) → review?(jmuizelaar)
Comment on attachment 8865219 [details] [diff] [review]
Remove MAX_TEXTURE_SIZE/MAX_CUBE_MAP_TEXTURE_SIZE limit for Mac Intel hardware

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

We aren't necessarily ready to lift this yet, since last repro did find this to be an issue (at least on NV) in 10.8. Now, we only support 10.9, but have no indication it's been fixed, except that it's working on 10.12. (for me, at least)

I'll try to grab a 10.9 machine and try to repro, but we can only relax these restrictions for >=10.12 until we test on previous versions.

Further, this doesn't help your main issue, since this only fixes it with the integrated GPU forced, which is not common for users, and so will not fix this bug in the common case.
Attachment #8865219 - Flags: review?(jmuizelaar) → review-
Assignee: birunthan → jgilbert
Priority: P4 → P1
Comment on attachment 8865727 [details]
Bug 1310222 - Remove GL max-size reduction workarounds on OSX >=10.12 -

https://reviewboard.mozilla.org/r/137346/#review140384

LGTM
Attachment #8865727 - Flags: review?(dmu) → review+
Comment on attachment 8865726 [details]
Bug 1310222 - Relax PoT requirement for resource size limits in WebGL. -

https://reviewboard.mozilla.org/r/137344/#review140386

LGTM
Attachment #8865726 - Flags: review?(dmu) → review+
Attachment #8865219 - Attachment is obsolete: true
Pushed by jgilbert@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/ee59f5e24bae
Relax PoT requirement for resource size limits in WebGL. - r=daoshengmu
https://hg.mozilla.org/integration/mozilla-inbound/rev/4dc76bc01b76
Remove GL max-size reduction workarounds on OSX >=10.12 - r=daoshengmu
https://hg.mozilla.org/mozilla-central/rev/ee59f5e24bae
https://hg.mozilla.org/mozilla-central/rev/4dc76bc01b76
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
(In reply to Alecazam from comment #5)
> your patch has fixed the limits for Intel

Then I'm not sure if this is the same issue, but for reference my MacBook Air (13-inch, Early 2015) OS 10.11.6, Firefox 55.0.3, running:
> var canvas = document.createElement('canvas');
> var gl = canvas.getContext('webgl');
> gl.getParameter(gl.MAX_TEXTURE_SIZE)
returns 4096, while in Chrome it's 16384. This machine has only 1 GPU (Intel HD Graphics 6000).
(In reply to jrodatus from comment #14)
> (In reply to Alecazam from comment #5)
> > your patch has fixed the limits for Intel
> 
> Then I'm not sure if this is the same issue, but for reference my MacBook
> Air (13-inch, Early 2015) OS 10.11.6, Firefox 55.0.3, running:
> > var canvas = document.createElement('canvas');
> > var gl = canvas.getContext('webgl');
> > gl.getParameter(gl.MAX_TEXTURE_SIZE)
> returns 4096, while in Chrome it's 16384. This machine has only 1 GPU (Intel
> HD Graphics 6000).

Updating to 10.12 will fix this for you.
(In reply to Jeff Gilbert [:jgilbert] from comment #15)
> Updating to 10.12 will fix this for you.

Thanks. Yes, I did understand that. Was aiming for compatibility with users who may not.

However, even Safari & Opera are reporting diff. values for GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,
so I'm thinking WebGL reports are not to be trusted in general:/
Duplicate of this bug: 1200781

I'm encountering a slightly worse version of this issue on Firefox 67.0 running on Mac OS 10.14.5. I am being limited to a MAX_TEXTURE_SIZE of 2048 (while Chrome and Safari on the same machine both report a max texture size of 16k).

Is it possible that this issue has suffered a regression?

You need to log in before you can comment on or make changes to this bug.