Skip to content

Commit

Permalink
Remove unused ProduceRGBEmulationGLTexture calls with its usage.
Browse files Browse the repository at this point in the history
SHARED_IMAGE_USAGE_RGB_EMULATION is no longer used and can be removed.
Accordingly SharedImageBacking::ProduceRGBMEmulationGLTexture can
also be removed. This CL does that cleanup along with some removing
internal_format from GLES2 decoder.

Bug: 1358957
Change-Id: Ic66cda83c5e013aec6c5a6f9bc5809b150df478f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3876293
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1046385}
  • Loading branch information
Saifuddin Hitawala authored and Chromium LUCI CQ committed Sep 13, 2022
1 parent 444299f commit 8f9fe04
Show file tree
Hide file tree
Showing 39 changed files with 45 additions and 388 deletions.
18 changes: 0 additions & 18 deletions gpu/GLES2/extensions/CHROMIUM/CHROMIUM_shared_image.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,6 @@ New Procedures and Functions
texture object. In this case the new texture name remains unbound. It is
treated in the same way as a new texture name returned by GenTextures.

The command

GLuint glCreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM (
const GLbyte *mailbox,
GLenum internal_format)

takes two arguments:

internal_format - Must match the internal format of the SharedImage at
creation time, with the exception that a caller may pass GL_RGB or
GL_RGBA for a SharedImage created as RGBA_8888.

mailbox - the mailbox referring to the SharedImage to assign to the
first level of the mailbox.

This function works similar to glCreateAndTexStorage2DSharedImageCHROMIUM
in other respects.

The command

