#include "gpu/command_buffer/service/service_utils.h"
#include <string>
#include <string_view>
#include "base/command_line.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/service/context_group.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/config/gpu_finch_features.h"
#include "skia/buildflags.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_switches.h"
#include "ui/gl/gl_utils.h"
#include "ui/gl/gl_surface_egl.h"
namespace gpu {
namespace gles2 {
namespace {
bool GetUintFromSwitch(const base::CommandLine* command_line,
std::string_view switch_string,
uint32_t* value) { … }
VulkanImplementationName ParseVulkanImplementationName(
const base::CommandLine* command_line) { … }
WebGPUAdapterName ParseWebGPUAdapterName(
const base::CommandLine* command_line) { … }
WebGPUPowerPreference ParseWebGPUPowerPreference(
const base::CommandLine* command_line) { … }
}
gl::GLContextAttribs GenerateGLContextAttribsForDecoder(
const ContextCreationAttribs& attribs_helper,
const ContextGroup* context_group) { … }
gl::GLContextAttribs GenerateGLContextAttribsForCompositor(
bool use_passthrough_cmd_decoder) { … }
bool UsePassthroughCommandDecoder(const base::CommandLine* command_line) { … }
bool PassthroughCommandDecoderSupported() { … }
GpuPreferences ParseGpuPreferences(const base::CommandLine* command_line) { … }
GrContextType ParseGrContextType(const base::CommandLine* command_line) { … }
bool MSAAIsSlow(const GpuDriverBugWorkarounds& workarounds) { … }
}
#if BUILDFLAG(IS_MAC)
uint32_t GetTextureTargetForIOSurfaces() {
if (gl::GetGLImplementation() == gl::kGLImplementationEGLANGLE &&
(gl::GetANGLEImplementation() == gl::ANGLEImplementation::kSwiftShader ||
gl::GetANGLEImplementation() == gl::ANGLEImplementation::kMetal)) {
return GL_TEXTURE_2D;
}
return GL_TEXTURE_RECTANGLE_ARB;
}
#endif
}