Skip to content

Commit e2c2849

Browse files
zhenyaoChromium LUCI CQ
authored and
Chromium LUCI CQ
committed
Remove five gpu workarounds.
disable_ext_draw_buffers disable_dual_source_blending_support disable_av_sample_buffer_display_layer depth_stencil_renderbuffer_resize_emulation clear_uniforms_before_first_program_use These workarounds only applies to macOS on validating command buffer or on macOS versions Chrome no longer supports. TEST=bots R=kbr@chromium.org,geofflang@chromium.org Bug: 1136972,180397,779991,124764,349137,632178,775202,1027981 Change-Id: I4413b8bd706e9bb70c0ac311f5da2084b4bbb415 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4863987 Auto-Submit: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Zhenyao Mo <zmo@chromium.org> Cr-Commit-Position: refs/heads/main@{#1197529}
1 parent 3f5c895 commit e2c2849

13 files changed

+3
-487
lines changed

content/test/gpu/gpu_tests/fake_win_amd_gpu_info.py

-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@
116116
],
117117
'driver_bug_workarounds':
118118
[
119-
'clear_uniforms_before_first_program_use',
120119
'exit_on_context_lost',
121120
'force_cube_complete',
122121
'scalarize_vec_and_mat_constructor_args',

gpu/command_buffer/service/feature_info.cc

-1
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,6 @@ void FeatureInfo::InitializeFeatures() {
13481348
bool is_webgl_compatibility_context =
13491349
gfx::HasExtension(extensions, "GL_ANGLE_webgl_compatibility");
13501350
bool have_es2_draw_buffers =
1351-
!workarounds_.disable_ext_draw_buffers &&
13521351
(have_es2_draw_buffers_vendor_agnostic ||
13531352
can_emulate_es2_draw_buffers_on_es3_nv) &&
13541353
(context_type_ == CONTEXT_TYPE_OPENGLES2 ||

gpu/command_buffer/service/gles2_cmd_decoder.cc

-6
Original file line numberDiff line numberDiff line change
@@ -8993,10 +8993,6 @@ void GLES2DecoderImpl::DoLinkProgram(GLuint program_id) {
89938993
? Program::kCountAll
89948994
: Program::kCountOnlyStaticallyUsed,
89958995
client())) {
8996-
if (program == state_.current_program.get()) {
8997-
if (workarounds().clear_uniforms_before_first_program_use)
8998-
program_manager()->ClearUniforms(program);
8999-
}
90008996
if (features().webgl_multi_draw)
90018997
program_manager()->UpdateDrawIDUniformLocation(program);
90028998
if (features().webgl_draw_instanced_base_vertex_base_instance ||
@@ -9710,8 +9706,6 @@ void GLES2DecoderImpl::DoUseProgram(GLuint program_id) {
97109706
api()->glUseProgramFn(service_id);
97119707
if (state_.current_program.get()) {
97129708
program_manager()->UseProgram(state_.current_program.get());
9713-
if (workarounds().clear_uniforms_before_first_program_use)
9714-
program_manager()->ClearUniforms(program);
97159709
}
97169710
}
97179711

gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc

-46
Original file line numberDiff line numberDiff line change
@@ -2043,52 +2043,6 @@ TEST_P(GLES2DecoderWithShaderTest, BindUniformLocationCHROMIUMBucket) {
20432043
EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
20442044
}
20452045

2046-
TEST_P(GLES2DecoderManualInitTest, ClearUniformsBeforeFirstProgramUse) {
2047-
gpu::GpuDriverBugWorkarounds workarounds;
2048-
workarounds.clear_uniforms_before_first_program_use = true;
2049-
InitState init;
2050-
init.has_alpha = true;
2051-
init.request_alpha = true;
2052-
init.bind_generates_resource = true;
2053-
InitDecoderWithWorkarounds(init, workarounds);
2054-
{
2055-
static AttribInfo attribs[] = {
2056-
{
2057-
kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location,
2058-
},
2059-
{
2060-
kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location,
2061-
},
2062-
{
2063-
kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location,
2064-
},
2065-
};
2066-
static UniformInfo uniforms[] = {
2067-
{kUniform1Name, kUniform1Size, kUniform1Type, kUniform1FakeLocation,
2068-
kUniform1RealLocation, kUniform1DesiredLocation},
2069-
{kUniform2Name, kUniform2Size, kUniform2Type, kUniform2FakeLocation,
2070-
kUniform2RealLocation, kUniform2DesiredLocation},
2071-
{kUniform3Name, kUniform3Size, kUniform3Type, kUniform3FakeLocation,
2072-
kUniform3RealLocation, kUniform3DesiredLocation},
2073-
};
2074-
SetupShader(attribs, std::size(attribs), uniforms, std::size(uniforms),
2075-
client_program_id_, kServiceProgramId, client_vertex_shader_id_,
2076-
kServiceVertexShaderId, client_fragment_shader_id_,
2077-
kServiceFragmentShaderId);
2078-
TestHelper::SetupExpectationsForClearingUniforms(gl_.get(), uniforms,
2079-
std::size(uniforms));
2080-
}
2081-
2082-
{
2083-
EXPECT_CALL(*gl_, UseProgram(kServiceProgramId))
2084-
.Times(1)
2085-
.RetiresOnSaturation();
2086-
cmds::UseProgram cmd;
2087-
cmd.Init(client_program_id_);
2088-
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2089-
}
2090-
}
2091-
20922046
TEST_P(GLES2DecoderWithShaderTest, UseDeletedProgram) {
20932047
DoDeleteProgram(client_program_id_, kServiceProgramId);
20942048
{

gpu/command_buffer/service/program_manager.cc

-129
Original file line numberDiff line numberDiff line change
@@ -636,130 +636,6 @@ void Program::UpdateLogInfo() {
636636
set_log_info(log.empty() ? nullptr : log.c_str());
637637
}
638638

639-
void Program::ClearUniforms(std::vector<uint8_t>* zero_buffer) {
640-
DCHECK(zero_buffer);
641-
if (uniforms_cleared_) {
642-
return;
643-
}
644-
uniforms_cleared_ = true;
645-
for (const UniformInfo& uniform_info : uniform_infos_) {
646-
GLint location = uniform_info.element_locations[0];
647-
GLsizei size = uniform_info.size;
648-
uint32_t unit_size =
649-
GLES2Util::GetElementCountForUniformType(uniform_info.type) *
650-
GLES2Util::GetElementSizeForUniformType(uniform_info.type);
651-
DCHECK_LT(0u, unit_size);
652-
uint32_t size_needed = size * unit_size;
653-
if (size_needed > zero_buffer->size()) {
654-
zero_buffer->resize(size_needed, 0u);
655-
}
656-
const void* zero = &(*zero_buffer)[0];
657-
switch (uniform_info.type) {
658-
case GL_FLOAT:
659-
glUniform1fv(location, size, reinterpret_cast<const GLfloat*>(zero));
660-
break;
661-
case GL_FLOAT_VEC2:
662-
glUniform2fv(location, size, reinterpret_cast<const GLfloat*>(zero));
663-
break;
664-
case GL_FLOAT_VEC3:
665-
glUniform3fv(location, size, reinterpret_cast<const GLfloat*>(zero));
666-
break;
667-
case GL_FLOAT_VEC4:
668-
glUniform4fv(location, size, reinterpret_cast<const GLfloat*>(zero));
669-
break;
670-
case GL_INT:
671-
case GL_BOOL:
672-
case GL_SAMPLER_2D:
673-
case GL_SAMPLER_CUBE:
674-
case GL_SAMPLER_EXTERNAL_OES: // extension.
675-
case GL_SAMPLER_2D_RECT_ARB: // extension.
676-
glUniform1iv(location, size, reinterpret_cast<const GLint*>(zero));
677-
break;
678-
case GL_INT_VEC2:
679-
case GL_BOOL_VEC2:
680-
glUniform2iv(location, size, reinterpret_cast<const GLint*>(zero));
681-
break;
682-
case GL_INT_VEC3:
683-
case GL_BOOL_VEC3:
684-
glUniform3iv(location, size, reinterpret_cast<const GLint*>(zero));
685-
break;
686-
case GL_INT_VEC4:
687-
case GL_BOOL_VEC4:
688-
glUniform4iv(location, size, reinterpret_cast<const GLint*>(zero));
689-
break;
690-
case GL_FLOAT_MAT2:
691-
glUniformMatrix2fv(
692-
location, size, false, reinterpret_cast<const GLfloat*>(zero));
693-
break;
694-
case GL_FLOAT_MAT3:
695-
glUniformMatrix3fv(
696-
location, size, false, reinterpret_cast<const GLfloat*>(zero));
697-
break;
698-
case GL_FLOAT_MAT4:
699-
glUniformMatrix4fv(
700-
location, size, false, reinterpret_cast<const GLfloat*>(zero));
701-
break;
702-
703-
// ES3 types.
704-
case GL_UNSIGNED_INT:
705-
glUniform1uiv(location, size, reinterpret_cast<const GLuint*>(zero));
706-
break;
707-
case GL_SAMPLER_3D:
708-
case GL_SAMPLER_2D_SHADOW:
709-
case GL_SAMPLER_2D_ARRAY:
710-
case GL_SAMPLER_2D_ARRAY_SHADOW:
711-
case GL_SAMPLER_CUBE_SHADOW:
712-
case GL_INT_SAMPLER_2D:
713-
case GL_INT_SAMPLER_3D:
714-
case GL_INT_SAMPLER_CUBE:
715-
case GL_INT_SAMPLER_2D_ARRAY:
716-
case GL_UNSIGNED_INT_SAMPLER_2D:
717-
case GL_UNSIGNED_INT_SAMPLER_3D:
718-
case GL_UNSIGNED_INT_SAMPLER_CUBE:
719-
case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
720-
glUniform1iv(location, size, reinterpret_cast<const GLint*>(zero));
721-
break;
722-
case GL_UNSIGNED_INT_VEC2:
723-
glUniform2uiv(location, size, reinterpret_cast<const GLuint*>(zero));
724-
break;
725-
case GL_UNSIGNED_INT_VEC3:
726-
glUniform3uiv(location, size, reinterpret_cast<const GLuint*>(zero));
727-
break;
728-
case GL_UNSIGNED_INT_VEC4:
729-
glUniform4uiv(location, size, reinterpret_cast<const GLuint*>(zero));
730-
break;
731-
case GL_FLOAT_MAT2x3:
732-
glUniformMatrix2x3fv(
733-
location, size, false, reinterpret_cast<const GLfloat*>(zero));
734-
break;
735-
case GL_FLOAT_MAT3x2:
736-
glUniformMatrix3x2fv(
737-
location, size, false, reinterpret_cast<const GLfloat*>(zero));
738-
break;
739-
case GL_FLOAT_MAT2x4:
740-
glUniformMatrix2x4fv(
741-
location, size, false, reinterpret_cast<const GLfloat*>(zero));
742-
break;
743-
case GL_FLOAT_MAT4x2:
744-
glUniformMatrix4x2fv(
745-
location, size, false, reinterpret_cast<const GLfloat*>(zero));
746-
break;
747-
case GL_FLOAT_MAT3x4:
748-
glUniformMatrix3x4fv(
749-
location, size, false, reinterpret_cast<const GLfloat*>(zero));
750-
break;
751-
case GL_FLOAT_MAT4x3:
752-
glUniformMatrix4x3fv(
753-
location, size, false, reinterpret_cast<const GLfloat*>(zero));
754-
break;
755-
756-
default:
757-
NOTREACHED();
758-
break;
759-
}
760-
}
761-
}
762-
763639
void Program::Update() {
764640
Reset();
765641
UpdateLogInfo();
@@ -2554,11 +2430,6 @@ void ProgramManager::UnuseProgram(
25542430
RemoveProgramInfoIfUnused(shader_manager, program);
25552431
}
25562432

2557-
void ProgramManager::ClearUniforms(Program* program) {
2558-
DCHECK(program);
2559-
program->ClearUniforms(&zero_);
2560-
}
2561-
25622433
void ProgramManager::UpdateDrawIDUniformLocation(Program* program) {
25632434
DCHECK(program);
25642435
program->UpdateDrawIDUniformLocation();

gpu/command_buffer/service/program_manager.h

-6
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,6 @@ class GPU_GLES2_EXPORT Program : public base::RefCounted<Program> {
499499
// Updates the program log info from GL
500500
void UpdateLogInfo();
501501

502-
// Clears all the uniforms.
503-
void ClearUniforms(std::vector<uint8_t>* zero_buffer);
504-
505502
// Updates the draw id uniform location used by ANGLE_multi_draw
506503
void UpdateDrawIDUniformLocation();
507504

@@ -684,9 +681,6 @@ class GPU_GLES2_EXPORT ProgramManager {
684681
// Makes a program as unused. If deleted the program will be removed.
685682
void UnuseProgram(ShaderManager* shader_manager, Program* program);
686683

687-
// Clears the uniforms for this program.
688-
void ClearUniforms(Program* program);
689-
690684
// Updates the draw id location for this program for ANGLE_multi_draw
691685
void UpdateDrawIDUniformLocation(Program* program);
692686

gpu/command_buffer/service/program_manager_unittest.cc

-71
Original file line numberDiff line numberDiff line change
@@ -314,12 +314,6 @@ class ProgramManagerWithShaderTest : public ProgramManagerTestBase {
314314
service_id);
315315
}
316316

317-
void SetupExpectationsForClearingUniforms(
318-
UniformInfo* uniforms, size_t num_uniforms) {
319-
TestHelper::SetupExpectationsForClearingUniforms(
320-
gl_.get(), uniforms, num_uniforms);
321-
}
322-
323317
// Return true if link status matches expected_link_status
324318
bool LinkAsExpected(Program* program,
325319
bool expected_link_status) {
@@ -1989,71 +1983,6 @@ TEST_F(ProgramManagerWithShaderTest, CountAllVaryingsInPacking) {
19891983
EXPECT_FALSE(program->CheckVaryingsPacking(Program::kCountAll));
19901984
}
19911985

1992-
TEST_F(ProgramManagerWithShaderTest, ClearWithSamplerTypes) {
1993-
Shader* vshader = shader_manager_.CreateShader(
1994-
kVertexShaderClientId, kVertexShaderServiceId, GL_VERTEX_SHADER);
1995-
ASSERT_TRUE(vshader != nullptr);
1996-
TestHelper::SetShaderStates(gl_.get(), vshader, true);
1997-
Shader* fshader = shader_manager_.CreateShader(
1998-
kFragmentShaderClientId, kFragmentShaderServiceId, GL_FRAGMENT_SHADER);
1999-
ASSERT_TRUE(fshader != nullptr);
2000-
TestHelper::SetShaderStates(gl_.get(), fshader, true);
2001-
Program* program =
2002-
manager_->CreateProgram(kClientProgramId, kServiceProgramId);
2003-
ASSERT_TRUE(program != nullptr);
2004-
EXPECT_TRUE(program->AttachShader(&shader_manager_, vshader));
2005-
EXPECT_TRUE(program->AttachShader(&shader_manager_, fshader));
2006-
2007-
static const GLenum kSamplerTypes[] = {
2008-
GL_SAMPLER_2D,
2009-
GL_SAMPLER_CUBE,
2010-
GL_SAMPLER_EXTERNAL_OES,
2011-
GL_SAMPLER_3D_OES,
2012-
GL_SAMPLER_2D_RECT_ARB,
2013-
};
2014-
const size_t kNumSamplerTypes = std::size(kSamplerTypes);
2015-
for (size_t ii = 0; ii < kNumSamplerTypes; ++ii) {
2016-
static ProgramManagerWithShaderTest::AttribInfo kAttribs[] = {
2017-
{ kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, },
2018-
{ kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, },
2019-
{ kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, },
2020-
};
2021-
ProgramManagerWithShaderTest::UniformInfo kUniforms[] = {
2022-
{ kUniform1Name,
2023-
kUniform1Size,
2024-
kUniform1Type,
2025-
kUniform1FakeLocation,
2026-
kUniform1RealLocation,
2027-
kUniform1DesiredLocation,
2028-
kUniform1Name,
2029-
},
2030-
{ kUniform2Name,
2031-
kUniform2Size,
2032-
kSamplerTypes[ii],
2033-
kUniform2FakeLocation,
2034-
kUniform2RealLocation,
2035-
kUniform2DesiredLocation,
2036-
kUniform2NameWithArrayIndex,
2037-
},
2038-
{ kUniform3Name,
2039-
kUniform3Size,
2040-
kUniform3Type,
2041-
kUniform3FakeLocation,
2042-
kUniform3RealLocation,
2043-
kUniform3DesiredLocation,
2044-
kUniform3NameWithArrayIndex,
2045-
},
2046-
};
2047-
const size_t kNumAttribs = std::size(kAttribs);
2048-
const size_t kNumUniforms = std::size(kUniforms);
2049-
SetupShaderExpectations(kAttribs, kNumAttribs, kUniforms, kNumUniforms,
2050-
kServiceProgramId);
2051-
program->Link(nullptr, Program::kCountOnlyStaticallyUsed, this);
2052-
SetupExpectationsForClearingUniforms(kUniforms, kNumUniforms);
2053-
manager_->ClearUniforms(program);
2054-
}
2055-
}
2056-
20571986
TEST_F(ProgramManagerWithShaderTest, BindUniformLocation) {
20581987
const GLint kUniform1DesiredLocation = 10;
20591988
const GLint kUniform2DesiredLocation = -1;

gpu/command_buffer/service/renderbuffer_manager.cc

+2-11
Original file line numberDiff line numberDiff line change
@@ -142,26 +142,17 @@ Renderbuffer::Renderbuffer(RenderbufferManager* manager,
142142

143143
bool Renderbuffer::RegenerateAndBindBackingObjectIfNeeded(
144144
const GpuDriverBugWorkarounds& workarounds) {
145-
// There are two workarounds which need this code path:
146-
// depth_stencil_renderbuffer_resize_emulation
147-
// multisample_renderbuffer_resize_emulation
148145
bool multisample_workaround =
149146
workarounds.multisample_renderbuffer_resize_emulation;
150-
bool depth_stencil_workaround =
151-
workarounds.depth_stencil_renderbuffer_resize_emulation;
152-
if (!multisample_workaround && !depth_stencil_workaround) {
147+
if (!multisample_workaround) {
153148
return false;
154149
}
155150

156151
if (!allocated_ || !has_been_bound_) {
157152
return false;
158153
}
159154

160-
bool workaround_needed = (multisample_workaround && samples_ > 0) ||
161-
(depth_stencil_workaround &&
162-
TextureManager::ExtractFormatFromStorageFormat(
163-
internal_format_) == GL_DEPTH_STENCIL);
164-
155+
bool workaround_needed = (multisample_workaround && samples_ > 0);
165156
if (!workaround_needed) {
166157
return false;
167158
}

0 commit comments

Comments
 (0)