Commit ae9ed7cd authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

[jumbo] Rename one of the HasAlpha functions in DXGI code

In jumbo builds many files are compiled together in the same
translation unit, and there share the same anonymous namespace.
By copying functions from gl_image_dxgi.cc into
gl_image_gxgi_swap_chain.cc without changing the function names
jumbo builds got collisions between two HasAlpha and two
SupportedBindFormat. Since they are also slightly modified,
reusing the function is not a direction option so this renames
the new set of functions by adding a SwapChain prefix.

TBR=piman@chromium.org,ashithasantosh@google.com

Bug: 939655
Change-Id: I3190aa8cbb3c87b0be8be821298a67906be0abd2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1594581Reviewed-by: default avatarDaniel Bratell <bratell@opera.com>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#656372}
parent eda1de83
......@@ -16,7 +16,7 @@ namespace gl {
namespace {
bool SupportedBindFormat(gfx::BufferFormat format) {
bool SwapChainSupportedBindFormat(gfx::BufferFormat format) {
switch (format) {
case gfx::BufferFormat::RGBA_8888:
case gfx::BufferFormat::RGBX_8888:
......@@ -27,8 +27,8 @@ bool SupportedBindFormat(gfx::BufferFormat format) {
};
}
bool HasAlpha(gfx::BufferFormat format) {
DCHECK(SupportedBindFormat(format));
bool SwapChainHasAlpha(gfx::BufferFormat format) {
DCHECK(SwapChainSupportedBindFormat(format));
switch (format) {
case gfx::BufferFormat::RGBA_8888:
case gfx::BufferFormat::RGBA_F16:
......@@ -42,13 +42,14 @@ bool HasAlpha(gfx::BufferFormat format) {
}
EGLConfig ChooseCompatibleConfig(gfx::BufferFormat format, EGLDisplay display) {
DCHECK(SupportedBindFormat(format));
DCHECK(SwapChainSupportedBindFormat(format));
const EGLint color_bits = format == gfx::BufferFormat::RGBA_F16 ? 16 : 8;
const EGLint buffer_bind_to_texture =
HasAlpha(format) ? EGL_BIND_TO_TEXTURE_RGBA : EGL_BIND_TO_TEXTURE_RGB;
const EGLint buffer_bind_to_texture = SwapChainHasAlpha(format)
? EGL_BIND_TO_TEXTURE_RGBA
: EGL_BIND_TO_TEXTURE_RGB;
const EGLint buffer_size =
color_bits * 3 + (HasAlpha(format) ? color_bits : 0);
color_bits * 3 + (SwapChainHasAlpha(format) ? color_bits : 0);
std::vector<EGLint> attrib_list = {
EGL_RED_SIZE, color_bits, EGL_GREEN_SIZE, color_bits,
......@@ -90,7 +91,7 @@ EGLConfig ChooseCompatibleConfig(gfx::BufferFormat format, EGLDisplay display) {
continue;
}
if (HasAlpha(format) &&
if (SwapChainHasAlpha(format) &&
(!eglGetConfigAttrib(display, config, EGL_ALPHA_SIZE, &bits) ||
bits != color_bits)) {
continue;
......@@ -106,7 +107,7 @@ EGLSurface CreatePbuffer(const Microsoft::WRL::ComPtr<ID3D11Texture2D>& texture,
EGLConfig config,
EGLDisplay display,
unsigned target) {
DCHECK(SupportedBindFormat(format));
DCHECK(SwapChainSupportedBindFormat(format));
D3D11_TEXTURE2D_DESC desc;
texture->GetDesc(&desc);
......@@ -121,7 +122,7 @@ EGLSurface CreatePbuffer(const Microsoft::WRL::ComPtr<ID3D11Texture2D>& texture,
EGL_TEXTURE_TARGET,
EGL_TEXTURE_2D,
EGL_TEXTURE_FORMAT,
HasAlpha(format) ? EGL_TEXTURE_RGBA : EGL_TEXTURE_RGB,
SwapChainHasAlpha(format) ? EGL_TEXTURE_RGBA : EGL_TEXTURE_RGB,
EGL_NONE};
return eglCreatePbufferFromClientBuffer(
......@@ -180,7 +181,7 @@ bool GLImageDXGISwapChain::CopyTexSubImage(unsigned target,
void GLImageDXGISwapChain::Flush() {}
unsigned GLImageDXGISwapChain::GetInternalFormat() {
return HasAlpha(buffer_format_) ? GL_RGBA : GL_RGB;
return SwapChainHasAlpha(buffer_format_) ? GL_RGBA : GL_RGB;
}
gfx::Size GLImageDXGISwapChain::GetSize() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment