Use shared image API in cc unit tests
The legacy mailbox API is deprecated and it only works with GL backend. So switch to the new shared image API. Bug: 971257 Change-Id: Ia35d656d4d630af6815718f6293cb31b92b11796 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2985979 Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org> Commit-Queue: Peng Huang <penghuang@chromium.org> Cr-Commit-Position: refs/heads/master@{#895761}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
1319400fa4
commit
f0c0b69b39
cc
@ -23,6 +23,7 @@
|
||||
#include "cc/test/pixel_test_utils.h"
|
||||
#include "cc/tiles/gpu_image_decode_cache.h"
|
||||
#include "components/viz/test/test_in_process_context_provider.h"
|
||||
#include "gpu/GLES2/gl2extchromium.h"
|
||||
#include "gpu/command_buffer/client/gles2_implementation.h"
|
||||
#include "gpu/command_buffer/client/gles2_interface.h"
|
||||
#include "gpu/command_buffer/client/raster_implementation.h"
|
||||
@ -227,7 +228,10 @@ class OopPixelTest : public testing::Test,
|
||||
const gpu::Mailbox& mailbox,
|
||||
const RasterOptions& options) {
|
||||
// Import the texture in gl, create an fbo and bind the texture to it.
|
||||
GLuint gl_texture_id = gl->CreateAndConsumeTextureCHROMIUM(mailbox.name);
|
||||
GLuint gl_texture_id =
|
||||
gl->CreateAndTexStorage2DSharedImageCHROMIUM(mailbox.name);
|
||||
gl->BeginSharedImageAccessDirectCHROMIUM(
|
||||
gl_texture_id, GL_SHARED_IMAGE_ACCESS_MODE_READ_CHROMIUM);
|
||||
GLuint fbo_id;
|
||||
gl->GenFramebuffers(1, &fbo_id);
|
||||
gl->BindFramebuffer(GL_FRAMEBUFFER, fbo_id);
|
||||
@ -241,9 +245,11 @@ class OopPixelTest : public testing::Test,
|
||||
new unsigned char[width * height * 4]);
|
||||
gl->ReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data.get());
|
||||
|
||||
gl->DeleteTextures(1, &gl_texture_id);
|
||||
gl->DeleteFramebuffers(1, &fbo_id);
|
||||
|
||||
gl->EndSharedImageAccessDirectCHROMIUM(gl_texture_id);
|
||||
gl->DeleteTextures(1, &gl_texture_id);
|
||||
|
||||
// Swizzle rgba->bgra
|
||||
std::vector<SkPMColor> colors;
|
||||
colors.reserve(width * height);
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "components/viz/test/paths.h"
|
||||
#include "components/viz/test/test_gpu_service_holder.h"
|
||||
#include "components/viz/test/test_in_process_context_provider.h"
|
||||
#include "gpu/GLES2/gl2extchromium.h"
|
||||
#include "gpu/command_buffer/client/gles2_implementation.h"
|
||||
#include "gpu/ipc/gl_in_process_context.h"
|
||||
|
||||
@ -373,7 +374,10 @@ SkBitmap LayerTreePixelTest::CopyMailboxToBitmap(
|
||||
if (sync_token.HasData())
|
||||
gl->WaitSyncTokenCHROMIUM(sync_token.GetConstData());
|
||||
|
||||
GLuint texture_id = gl->CreateAndConsumeTextureCHROMIUM(mailbox.name);
|
||||
GLuint texture_id =
|
||||
gl->CreateAndTexStorage2DSharedImageCHROMIUM(mailbox.name);
|
||||
gl->BeginSharedImageAccessDirectCHROMIUM(
|
||||
texture_id, GL_SHARED_IMAGE_ACCESS_MODE_READ_CHROMIUM);
|
||||
|
||||
GLuint fbo = 0;
|
||||
gl->GenFramebuffers(1, &fbo);
|
||||
@ -393,6 +397,7 @@ SkBitmap LayerTreePixelTest::CopyMailboxToBitmap(
|
||||
pixels.get());
|
||||
|
||||
gl->DeleteFramebuffers(1, &fbo);
|
||||
gl->EndSharedImageAccessDirectCHROMIUM(texture_id);
|
||||
gl->DeleteTextures(1, &texture_id);
|
||||
|
||||
EXPECT_TRUE(color_space.IsValid());
|
||||
|
Reference in New Issue
Block a user