Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Issue 634519 GenerateMipmap doesn't work correctly with sRGB formats
Starred by 4 users Project Member Reported by zmo@chromium.org, Aug 4 2016 Back to list
Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Blocked on:
issue 712096

Blocking:
issue 662644



Sign in to add a comment
Here are some notes from 

Using glGenerateMipmap:
Win8-ShuttleB-GPU-HD4600: Always sRGB
Win8-ShuttleA-GPU-HD7770: Always linear
Mac-MacMini6.2-GPU-HD4000: Always linear
Mac-MacMini4.1-GPU-GeForce320M: Inverted on some cases
 
Comment 1 by zmo@chromium.org, Aug 4 2016
I don't think we have tests for this
Components: Internals>GPU
Some discussions on what the test should look like: https://github.com/KhronosGroup/WebGL/pull/1951.
Owner: yunchao...@intel.com
Status: Assigned
Cc: yizhou.j...@intel.com yang...@intel.com
Status: Started
Yizhou is working on this issue. But she is not a Chromium project member. So I assign this issue to me to update the status.
Comment 6 by kbr@chromium.org, Sep 29 2016
Blocking: 651576
Comment 7 by kbr@chromium.org, Sep 30 2016
Owner: yizhou.j...@intel.com
Yizhou, you're now a Chromium project member so let me assign this bug to you directly.
@kbr and @zmo, thanks for your efforts to give Yizhou chromium project member privilege. 
Comment 9 by yang...@intel.com, Sep 30 2016
Please note that we will be off from Oct 1st to 7th due to National Day Holiday in PRC, so the response to patch/issue might be delayed. 
@kbr @zmo Thanks a lot!
Project Member Comment 11 by bugdroid1@chromium.org, Oct 3
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b53abd7b3c59d221641d07fd25ab26d2ca2f8a22

commit b53abd7b3c59d221641d07fd25ab26d2ca2f8a22
Author: j.isorce <j.isorce@samsung.com>
Date: Mon Oct 03 08:50:50 2016

GpuControlListEntry might need more info for gl_version as well

BUG= 651576 , 634519

