diff options
author | alexst@chromium.org <alexst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-06 17:16:54 +0000 |
---|---|---|
committer | alexst@chromium.org <alexst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-06 17:16:54 +0000 |
commit | d0eed26269fb7026938db68094e1e30077a044e5 (patch) | |
tree | 2971bd9c2bf6339437c729ea29295ce3a7ee8ce9 /cc | |
parent | 9af439a537208fc73a8b513c6f2440606890ad44 (diff) | |
download | chromium_src-d0eed26269fb7026938db68094e1e30077a044e5.zip chromium_src-d0eed26269fb7026938db68094e1e30077a044e5.tar.gz chromium_src-d0eed26269fb7026938db68094e1e30077a044e5.tar.bz2 |
Rearrange GLImage API to create them with a usage type
instead of using usage type while mapping the buffer.
BUG=
Review URL: https://codereview.chromium.org/255713008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268548 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/resources/raster_worker_pool_perftest.cc | 3 | ||||
-rw-r--r-- | cc/resources/resource_provider.cc | 7 | ||||
-rw-r--r-- | cc/resources/resource_provider_unittest.cc | 18 | ||||
-rw-r--r-- | cc/test/test_gles2_interface.cc | 10 | ||||
-rw-r--r-- | cc/test/test_gles2_interface.h | 5 | ||||
-rw-r--r-- | cc/test/test_web_graphics_context_3d.cc | 10 | ||||
-rw-r--r-- | cc/test/test_web_graphics_context_3d.h | 5 |
7 files changed, 34 insertions, 24 deletions
diff --git a/cc/resources/raster_worker_pool_perftest.cc b/cc/resources/raster_worker_pool_perftest.cc index ee3f359..14e4d23 100644 --- a/cc/resources/raster_worker_pool_perftest.cc +++ b/cc/resources/raster_worker_pool_perftest.cc @@ -31,7 +31,8 @@ class PerfGLES2Interface : public gpu::gles2::GLES2InterfaceStub { // Overridden from gpu::gles2::GLES2Interface: virtual GLuint CreateImageCHROMIUM(GLsizei width, GLsizei height, - GLenum internalformat) OVERRIDE { + GLenum internalformat, + GLenum usage) OVERRIDE { return 1u; } virtual void GenBuffers(GLsizei n, GLuint* buffers) OVERRIDE { diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc index 3ce8d63..f410b7a 100644 --- a/cc/resources/resource_provider.cc +++ b/cc/resources/resource_provider.cc @@ -2157,7 +2157,8 @@ void ResourceProvider::AcquireImage(Resource* resource) { resource->image_id = gl->CreateImageCHROMIUM(resource->size.width(), resource->size.height(), - TextureToStorageFormat(resource->format)); + TextureToStorageFormat(resource->format), + GL_IMAGE_MAP_CHROMIUM); DCHECK(resource->image_id); } @@ -2187,8 +2188,8 @@ uint8_t* ResourceProvider::MapImage(const Resource* resource, int* stride) { GLES2Interface* gl = ContextGL(); DCHECK(gl); // MapImageCHROMIUM should be called prior to GetImageParameterivCHROMIUM. - uint8_t* pixels = static_cast<uint8_t*>( - gl->MapImageCHROMIUM(resource->image_id, GL_READ_WRITE)); + uint8_t* pixels = + static_cast<uint8_t*>(gl->MapImageCHROMIUM(resource->image_id)); gl->GetImageParameterivCHROMIUM( resource->image_id, GL_IMAGE_ROWBYTES_CHROMIUM, stride); return pixels; diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc index bffd07e..05b3233 100644 --- a/cc/resources/resource_provider_unittest.cc +++ b/cc/resources/resource_provider_unittest.cc @@ -2609,9 +2609,9 @@ class AllocationTrackingContext3D : public TestWebGraphicsContext3D { GLsizei image_size, const void* data)); MOCK_METHOD1(waitAsyncTexImage2DCHROMIUM, void(GLenum)); - MOCK_METHOD3(createImageCHROMIUM, GLuint(GLsizei, GLsizei, GLenum)); + MOCK_METHOD4(createImageCHROMIUM, GLuint(GLsizei, GLsizei, GLenum, GLenum)); MOCK_METHOD1(destroyImageCHROMIUM, void(GLuint)); - MOCK_METHOD2(mapImageCHROMIUM, void*(GLuint, GLenum)); + MOCK_METHOD1(mapImageCHROMIUM, void*(GLuint)); MOCK_METHOD3(getImageParameterivCHROMIUM, void(GLuint, GLenum, GLint*)); MOCK_METHOD1(unmapImageCHROMIUM, void(GLuint)); MOCK_METHOD2(bindTexImage2DCHROMIUM, void(GLenum, GLint)); @@ -2918,7 +2918,9 @@ TEST_P(ResourceProviderTest, Image_GLTexture) { const int kStride = 4; void* dummy_mapped_buffer_address = NULL; - EXPECT_CALL(*context, createImageCHROMIUM(kWidth, kHeight, GL_RGBA8_OES)) + EXPECT_CALL( + *context, + createImageCHROMIUM(kWidth, kHeight, GL_RGBA8_OES, GL_IMAGE_MAP_CHROMIUM)) .WillOnce(Return(kImageId)) .RetiresOnSaturation(); EXPECT_CALL(*context, getImageParameterivCHROMIUM(kImageId, @@ -2926,7 +2928,7 @@ TEST_P(ResourceProviderTest, Image_GLTexture) { _)) .WillOnce(SetArgPointee<2>(kStride)) .RetiresOnSaturation(); - EXPECT_CALL(*context, mapImageCHROMIUM(kImageId, GL_READ_WRITE)) + EXPECT_CALL(*context, mapImageCHROMIUM(kImageId)) .WillOnce(Return(dummy_mapped_buffer_address)) .RetiresOnSaturation(); resource_provider->MapImageRasterBuffer(id); @@ -2956,7 +2958,7 @@ TEST_P(ResourceProviderTest, Image_GLTexture) { getImageParameterivCHROMIUM(kImageId, GL_IMAGE_ROWBYTES_CHROMIUM, _)) .WillOnce(SetArgPointee<2>(kStride)) .RetiresOnSaturation(); - EXPECT_CALL(*context, mapImageCHROMIUM(kImageId, GL_READ_WRITE)) + EXPECT_CALL(*context, mapImageCHROMIUM(kImageId)) .WillOnce(Return(dummy_mapped_buffer_address)) .RetiresOnSaturation(); resource_provider->MapImageRasterBuffer(id); @@ -3058,7 +3060,9 @@ TEST_P(ResourceProviderTest, CopyResource_GLTexture) { const int kStride = 4; void* dummy_mapped_buffer_address = NULL; - EXPECT_CALL(*context, createImageCHROMIUM(kWidth, kHeight, GL_RGBA8_OES)) + EXPECT_CALL( + *context, + createImageCHROMIUM(kWidth, kHeight, GL_RGBA8_OES, GL_IMAGE_MAP_CHROMIUM)) .WillOnce(Return(kImageId)) .RetiresOnSaturation(); EXPECT_CALL( @@ -3066,7 +3070,7 @@ TEST_P(ResourceProviderTest, CopyResource_GLTexture) { getImageParameterivCHROMIUM(kImageId, GL_IMAGE_ROWBYTES_CHROMIUM, _)) .WillOnce(SetArgPointee<2>(kStride)) .RetiresOnSaturation(); - EXPECT_CALL(*context, mapImageCHROMIUM(kImageId, GL_READ_WRITE)) + EXPECT_CALL(*context, mapImageCHROMIUM(kImageId)) .WillOnce(Return(dummy_mapped_buffer_address)) .RetiresOnSaturation(); resource_provider->MapImageRasterBuffer(source_id); diff --git a/cc/test/test_gles2_interface.cc b/cc/test/test_gles2_interface.cc index 732c8a2..26055ba 100644 --- a/cc/test/test_gles2_interface.cc +++ b/cc/test/test_gles2_interface.cc @@ -275,16 +275,18 @@ void TestGLES2Interface::WaitAsyncTexImage2DCHROMIUM(GLenum target) { GLuint TestGLES2Interface::CreateImageCHROMIUM(GLsizei width, GLsizei height, - GLenum internalformat) { - return test_context_->createImageCHROMIUM(width, height, internalformat); + GLenum internalformat, + GLenum usage) { + return test_context_->createImageCHROMIUM( + width, height, internalformat, usage); } void TestGLES2Interface::DestroyImageCHROMIUM(GLuint image_id) { test_context_->destroyImageCHROMIUM(image_id); } -void* TestGLES2Interface::MapImageCHROMIUM(GLuint image_id, GLenum access) { - return test_context_->mapImageCHROMIUM(image_id, access); +void* TestGLES2Interface::MapImageCHROMIUM(GLuint image_id) { + return test_context_->mapImageCHROMIUM(image_id); } void TestGLES2Interface::GetImageParameterivCHROMIUM(GLuint image_id, diff --git a/cc/test/test_gles2_interface.h b/cc/test/test_gles2_interface.h index a52d73e..417bf4a 100644 --- a/cc/test/test_gles2_interface.h +++ b/cc/test/test_gles2_interface.h @@ -126,9 +126,10 @@ class TestGLES2Interface : public gpu::gles2::GLES2InterfaceStub { virtual void WaitAsyncTexImage2DCHROMIUM(GLenum target) OVERRIDE; virtual GLuint CreateImageCHROMIUM(GLsizei width, GLsizei height, - GLenum internalformat) OVERRIDE; + GLenum internalformat, + GLenum usage) OVERRIDE; virtual void DestroyImageCHROMIUM(GLuint image_id) OVERRIDE; - virtual void* MapImageCHROMIUM(GLuint image_id, GLenum access) OVERRIDE; + virtual void* MapImageCHROMIUM(GLuint image_id) OVERRIDE; virtual void GetImageParameterivCHROMIUM(GLuint image_id, GLenum pname, GLint* params) OVERRIDE; diff --git a/cc/test/test_web_graphics_context_3d.cc b/cc/test/test_web_graphics_context_3d.cc index 59b7440..7d03c38 100644 --- a/cc/test/test_web_graphics_context_3d.cc +++ b/cc/test/test_web_graphics_context_3d.cc @@ -539,9 +539,10 @@ GLboolean TestWebGraphicsContext3D::unmapBufferCHROMIUM( return true; } -GLuint TestWebGraphicsContext3D::createImageCHROMIUM( - GLsizei width, GLsizei height, - GLenum internalformat) { +GLuint TestWebGraphicsContext3D::createImageCHROMIUM(GLsizei width, + GLsizei height, + GLenum internalformat, + GLenum usage) { DCHECK_EQ(GL_RGBA8_OES, static_cast<int>(internalformat)); GLuint image_id = NextImageId(); base::AutoLock lock(namespace_->lock); @@ -566,8 +567,7 @@ void TestWebGraphicsContext3D::getImageParameterivCHROMIUM( *params = 0; } -void* TestWebGraphicsContext3D::mapImageCHROMIUM(GLuint image_id, - GLenum access) { +void* TestWebGraphicsContext3D::mapImageCHROMIUM(GLuint image_id) { base::AutoLock lock(namespace_->lock); base::ScopedPtrHashMap<unsigned, Image>& images = namespace_->images; DCHECK_GT(images.count(image_id), 0u); diff --git a/cc/test/test_web_graphics_context_3d.h b/cc/test/test_web_graphics_context_3d.h index 56ffc85..ae32a27 100644 --- a/cc/test/test_web_graphics_context_3d.h +++ b/cc/test/test_web_graphics_context_3d.h @@ -234,12 +234,13 @@ class TestWebGraphicsContext3D { virtual GLuint createImageCHROMIUM(GLsizei width, GLsizei height, - GLenum internalformat); + GLenum internalformat, + GLenum usage); virtual void destroyImageCHROMIUM(GLuint image_id); virtual void getImageParameterivCHROMIUM(GLuint image_id, GLenum pname, GLint* params); - virtual void* mapImageCHROMIUM(GLuint image_id, GLenum access); + virtual void* mapImageCHROMIUM(GLuint image_id); virtual void unmapImageCHROMIUM(GLuint image_id); virtual void texImageIOSurface2DCHROMIUM(GLenum target, GLsizei width, |