void glBeginSharedImageAccessDirectCHROMIUM (GLuint texture,
Expand Down
2 changes: 0 additions & 2 deletions gpu/GLES2/gl2chromium_autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,6 @@
#define glMaxShaderCompilerThreadsKHR GLES2_GET_FUN(MaxShaderCompilerThreadsKHR)
#define glCreateAndTexStorage2DSharedImageCHROMIUM \
GLES2_GET_FUN(CreateAndTexStorage2DSharedImageCHROMIUM)
#define glCreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM \
GLES2_GET_FUN(CreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM)
#define glBeginSharedImageAccessDirectCHROMIUM \
GLES2_GET_FUN(BeginSharedImageAccessDirectCHROMIUM)
#define glEndSharedImageAccessDirectCHROMIUM \
Expand Down
5 changes: 0 additions & 5 deletions gpu/command_buffer/build_gles2_cmd_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4022,11 +4022,6 @@
'extension': "CHROMIUM_shared_image",
'trace_level': 2,
},
'CreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM': {
'type': 'NoCommand',
'extension': "CHROMIUM_shared_image",
'trace_level': 2,
},
'CreateAndTexStorage2DSharedImageINTERNAL': {
'decoder_func': 'DoCreateAndTexStorage2DSharedImageINTERNAL',
'internal': True,
Expand Down
13 changes: 0 additions & 13 deletions gpu/command_buffer/client/gles2_c_lib_autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -1650,14 +1650,6 @@ GLES2CreateAndTexStorage2DSharedImageCHROMIUM(const GLbyte* mailbox) {
return gles2::GetGLContext()->CreateAndTexStorage2DSharedImageCHROMIUM(
mailbox);
}
GLuint GL_APIENTRY
GLES2CreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM(
const GLbyte* mailbox,
GLenum internalformat) {
return gles2::GetGLContext()
->CreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM(
mailbox, internalformat);
}
void GL_APIENTRY GLES2BeginSharedImageAccessDirectCHROMIUM(GLuint texture,
GLenum mode) {
gles2::GetGLContext()->BeginSharedImageAccessDirectCHROMIUM(texture, mode);
Expand Down Expand Up @@ -3034,11 +3026,6 @@ extern const NameToFunc g_gles2_function_table[] = {
reinterpret_cast<GLES2FunctionPointer>(
glCreateAndTexStorage2DSharedImageCHROMIUM),
},
{
"glCreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM",
reinterpret_cast<GLES2FunctionPointer>(
glCreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM),
},
{
"glBeginSharedImageAccessDirectCHROMIUM",
reinterpret_cast<GLES2FunctionPointer>(
Expand Down
3 changes: 1 addition & 2 deletions gpu/command_buffer/client/gles2_cmd_helper_autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -3145,15 +3145,14 @@ void MaxShaderCompilerThreadsKHR(GLuint count) {
}

void CreateAndTexStorage2DSharedImageINTERNALImmediate(GLuint texture,
GLenum internalformat,
const GLbyte* mailbox) {
const uint32_t size = gles2::cmds::
CreateAndTexStorage2DSharedImageINTERNALImmediate::ComputeSize();
gles2::cmds::CreateAndTexStorage2DSharedImageINTERNALImmediate* c =
GetImmediateCmdSpaceTotalSize<
gles2::cmds::CreateAndTexStorage2DSharedImageINTERNALImmediate>(size);
if (c) {
c->Init(texture, internalformat, mailbox);
c->Init(texture, mailbox);
}
}

Expand Down
27 changes: 1 addition & 26 deletions gpu/command_buffer/client/gles2_implementation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6682,39 +6682,14 @@ GLuint GLES2Implementation::CreateAndTexStorage2DSharedImageCHROMIUM(
DCHECK(mailbox.IsSharedImage());
GLuint client_id;
GetIdHandler(SharedIdNamespaces::kTextures)->MakeIds(this, 0, 1, &client_id);
helper_->CreateAndTexStorage2DSharedImageINTERNALImmediate(client_id, GL_NONE,
helper_->CreateAndTexStorage2DSharedImageINTERNALImmediate(client_id,
mailbox_data);
if (share_group_->bind_generates_resource())
helper_->CommandBufferHelper::OrderingBarrier();
CheckGLError();
return client_id;
}

GLuint
GLES2Implementation::CreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM(
const GLbyte* mailbox_data,
GLenum internalformat) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG(
"[" << GetLogPrefix()
<< "] CreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM("
<< static_cast<const void*>(mailbox_data) << ", " << internalformat
<< ")");
const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(mailbox_data);
DCHECK(mailbox.Verify())
<< "CreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM was "
"passed an invalid mailbox.";
DCHECK(mailbox.IsSharedImage());
GLuint client_id;
GetIdHandler(SharedIdNamespaces::kTextures)->MakeIds(this, 0, 1, &client_id);
helper_->CreateAndTexStorage2DSharedImageINTERNALImmediate(
client_id, internalformat, mailbox_data);
if (share_group_->bind_generates_resource())
helper_->CommandBufferHelper::OrderingBarrier();
CheckGLError();
return client_id;
}

void GLES2Implementation::PushGroupMarkerEXT(GLsizei length,
const GLchar* marker) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
Expand Down
4 changes: 0 additions & 4 deletions gpu/command_buffer/client/gles2_implementation_autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -1159,10 +1159,6 @@ void MaxShaderCompilerThreadsKHR(GLuint count) override;

GLuint CreateAndTexStorage2DSharedImageCHROMIUM(const GLbyte* mailbox) override;

GLuint CreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM(
const GLbyte* mailbox,
GLenum internalformat) override;

void BeginSharedImageAccessDirectCHROMIUM(GLuint texture, GLenum mode) override;

void EndSharedImageAccessDirectCHROMIUM(GLuint texture) override;
Expand Down
19 changes: 1 addition & 18 deletions gpu/command_buffer/client/gles2_implementation_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3613,29 +3613,12 @@ TEST_F(GLES2ImplementationTest, CreateAndTexStorage2DSharedImageCHROMIUM) {

Mailbox mailbox = Mailbox::GenerateForSharedImage();
Cmds expected;
expected.cmd.Init(kTexturesStartId, GL_NONE, mailbox.name);
expected.cmd.Init(kTexturesStartId, mailbox.name);
GLuint id = gl_->CreateAndTexStorage2DSharedImageCHROMIUM(mailbox.name);
EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
EXPECT_EQ(kTexturesStartId, id);
}

TEST_F(GLES2ImplementationTest,
CreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM) {
struct Cmds {
cmds::CreateAndTexStorage2DSharedImageINTERNALImmediate cmd;
GLbyte data[GL_MAILBOX_SIZE_CHROMIUM];
};

Mailbox mailbox = Mailbox::GenerateForSharedImage();
const GLenum kFormat = GL_RGBA;
Cmds expected;
expected.cmd.Init(kTexturesStartId, kFormat, mailbox.name);
GLuint id = gl_->CreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM(
mailbox.name, kFormat);
EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
EXPECT_EQ(kTexturesStartId, id);
}

TEST_F(GLES2ImplementationTest, ProduceTextureDirectCHROMIUM) {
struct Cmds {
cmds::ProduceTextureDirectCHROMIUMImmediate cmd;
Expand Down
3 changes: 0 additions & 3 deletions gpu/command_buffer/client/gles2_interface_autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -858,9 +858,6 @@ virtual void FramebufferTextureMultiviewOVR(GLenum target,
virtual void MaxShaderCompilerThreadsKHR(GLuint count) = 0;
virtual GLuint CreateAndTexStorage2DSharedImageCHROMIUM(
const GLbyte* mailbox) = 0;
virtual GLuint CreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM(
const GLbyte* mailbox,
GLenum internalformat) = 0;
virtual void BeginSharedImageAccessDirectCHROMIUM(GLuint texture,
GLenum mode) = 0;
virtual void EndSharedImageAccessDirectCHROMIUM(GLuint texture) = 0;
Expand Down
3 changes: 0 additions & 3 deletions gpu/command_buffer/client/gles2_interface_stub_autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -831,9 +831,6 @@ void FramebufferTextureMultiviewOVR(GLenum target,
GLsizei numViews) override;
void MaxShaderCompilerThreadsKHR(GLuint count) override;
GLuint CreateAndTexStorage2DSharedImageCHROMIUM(const GLbyte* mailbox) override;
GLuint CreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM(
const GLbyte* mailbox,
GLenum internalformat) override;
void BeginSharedImageAccessDirectCHROMIUM(GLuint texture, GLenum mode) override;
void EndSharedImageAccessDirectCHROMIUM(GLuint texture) override;
void EnableiOES(GLenum target, GLuint index) override;
Expand Down
6 changes: 0 additions & 6 deletions gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -1126,12 +1126,6 @@ GLuint GLES2InterfaceStub::CreateAndTexStorage2DSharedImageCHROMIUM(
const GLbyte* /* mailbox */) {
return 0;
}
GLuint
GLES2InterfaceStub::CreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM(
const GLbyte* /* mailbox */,
GLenum /* internalformat */) {
return 0;
}
void GLES2InterfaceStub::BeginSharedImageAccessDirectCHROMIUM(
GLuint /* texture */,
GLenum /* mode */) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,9 +831,6 @@ void FramebufferTextureMultiviewOVR(GLenum target,
GLsizei numViews) override;
void MaxShaderCompilerThreadsKHR(GLuint count) override;
GLuint CreateAndTexStorage2DSharedImageCHROMIUM(const GLbyte* mailbox) override;
GLuint CreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM(
const GLbyte* mailbox,
GLenum internalformat) override;
void BeginSharedImageAccessDirectCHROMIUM(GLuint texture, GLenum mode) override;
void EndSharedImageAccessDirectCHROMIUM(GLuint texture) override;
void EnableiOES(GLenum target, GLuint index) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2397,17 +2397,6 @@ GLuint GLES2TraceImplementation::CreateAndTexStorage2DSharedImageCHROMIUM(
return gl_->CreateAndTexStorage2DSharedImageCHROMIUM(mailbox);
}

GLuint GLES2TraceImplementation::
CreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM(
const GLbyte* mailbox,
GLenum internalformat) {
TRACE_EVENT_BINARY_EFFICIENT0(
"gpu",
"GLES2Trace::CreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM");
return gl_->CreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM(
mailbox, internalformat);
}

void GLES2TraceImplementation::BeginSharedImageAccessDirectCHROMIUM(
GLuint texture,
GLenum mode) {
Expand Down
19 changes: 5 additions & 14 deletions gpu/command_buffer/common/gles2_cmd_format_autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -15506,30 +15506,25 @@ struct CreateAndTexStorage2DSharedImageINTERNALImmediate {

void SetHeader() { header.SetCmdByTotalSize<ValueType>(ComputeSize()); }

void Init(GLuint _texture, GLenum _internalformat, const GLbyte* _mailbox) {
void Init(GLuint _texture, const GLbyte* _mailbox) {
SetHeader();
texture = _texture;
internalformat = _internalformat;
memcpy(ImmediateDataAddress(this), _mailbox, ComputeDataSize());
}

void* Set(void* cmd,
GLuint _texture,
GLenum _internalformat,
const GLbyte* _mailbox) {
static_cast<ValueType*>(cmd)->Init(_texture, _internalformat, _mailbox);
void* Set(void* cmd, GLuint _texture, const GLbyte* _mailbox) {
static_cast<ValueType*>(cmd)->Init(_texture, _mailbox);
const uint32_t size = ComputeSize();
return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size);
}

gpu::CommandHeader header;
uint32_t texture;
uint32_t internalformat;
};

static_assert(
sizeof(CreateAndTexStorage2DSharedImageINTERNALImmediate) == 12,
"size of CreateAndTexStorage2DSharedImageINTERNALImmediate should be 12");
sizeof(CreateAndTexStorage2DSharedImageINTERNALImmediate) == 8,
"size of CreateAndTexStorage2DSharedImageINTERNALImmediate should be 8");
static_assert(offsetof(CreateAndTexStorage2DSharedImageINTERNALImmediate,
header) == 0,
"offset of CreateAndTexStorage2DSharedImageINTERNALImmediate "
Expand All @@ -15538,10 +15533,6 @@ static_assert(offsetof(CreateAndTexStorage2DSharedImageINTERNALImmediate,
texture) == 4,
"offset of CreateAndTexStorage2DSharedImageINTERNALImmediate "
"texture should be 4");
static_assert(offsetof(CreateAndTexStorage2DSharedImageINTERNALImmediate,
internalformat) == 8,
"offset of CreateAndTexStorage2DSharedImageINTERNALImmediate "
"internalformat should be 8");

struct BeginSharedImageAccessDirectCHROMIUM {
typedef BeginSharedImageAccessDirectCHROMIUM ValueType;
Expand Down
4 changes: 1 addition & 3 deletions gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -5144,16 +5144,14 @@ TEST_F(GLES2FormatTest, CreateAndTexStorage2DSharedImageINTERNALImmediate) {
};
cmds::CreateAndTexStorage2DSharedImageINTERNALImmediate& cmd =
*GetBufferAs<cmds::CreateAndTexStorage2DSharedImageINTERNALImmediate>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12), data);
void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11), data);
EXPECT_EQ(
static_cast<uint32_t>(
cmds::CreateAndTexStorage2DSharedImageINTERNALImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.texture);
EXPECT_EQ(static_cast<GLenum>(12), cmd.internalformat);
CheckBytesWrittenMatchesExpectedSize(
next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
}
Expand Down
3 changes: 0 additions & 3 deletions gpu/command_buffer/common/shared_image_usage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ std::string CreateLabelForSharedImageUsage(uint32_t usage) {
if (usage & SHARED_IMAGE_USAGE_OOP_RASTERIZATION) {
label += "|OopRasterization";
}
if (usage & SHARED_IMAGE_USAGE_RGB_EMULATION) {
label += "|RgbEmulation";
}
if (usage & SHARED_IMAGE_USAGE_WEBGPU) {
label += "|Webgpu";
}
Expand Down
26 changes: 12 additions & 14 deletions gpu/command_buffer/common/shared_image_usage.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,37 +30,35 @@ enum SharedImageUsage : uint32_t {
// RasterInterface for OOP rasterization. TODO(backer): Eliminate once we can
// CPU raster to SkImage via RasterInterface.
SHARED_IMAGE_USAGE_OOP_RASTERIZATION = 1 << 5,
// Image will be used for RGB emulation in WebGL on Mac.
SHARED_IMAGE_USAGE_RGB_EMULATION = 1 << 6,
// Image will be used by Dawn (for WebGPU)
SHARED_IMAGE_USAGE_WEBGPU = 1 << 7,
SHARED_IMAGE_USAGE_WEBGPU = 1 << 6,
// Image will be used in a protected Vulkan context on Fuchsia.
SHARED_IMAGE_USAGE_PROTECTED = 1 << 8,
SHARED_IMAGE_USAGE_PROTECTED = 1 << 7,
// Image may use concurrent read/write access. Used by single buffered canvas.
// TODO(crbug.com/969114): This usage is currently not supported in GL/Vulkan
// interop cases.
SHARED_IMAGE_USAGE_CONCURRENT_READ_WRITE = 1 << 9,
SHARED_IMAGE_USAGE_CONCURRENT_READ_WRITE = 1 << 8,
// Image will be used for video decode acceleration on Chrome OS.
SHARED_IMAGE_USAGE_VIDEO_DECODE = 1 << 10,
SHARED_IMAGE_USAGE_VIDEO_DECODE = 1 << 9,
// Image will be used as a WebGPU swapbuffer
SHARED_IMAGE_USAGE_WEBGPU_SWAP_CHAIN_TEXTURE = 1 << 11,
SHARED_IMAGE_USAGE_WEBGPU_SWAP_CHAIN_TEXTURE = 1 << 10,
// Image will be used by VideoToolbox on macOS. If this is set, then
// GLImage::DisableInUseByWindowServer should be called on any GLImages that
// use this SharedImage.
SHARED_IMAGE_USAGE_MACOS_VIDEO_TOOLBOX = 1 << 12,
SHARED_IMAGE_USAGE_MACOS_VIDEO_TOOLBOX = 1 << 11,
// Image will be used with mipmap enabled
SHARED_IMAGE_USAGE_MIPMAP = 1 << 13,
SHARED_IMAGE_USAGE_MIPMAP = 1 << 12,
// Image will be used for CPU Writes by client
SHARED_IMAGE_USAGE_CPU_WRITE = 1 << 14,
SHARED_IMAGE_USAGE_CPU_WRITE = 1 << 13,
// Image will be used in RasterInterface with RawDraw.
SHARED_IMAGE_USAGE_RAW_DRAW = 1 << 15,
SHARED_IMAGE_USAGE_RAW_DRAW = 1 << 14,
// Image will be used in RasterInterface for DelegatedCompositing.
// TODO(crbug.com/1254033): this usage shall be removed after cc is able to
// set a single (duplicated) fence for bunch of tiles instead of having the SI
// framework creating fences for each single message when write access ends.
SHARED_IMAGE_USAGE_RASTER_DELEGATED_COMPOSITING = 1 << 16,
SHARED_IMAGE_USAGE_RASTER_DELEGATED_COMPOSITING = 1 << 15,
// Image will be created on the high performance GPU if supported.
SHARED_IMAGE_USAGE_HIGH_PERFORMANCE_GPU = 1 << 17,
SHARED_IMAGE_USAGE_HIGH_PERFORMANCE_GPU = 1 << 16,

// Start service side only usage flags after this entry. They must be larger
// than `LAST_CLIENT_USAGE`.
Expand All @@ -69,7 +67,7 @@ enum SharedImageUsage : uint32_t {
// Image will have pixels uploaded from CPU. The backing must implement
// `UploadFromMemory()` if it supports this usage. Clients should specify
// SHARED_IMAGE_USAGE_CPU_WRITE if they need to write pixels to the image.
SHARED_IMAGE_USAGE_CPU_UPLOAD = 1 << 18,
SHARED_IMAGE_USAGE_CPU_UPLOAD = 1 << 17,
};

// Returns true if usage is a valid client usage.
Expand Down
3 changes: 1 addition & 2 deletions gpu/command_buffer/gles2_cmd_buffer_functions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,7 @@ GL_APICALL void GL_APIENTRY glMaxShaderCompilerThreadsKHR (GLuint count)

// Extension CHROMIUM_shared_image
GL_APICALL GLuint GL_APIENTRY glCreateAndTexStorage2DSharedImageCHROMIUM (const GLbyte* mailbox);
GL_APICALL GLuint GL_APIENTRY glCreateAndTexStorage2DSharedImageWithInternalFormatCHROMIUM (const GLbyte* mailbox, GLenum internalformat);
GL_APICALL void GL_APIENTRY glCreateAndTexStorage2DSharedImageINTERNAL (GLuint texture, GLenum internalformat, const GLbyte* mailbox);
GL_APICALL void GL_APIENTRY glCreateAndTexStorage2DSharedImageINTERNAL (GLuint texture, const GLbyte* mailbox);
GL_APICALL void GL_APIENTRY glBeginSharedImageAccessDirectCHROMIUM (GLuint texture, GLenumSharedImageAccessMode mode);
GL_APICALL void GL_APIENTRY glEndSharedImageAccessDirectCHROMIUM (GLuint texture);

Expand Down
Loading

0 comments on commit 8f9fe04

Please sign in to comment.