Request passthrough shaders for Skia contexts.
For Skia contexts when ANGLE exposes the EGL_ANGLE_create_context_passthrough_shaders extension, request that shaders are passed directly to the driver, untranslated. Add a killswitch feature, AllowANGLEPassthroughShaders to revert to the previous behaviour of always translating shaders. Bug: 398857482 Change-Id: I75bd96839d6728e2ccbb2bfd934a9011bfbc8a7c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6361829 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Colin Blundell <blundell@chromium.org> Cr-Commit-Position: refs/heads/main@{#1435517}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
76b215e326
commit
2ccdaab76e
@ -19,10 +19,11 @@
|
||||
#include "gpu/config/gpu_finch_features.h"
|
||||
#include "skia/buildflags.h"
|
||||
#include "ui/gl/gl_bindings.h"
|
||||
#include "ui/gl/gl_features.h"
|
||||
#include "ui/gl/gl_implementation.h"
|
||||
#include "ui/gl/gl_surface_egl.h"
|
||||
#include "ui/gl/gl_switches.h"
|
||||
#include "ui/gl/gl_utils.h"
|
||||
#include "ui/gl/gl_surface_egl.h"
|
||||
|
||||
namespace gpu {
|
||||
namespace gles2 {
|
||||
@ -188,6 +189,8 @@ gl::GLContextAttribs GenerateGLContextAttribsForCompositor(
|
||||
attribs.global_texture_share_group = true;
|
||||
attribs.global_semaphore_share_group = true;
|
||||
|
||||
attribs.passthrough_shaders = features::IsANGLEPassthroughShadersAllowed();
|
||||
|
||||
// Disable resource initialization and buffer bounds checks for trusted
|
||||
// contexts.
|
||||
attribs.robust_resource_initialization = false;
|
||||
|
@ -2636,6 +2636,7 @@ EGL_EXTENSIONS_EXTRA = [
|
||||
'EGL_ANGLE_context_virtualization',
|
||||
'EGL_ANGLE_create_context_backwards_compatible',
|
||||
'EGL_ANGLE_create_context_client_arrays',
|
||||
'EGL_ANGLE_create_context_passthrough_shaders',
|
||||
'EGL_ANGLE_create_context_webgl_compatibility',
|
||||
'EGL_ANGLE_global_fence_sync',
|
||||
'EGL_ANGLE_iosurface_client_buffer',
|
||||
|
@ -329,6 +329,8 @@ void DisplayExtensionsEGL::InitializeExtensionSettings(EGLDisplay display) {
|
||||
extensions, "EGL_ANGLE_create_context_backwards_compatible");
|
||||
b_EGL_ANGLE_create_context_client_arrays =
|
||||
gfx::HasExtension(extensions, "EGL_ANGLE_create_context_client_arrays");
|
||||
b_EGL_ANGLE_create_context_passthrough_shaders = gfx::HasExtension(
|
||||
extensions, "EGL_ANGLE_create_context_passthrough_shaders");
|
||||
b_EGL_ANGLE_create_context_webgl_compatibility = gfx::HasExtension(
|
||||
extensions, "EGL_ANGLE_create_context_webgl_compatibility");
|
||||
b_EGL_ANGLE_d3d_share_handle_client_buffer =
|
||||
|
@ -397,6 +397,7 @@ struct GL_EXPORT DisplayExtensionsEGL {
|
||||
bool b_EGL_ANGLE_context_virtualization;
|
||||
bool b_EGL_ANGLE_create_context_backwards_compatible;
|
||||
bool b_EGL_ANGLE_create_context_client_arrays;
|
||||
bool b_EGL_ANGLE_create_context_passthrough_shaders;
|
||||
bool b_EGL_ANGLE_create_context_webgl_compatibility;
|
||||
bool b_EGL_ANGLE_d3d_share_handle_client_buffer;
|
||||
bool b_EGL_ANGLE_device_vulkan;
|
||||
|
@ -107,6 +107,10 @@ struct GL_EXPORT GLContextAttribs {
|
||||
int client_minor_es_version = 0;
|
||||
bool can_skip_validation = false;
|
||||
|
||||
// Use EXT_ANGLE_create_context_passthrough_shaders if it is available to tell
|
||||
// ANGLE to not translate shaders and pass them unaltered to the driver.
|
||||
bool passthrough_shaders = false;
|
||||
|
||||
// If true, and if supported (for EGL, this requires the robustness
|
||||
// extension), set the reset notification strategy to lose context on reset.
|
||||
// This setting can be changed independently of robust_buffer_access.
|
||||
|
@ -93,6 +93,11 @@
|
||||
#define EGL_CONTEXT_VIRTUALIZATION_GROUP_ANGLE 0x3481
|
||||
#endif /* EGL_ANGLE_context_virtualization */
|
||||
|
||||
#ifndef EGL_ANGLE_create_context_passthrough_shaders
|
||||
#define EGL_ANGLE_create_context_passthrough_shaders 1
|
||||
#define EGL_CONTEXT_PASSTHROUGH_SHADERS_ANGLE 0x3463
|
||||
#endif /* EGL_ANGLE_create_context_passthrough_shaders */
|
||||
|
||||
using ui::GetEGLErrorString;
|
||||
using ui::GetLastEGLErrorString;
|
||||
|
||||
@ -184,6 +189,12 @@ bool GLContextEGL::InitializeImpl(GLSurface* compatible_surface,
|
||||
context_attributes.push_back(EGL_TRUE);
|
||||
}
|
||||
|
||||
if (attribs.passthrough_shaders &&
|
||||
gl_display_->ext->b_EGL_ANGLE_create_context_passthrough_shaders) {
|
||||
context_attributes.push_back(EGL_CONTEXT_PASSTHROUGH_SHADERS_ANGLE);
|
||||
context_attributes.push_back(EGL_TRUE);
|
||||
}
|
||||
|
||||
// EGL_KHR_create_context allows requesting both a major and minor context
|
||||
// version
|
||||
if (gl_display_->ext->b_EGL_KHR_create_context) {
|
||||
|
@ -275,6 +275,16 @@ bool IsANGLEValidationEnabled() {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Killswitch feature for allowing ANGLE to pass untranslated shaders to the
|
||||
// driver.
|
||||
BASE_FEATURE(kAllowANGLEPassthroughShaders,
|
||||
"AllowANGLEPassthroughShaders",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
bool IsANGLEPassthroughShadersAllowed() {
|
||||
return base::FeatureList::IsEnabled(kAllowANGLEPassthroughShaders);
|
||||
}
|
||||
|
||||
void GetANGLEFeaturesFromCommandLineAndFinch(
|
||||
const base::CommandLine* command_line,
|
||||
std::vector<std::string>& enabled_angle_features,
|
||||
|
@ -42,6 +42,7 @@ GL_EXPORT bool IsAndroidFrameDeadlineEnabled();
|
||||
|
||||
GL_EXPORT bool UsePassthroughCommandDecoder();
|
||||
GL_EXPORT bool IsANGLEValidationEnabled();
|
||||
GL_EXPORT bool IsANGLEPassthroughShadersAllowed();
|
||||
|
||||
GL_EXPORT void GetANGLEFeaturesFromCommandLineAndFinch(
|
||||
const base::CommandLine* command_line,
|
||||
|
Reference in New Issue
Block a user