forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add UnpremultiplyAndDitherCopyCHROMIUM extension
This change adds a new GL command (intended for use via the RasterInterface) which copies data from a normal-bit-depth (8888) texture to a low-bit-depth (4444) texture, performing an unpremultiply and a dither in the process. This is a pretty special-case extension designed to address the speicific issues that: - GPU raster output is currently not dithered, leading to banding in some cases - Dithering premultiplied output does not alleviate all banding. - Storing premultiplied ouptut in 4444 textures can lead to artifacts even if dithered. This extension will be used when Chrome rasterizes to 4444 textures on low-end devices. To achieve this behavior, we add a "dither" parameter to the CopyTextureCHROMIUMResourceManager, allowing it to perform a dither while copying. The new extension leverages this existing class. The actual dither code is the same logic used internally in Skia, and has been tested there for performance. The only difference is that in our case we dither alpha as well. Bug: 789153 Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;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 Change-Id: Ibce954f90eb7c461e127c5eb8bcf3ad9799bfe20 Reviewed-on: https://chromium-review.googlesource.com/899664 Commit-Queue: Eric Karl <ericrk@chromium.org> Reviewed-by: Will Harris <wfh@chromium.org> Reviewed-by: Antoine Labour <piman@chromium.org> Cr-Commit-Position: refs/heads/master@{#537884}
- Loading branch information
Eric Karl
authored and
Commit Bot
committed
Feb 20, 2018
1 parent
729d39e
commit 0d482c5
Showing
43 changed files
with
996 additions
and
139 deletions.
There are no files selected for viewing
89 changes: 89 additions & 0 deletions
89
gpu/GLES2/extensions/CHROMIUM/CHROMIUM_unpremultiply_and_dither_copy.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
Name | ||
|
||
CHROMIUM_unpremultiply_and_dither_copy | ||
|
||
Name Strings | ||
|
||
GL_CHROMIUM_unpremultiply_and_dither_copy | ||
|
||
Version | ||
|
||
Last Modifed Date: Feb 01, 2018 | ||
|
||
Dependencies | ||
|
||
OpenGL ES 2.0 or OpenGL ES 3.0 is required. | ||
|
||
EXT_texture_format_BGRA8888 affects the definition of this extension. | ||
|
||
Overview | ||
|
||
This extension performs a copy from one texture to a second texture, | ||
unpremultiplying and dithering the texture in the process. Additionally, | ||
it allows a subrect to be specified for the copy. | ||
|
||
Both textures: | ||
- Must be the same size | ||
- Have the same subrect | ||
|
||
The source texture: | ||
- Must be RGBA. If EXT_texture_format_BGRA8888 or GLES3 is available, | ||
the texture may be BGRA | ||
- Will have data copied from level 0 | ||
|
||
The dest texture: | ||
- Must be RGBA | ||
- Must have type GL_UNSIGNED_SHORT_4_4_4_4 | ||
- Will have data copied to level 0 | ||
|
||
In addition to the above, this extension inherits all source/dest | ||
limitations from CHROMIUM_copy_texture. | ||
|
||
New Procedures and Functions | ||
|
||
void UnpremultiplyAndDitherCopyCHROMIUM(uint sourceId, | ||
uint destId, | ||
int x, | ||
int y, | ||
sizei width, | ||
sizei height) | ||
|
||
Additions to the OpenGL ES 2.0 Specification | ||
|
||
The command | ||
|
||
UnpremultiplyAndDitherCopyCHROMIUM | ||
|
||
Copies the contents of level 0 of <sourceId> texture to level 0 and of | ||
<destId> texture, performing an unpremultiply and dither during the copy. | ||
|
||
<destId> must be initialized and have: | ||
- a target of TEXTURE_2D, TEXTURE_RECTANGLE_ARB. | ||
- a format of GL_RGBA, or GL_BGRA if EXT_texture_format_BGRA8888 | ||
or GLES3 is available. | ||
- a data type of GL_UNSIGNED_SHORT_4_4_4_4. | ||
|
||
<sourceId> must be initialized and have: | ||
- a target of TEXTURE_2D, TEXTURE_RECTANGLE_ARB, TEXTURE_EXTERNAL_OES. | ||
- a format of GL_RGBA, or GL_BGRA if EXT_texture_format_BGRA8888 | ||
or GLES3 is available. | ||
|
||
INVALID_OPERATION is generated if any of the above requirements is not met, | ||
or if the source / dest combination violates any requirements of | ||
CHROMIUM_copy_texture. | ||
|
||
Errors | ||
|
||
None. | ||
|
||
New Tokens | ||
|
||
None. | ||
|
||
New State | ||
|
||
None. | ||
|
||
Revision History | ||
|
||
02/01/2018 Documented the extension |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.