R=kbr@chromium.org, zmo@chromium.org
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2379153002
Cr-Commit-Position: refs/heads/master@{#422393}

[modify] https://crrev.com/b53abd7b3c59d221641d07fd25ab26d2ca2f8a22/gpu/config/gpu_control_list.cc
[modify] https://crrev.com/b53abd7b3c59d221641d07fd25ab26d2ca2f8a22/gpu/config/gpu_control_list_entry_unittest.cc

Project Member Comment 12 by bugdroid1@chromium.org, Oct 11
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/da573a8ab571bb73d3539a66abbe5c2efd47d7b7

commit da573a8ab571bb73d3539a66abbe5c2efd47d7b7
Author: yizhou.jiang <yizhou.jiang@intel.com>
Date: Tue Oct 11 06:21:01 2016

emulate srgb format for generateMipmap

First, do sampling for a srgb texture, converting it to a linear
texture. Then generateMipmap in rgb format, and do another sampling to
convert rgb texture to srgb one.

BUG=634519
TEST=conformance2/textures/misc/tex-srgb-mipmap.html
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2318313004
Cr-Commit-Position: refs/heads/master@{#424377}

[modify] https://crrev.com/da573a8ab571bb73d3539a66abbe5c2efd47d7b7/AUTHORS
[modify] https://crrev.com/da573a8ab571bb73d3539a66abbe5c2efd47d7b7/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
[modify] https://crrev.com/da573a8ab571bb73d3539a66abbe5c2efd47d7b7/gpu/command_buffer/service/gles2_cmd_decoder.cc
[modify] https://crrev.com/da573a8ab571bb73d3539a66abbe5c2efd47d7b7/gpu/command_buffer/service/gles2_cmd_srgb_converter.cc
[modify] https://crrev.com/da573a8ab571bb73d3539a66abbe5c2efd47d7b7/gpu/command_buffer/service/gles2_cmd_srgb_converter.h
[modify] https://crrev.com/da573a8ab571bb73d3539a66abbe5c2efd47d7b7/gpu/config/gpu_driver_bug_list_json.cc
[modify] https://crrev.com/da573a8ab571bb73d3539a66abbe5c2efd47d7b7/gpu/config/gpu_driver_bug_workaround_type.h

Status: Fixed
This issue is fixed now.
Excellent work Yizhou! Thank you for fixing this!

I did want to add one comment: This implementation is going to reduce the quality of the mipmaps. The conversion from sRGB to 8-bit linear is going to reduce the precision of the texture, and the conversion back (after the downsampling) will do the same thing. Obviously, this is a workaround, so having any implementation is better than nothing, but it's worth considering a solution that doesn't introduce a comb filter to the image.
@brianosman, @zmo and @kbr, any suggestion about the internalformat during conversion, except RGBA8? I think we can simply use a internalformat with high precision in this patch. 
Brian, thanks for the feedback. Yes, we should address this precision loss issue, otherwise it's not of much use for quality sensitive clients.

I would suggest RGBA16F or RGBA32F. The vram requirement is limited to the function, so it should not be a concern.
Project Member Comment 18 by bugdroid1@chromium.org, Oct 24
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0500571c0a41d977f64653eeaed4809351205a35

commit 0500571c0a41d977f64653eeaed4809351205a35
Author: yizhou.jiang <yizhou.jiang@intel.com>
Date: Mon Oct 24 04:27:04 2016

optimize precision for conversion from srgb to linear

Convertion from sRGB to 8-bit linear is going to reduce the
precision of the texture, and the downsampling will do the
same thing. We should set texture internalformat to rgba32f
to optimize precision.

BUG=634519
TEST=conformance2/textures/misc/tex-srgb-mipmap.html
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2420813002
Cr-Commit-Position: refs/heads/master@{#427014}

[modify] https://crrev.com/0500571c0a41d977f64653eeaed4809351205a35/gpu/command_buffer/service/feature_info.h
[modify] https://crrev.com/0500571c0a41d977f64653eeaed4809351205a35/gpu/command_buffer/service/gles2_cmd_srgb_converter.cc

By the way, tex-srgb-mipmap.html is failing on Windows
@zmo I’ll have a look at this issue.

From: zmo via monorail [mailto:monorail+v2.3927685578@chromium.org]
Sent: Friday, December 2, 2016 7:59 AM
To: Jiang, Yizhou <yizhou.jiang@intel.com>
Subject: Issue 634519 in chromium: GenerateMipmap doesn't work correctly with sRGB formats
That's almost certainly related to ccameron@ landing support for EXT_texture_sRGB_decode in command buffer. I added a note to a related bug that's tracking that work, because it also broke Skia's sRGB mipmap testing:

https://bugs.chromium.org/p/chromium/issues/detail?id=655247
Cc: ccameron@chromium.org
Chris: see comment 19-21
See issue 670487 -- I reverted all of the changes.

I've re-landed only r435852 so far, which is just a logic re-organization (and really really should have no effect).
Is this working on TOT now (after r435852)?

Blocking: -429053 -651576 662644
Status: Assigned
I retried this morning and it's still failing.  Since the test never has been tested on Windows before (it's marked as version 2.0.1), so Yizhou, could you please take a look?
tex-srgb-mipmap.html is in WebGL 2.0.1, the bots didn't test it before. So it is not a regression. 

When I fixed the bug for blitFramebuffer for srgb conversion in MacOS, Yizhou fixed this failure on MacOS too, because the implementation is similar. But we didn't look into Windows and Linux at that time. Now the bots begin to test against WebGL 2.0.1, so the failures on Windows/Linux are exposed.

Yizhou is looking into this issue now. After offline discussion with Qiankun and Yizhou, it just need to add some entries into gpu/config/gpu_driver_bug_list_json.cc for Windows and Linux, with some minor revisions based on her original patch at https://codereview.chromium.org/2318313004.
Sounds good.  Thanks for taking care of this.
Project Member Comment 28 by bugdroid1@chromium.org, Dec 5
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6ea4c3f4c102ac86c83a72109496962c660560a9

commit 6ea4c3f4c102ac86c83a72109496962c660560a9
Author: qiankun.miao <qiankun.miao@intel.com>
Date: Mon Dec 05 19:04:54 2016

Update expectation for tex-srgb-mipmap.html on Linux Mesa

It should only fail on Linux Intel with ANGLE.

BUG=634519
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2552623003
Cr-Commit-Position: refs/heads/master@{#436371}

[modify] https://crrev.com/6ea4c3f4c102ac86c83a72109496962c660560a9/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py

Project Member Comment 29 by bugdroid1@chromium.org, Dec 9
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/bc15e2a59cd6f9f124b5b55ee4f14348ab6717ee

commit bc15e2a59cd6f9f124b5b55ee4f14348ab6717ee
Author: yizhou.jiang <yizhou.jiang@intel.com>
Date: Fri Dec 09 01:11:33 2016

Extend more runtime envs for generateMipmap srgb emulation

Add entries for windows, chromeos, and linux mesa in gpu_driver_bug_list.
Generate shaders according to different gl contexts.

BUG=634519

CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2548363002
Cr-Commit-Position: refs/heads/master@{#437398}

[modify] https://crrev.com/bc15e2a59cd6f9f124b5b55ee4f14348ab6717ee/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
[modify] https://crrev.com/bc15e2a59cd6f9f124b5b55ee4f14348ab6717ee/gpu/command_buffer/service/gles2_cmd_decoder.cc
[modify] https://crrev.com/bc15e2a59cd6f9f124b5b55ee4f14348ab6717ee/gpu/command_buffer/service/gles2_cmd_srgb_converter.cc
[modify] https://crrev.com/bc15e2a59cd6f9f124b5b55ee4f14348ab6717ee/gpu/config/gpu_driver_bug_list_json.cc

Project Member Comment 30 by bugdroid1@chromium.org, Dec 9
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/967f5de147c2fcc4fd166d321dae8b472c35d6fc

commit 967f5de147c2fcc4fd166d321dae8b472c35d6fc
Author: qiankun.miao <qiankun.miao@intel.com>
Date: Fri Dec 09 20:29:19 2016

Enable generateMipmap srgb emulation for Linux AMD

BUG=634519
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2564813002
Cr-Commit-Position: refs/heads/master@{#437624}

[modify] https://crrev.com/967f5de147c2fcc4fd166d321dae8b472c35d6fc/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
[modify] https://crrev.com/967f5de147c2fcc4fd166d321dae8b472c35d6fc/gpu/config/gpu_driver_bug_list_json.cc

Comment 31 by kbr@chromium.org, Apr 25 (4 days ago)
Blockedon: 712096
Sign in to add a comment