diff options
author | skyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-04 12:18:30 +0000 |
---|---|---|
committer | skyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-04 12:18:30 +0000 |
commit | d1a56f05be296acedfab104659f042395804c0b2 (patch) | |
tree | 0f6f04d4e736c79080ade2db6722045b014274ab /cc/resource_provider.h | |
parent | 364aaef8112e73e370b759e7a45bb0bd6164ada1 (diff) | |
download | chromium_src-d1a56f05be296acedfab104659f042395804c0b2.zip chromium_src-d1a56f05be296acedfab104659f042395804c0b2.tar.gz chromium_src-d1a56f05be296acedfab104659f042395804c0b2.tar.bz2 |
Use nearest neighbor filtering for non-translated quads
Draw tiled layer quads that only have a translation transformation
component using nearest neighbor filtering instead of bilinear
filtering. This has two advantages:
1. On some GPUs this can reduce memory bandwidth usage due to increased
texture cache hit rate.
2. Linear filtering is known to give slightly different results on
different GPUs because of differences in the texture sampling
hardware. Avoiding bilinear filtering in the common case (i.e., when
CSS transformation aren't used) makes WebKit layout test pixel dumps
better comparable across different devices.
TEST=ResourceProviderTest.ScopedSampler, GLRendererTest2.activeTextureState, manual testing with composited websites.
BUG=
Review URL: https://chromiumcodereview.appspot.com/11358181
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170944 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/resource_provider.h')
-rw-r--r-- | cc/resource_provider.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/cc/resource_provider.h b/cc/resource_provider.h index 3d7b208..ba68863 100644 --- a/cc/resource_provider.h +++ b/cc/resource_provider.h @@ -132,6 +132,11 @@ public: // will wait on it. void receiveFromParent(const TransferableResourceList&); + // Bind the given GL resource to a texture target for sampling using the + // specified filter for both minification and magnification. The resource + // must be locked for reading. + void bindForSampling(ResourceProvider::ResourceId, GLenum target, GLenum filter); + // The following lock classes are part of the ResourceProvider API and are // needed to read and write the resource contents. The user must ensure // that they only use GL locks on GL resources, etc, and this is enforced @@ -151,6 +156,14 @@ public: DISALLOW_COPY_AND_ASSIGN(ScopedReadLockGL); }; + class CC_EXPORT ScopedSamplerGL : public ScopedReadLockGL { + public: + ScopedSamplerGL(ResourceProvider*, ResourceProvider::ResourceId, GLenum target, GLenum filter); + + private: + DISALLOW_COPY_AND_ASSIGN(ScopedSamplerGL); + }; + class CC_EXPORT ScopedWriteLockGL { public: ScopedWriteLockGL(ResourceProvider*, ResourceProvider::ResourceId); @@ -212,8 +225,8 @@ public: private: struct Resource { Resource(); - Resource(unsigned textureId, int pool, const gfx::Size& size, GLenum format); - Resource(uint8_t* pixels, int pool, const gfx::Size& size, GLenum format); + Resource(unsigned textureId, int pool, const gfx::Size& size, GLenum format, GLenum filter); + Resource(uint8_t* pixels, int pool, const gfx::Size& size, GLenum format, GLenum filter); unsigned glId; // Pixel buffer used for set pixels without unnecessary copying. @@ -229,6 +242,8 @@ private: bool markedForDeletion; gfx::Size size; GLenum format; + // TODO(skyostil): Use a separate sampler object for filter state. + GLenum filter; ResourceType type; }; typedef base::hash_map<ResourceId, Resource> ResourceMap; |