diff --git a/gpu/angle_unittest_main.cc b/gpu/angle_unittest_main.cc index 7187829a233108..2294b5cd60e46a 100644 --- a/gpu/angle_unittest_main.cc +++ b/gpu/angle_unittest_main.cc @@ -24,12 +24,12 @@ int RunHelper(base::TestSuite* test_suite) { int main(int argc, char** argv) { base::CommandLine::Init(argc, argv); testing::InitGoogleMock(&argc, argv); - ShInitialize(); + sh::Initialize(); base::TestSuite test_suite(argc, argv); int rt = base::LaunchUnitTestsSerially( argc, argv, base::Bind(&RunHelper, base::Unretained(&test_suite))); - ShFinalize(); + sh::Finalize(); return rt; } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 8fe53bb2e6e722..3c2f69440091f8 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -3748,7 +3748,7 @@ bool GLES2DecoderImpl::InitializeShaderTranslator() { return true; } ShBuiltInResources resources; - ShInitBuiltInResources(&resources); + sh::InitBuiltInResources(&resources); resources.MaxVertexAttribs = group_->max_vertex_attribs(); resources.MaxVertexUniformVectors = group_->max_vertex_uniform_vectors(); diff --git a/gpu/command_buffer/service/program_manager.cc b/gpu/command_buffer/service/program_manager.cc index 46b6bb50c860b0..92615df4490552 100644 --- a/gpu/command_buffer/service/program_manager.cc +++ b/gpu/command_buffer/service/program_manager.cc @@ -2080,9 +2080,8 @@ bool Program::CheckVaryingsPacking( for (const auto& key_value : combined_map) { variables.push_back(*key_value.second); } - return ShCheckVariablesWithinPackingLimits( - static_cast(manager_->max_varying_vectors()), - variables); + return sh::CheckVariablesWithinPackingLimits( + static_cast(manager_->max_varying_vectors()), variables); } void Program::GetProgramInfo( diff --git a/gpu/command_buffer/service/shader_translator.cc b/gpu/command_buffer/service/shader_translator.cc index 60b6d63692a9ec..d5067b58c8d5c0 100644 --- a/gpu/command_buffer/service/shader_translator.cc +++ b/gpu/command_buffer/service/shader_translator.cc @@ -27,12 +27,12 @@ class ShaderTranslatorInitializer { public: ShaderTranslatorInitializer() { TRACE_EVENT0("gpu", "ShInitialize"); - CHECK(ShInitialize()); + CHECK(sh::Initialize()); } ~ShaderTranslatorInitializer() { TRACE_EVENT0("gpu", "ShFinalize"); - ShFinalize(); + sh::Finalize(); } }; @@ -43,7 +43,7 @@ void GetAttributes(ShHandle compiler, AttributeMap* var_map) { if (!var_map) return; var_map->clear(); - const std::vector* attribs = ShGetAttributes(compiler); + const std::vector* attribs = sh::GetAttributes(compiler); if (attribs) { for (size_t ii = 0; ii < attribs->size(); ++ii) (*var_map)[(*attribs)[ii].mappedName] = (*attribs)[ii]; @@ -54,7 +54,7 @@ void GetUniforms(ShHandle compiler, UniformMap* var_map) { if (!var_map) return; var_map->clear(); - const std::vector* uniforms = ShGetUniforms(compiler); + const std::vector* uniforms = sh::GetUniforms(compiler); if (uniforms) { for (size_t ii = 0; ii < uniforms->size(); ++ii) (*var_map)[(*uniforms)[ii].mappedName] = (*uniforms)[ii]; @@ -65,7 +65,7 @@ void GetVaryings(ShHandle compiler, VaryingMap* var_map) { if (!var_map) return; var_map->clear(); - const std::vector* varyings = ShGetVaryings(compiler); + const std::vector* varyings = sh::GetVaryings(compiler); if (varyings) { for (size_t ii = 0; ii < varyings->size(); ++ii) (*var_map)[(*varyings)[ii].mappedName] = (*varyings)[ii]; @@ -74,7 +74,7 @@ void GetVaryings(ShHandle compiler, VaryingMap* var_map) { void GetOutputVariables(ShHandle compiler, OutputVariableList* var_list) { if (!var_list) return; - *var_list = *ShGetOutputVariables(compiler); + *var_list = *sh::GetOutputVariables(compiler); } void GetInterfaceBlocks(ShHandle compiler, InterfaceBlockMap* var_map) { @@ -82,7 +82,7 @@ void GetInterfaceBlocks(ShHandle compiler, InterfaceBlockMap* var_map) { return; var_map->clear(); const std::vector* interface_blocks = - ShGetInterfaceBlocks(compiler); + sh::GetInterfaceBlocks(compiler); if (interface_blocks) { for (const auto& block : *interface_blocks) { (*var_map)[block.mappedName] = block; @@ -96,7 +96,7 @@ void GetNameHashingInfo(ShHandle compiler, NameMap* name_map) { name_map->clear(); typedef std::map NameMapANGLE; - const NameMapANGLE* angle_map = ShGetNameHashingMap(compiler); + const NameMapANGLE* angle_map = sh::GetNameHashingMap(compiler); DCHECK(angle_map); for (NameMapANGLE::const_iterator iter = angle_map->begin(); @@ -182,8 +182,8 @@ bool ShaderTranslator::Init(GLenum shader_type, { TRACE_EVENT0("gpu", "ShConstructCompiler"); - compiler_ = ShConstructCompiler(shader_type, shader_spec, - shader_output_language, resources); + compiler_ = sh::ConstructCompiler(shader_type, shader_spec, + shader_output_language, resources); } compile_options_ = @@ -226,16 +226,15 @@ bool ShaderTranslator::Translate(const std::string& shader_source, { TRACE_EVENT0("gpu", "ShCompile"); const char* const shader_strings[] = { shader_source.c_str() }; - success = ShCompile( - compiler_, shader_strings, 1, GetCompileOptions()); + success = sh::Compile(compiler_, shader_strings, 1, GetCompileOptions()); } if (success) { // Get translated shader. if (translated_source) { - *translated_source = ShGetObjectCode(compiler_); + *translated_source = sh::GetObjectCode(compiler_); } // Get shader version. - *shader_version = ShGetShaderVersion(compiler_); + *shader_version = sh::GetShaderVersion(compiler_); // Get info for attribs, uniforms, varyings and output variables. GetAttributes(compiler_, attrib_map); GetUniforms(compiler_, uniform_map); @@ -248,11 +247,11 @@ bool ShaderTranslator::Translate(const std::string& shader_source, // Get info log. if (info_log) { - *info_log = ShGetInfoLog(compiler_); + *info_log = sh::GetInfoLog(compiler_); } // We don't need results in the compiler anymore. - ShClearResults(compiler_); + sh::ClearResults(compiler_); return success; } @@ -261,8 +260,8 @@ std::string ShaderTranslator::GetStringForOptionsThatWouldAffectCompilation() const { DCHECK(compiler_ != NULL); return std::string(":CompileOptions:" + - base::Uint64ToString(GetCompileOptions())) + - ShGetBuiltInResourcesString(compiler_); + base::Uint64ToString(GetCompileOptions())) + + sh::GetBuiltInResourcesString(compiler_); } void ShaderTranslator::AddDestructionObserver( @@ -280,7 +279,7 @@ ShaderTranslator::~ShaderTranslator() { observer.OnDestruct(this); if (compiler_ != NULL) - ShDestruct(compiler_); + sh::Destruct(compiler_); } } // namespace gles2 diff --git a/gpu/command_buffer/service/shader_translator_cache_unittest.cc b/gpu/command_buffer/service/shader_translator_cache_unittest.cc index eefd2e69a7a7ac..a23a753b34ba7e 100644 --- a/gpu/command_buffer/service/shader_translator_cache_unittest.cc +++ b/gpu/command_buffer/service/shader_translator_cache_unittest.cc @@ -16,11 +16,11 @@ TEST(ShaderTranslatorCacheTest, InitParamComparable) { ShBuiltInResources a_resources; memset(&a_resources, 88, sizeof(a_resources)); - ShInitBuiltInResources(&a_resources); + sh::InitBuiltInResources(&a_resources); ShBuiltInResources b_resources; memset(&b_resources, 77, sizeof(b_resources)); - ShInitBuiltInResources(&b_resources); + sh::InitBuiltInResources(&b_resources); EXPECT_TRUE(memcmp(&a_resources, &b_resources, sizeof(a_resources)) == 0); diff --git a/gpu/command_buffer/service/shader_translator_unittest.cc b/gpu/command_buffer/service/shader_translator_unittest.cc index 0059aa088fa3bc..e48f6111306ccd 100644 --- a/gpu/command_buffer/service/shader_translator_unittest.cc +++ b/gpu/command_buffer/service/shader_translator_unittest.cc @@ -24,7 +24,7 @@ class ShaderTranslatorTest : public testing::Test { protected: void SetUp() override { ShBuiltInResources resources; - ShInitBuiltInResources(&resources); + sh::InitBuiltInResources(&resources); resources.MaxExpressionComplexity = 32; resources.MaxCallStackDepth = 32; @@ -63,7 +63,7 @@ class ES3ShaderTranslatorTest : public testing::Test { protected: void SetUp() override { ShBuiltInResources resources; - ShInitBuiltInResources(&resources); + sh::InitBuiltInResources(&resources); resources.MaxExpressionComplexity = 32; resources.MaxCallStackDepth = 32; @@ -424,7 +424,7 @@ TEST_F(ShaderTranslatorTest, OptionsString) { scoped_refptr translator_3 = new ShaderTranslator(); ShBuiltInResources resources; - ShInitBuiltInResources(&resources); + sh::InitBuiltInResources(&resources); ASSERT_TRUE(translator_1->Init(GL_VERTEX_SHADER, SH_GLES2_SPEC, &resources, SH_GLSL_150_CORE_OUTPUT, @@ -464,7 +464,7 @@ class ShaderTranslatorOutputVersionTest // https://bugs.chromium.org/p/angleproject/issues/detail?id=1277 TEST_F(ShaderTranslatorOutputVersionTest, DISABLED_CompatibilityOutput) { ShBuiltInResources resources; - ShInitBuiltInResources(&resources); + sh::InitBuiltInResources(&resources); ShCompileOptions compile_options = SH_OBJECT_CODE; ShShaderOutput shader_output_language = SH_GLSL_COMPATIBILITY_OUTPUT; scoped_refptr vertex_translator = new ShaderTranslator(); @@ -532,7 +532,7 @@ TEST_P(ShaderTranslatorOutputVersionTest, HasCorrectOutputGLSLVersion) { scoped_refptr translator = new ShaderTranslator(); ShBuiltInResources resources; - ShInitBuiltInResources(&resources); + sh::InitBuiltInResources(&resources); ShCompileOptions compile_options = SH_OBJECT_CODE; ShShaderOutput shader_output_language = ShaderTranslator::GetShaderOutputLanguageForContext(