diff options
author | kbr@chromium.org <kbr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-12 19:09:02 +0000 |
---|---|---|
committer | kbr@chromium.org <kbr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-12 19:09:02 +0000 |
commit | 3d944a8430e2b872fccfd3ddd8fd00db07256baa (patch) | |
tree | 6987e7c8632e632a54520af96ed483d1ee2a681d | |
parent | b4dcf9553fe3934188b6b30b62d50e3d144d1233 (diff) | |
download | chromium_src-3d944a8430e2b872fccfd3ddd8fd00db07256baa.zip chromium_src-3d944a8430e2b872fccfd3ddd8fd00db07256baa.tar.gz chromium_src-3d944a8430e2b872fccfd3ddd8fd00db07256baa.tar.bz2 |
Added temporary #ifdefs to support incompatible ANGLE API upgrade.
BUG=174821
Review URL: https://codereview.chromium.org/12210057
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181964 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 6 | ||||
-rw-r--r-- | gpu/command_buffer/service/shader_translator.cc | 24 | ||||
-rw-r--r-- | webkit/gpu/webgraphicscontext3d_in_process_impl.cc | 8 |
3 files changed, 29 insertions, 9 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 0ac835b..d756a2c 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -74,10 +74,12 @@ namespace { static const char kOESDerivativeExtension[] = "GL_OES_standard_derivatives"; +#if !defined(ANGLE_SH_VERSION) || ANGLE_SH_VERSION < 108 khronos_uint64_t CityHashForAngle(const char* name, unsigned int len) { return static_cast<khronos_uint64_t>( CityHash64(name, static_cast<size_t>(len))); } +#endif } // namespace @@ -2500,7 +2502,11 @@ bool GLES2DecoderImpl::InitializeShaderTranslator() { ShShaderSpec shader_spec = force_webgl_glsl_validation_ || force_webgl_glsl_validation_ ? SH_WEBGL_SPEC : SH_GLES2_SPEC; if (shader_spec == SH_WEBGL_SPEC && features().enable_shader_name_hashing) +#if !defined(ANGLE_SH_VERSION) || ANGLE_SH_VERSION < 108 resources.HashFunction = &CityHashForAngle; +#else + resources.HashFunction = &CityHash64; +#endif else resources.HashFunction = NULL; ShaderTranslatorInterface::GlslImplementationType implementation_type = diff --git a/gpu/command_buffer/service/shader_translator.cc b/gpu/command_buffer/service/shader_translator.cc index abe7c91..2dac1bc 100644 --- a/gpu/command_buffer/service/shader_translator.cc +++ b/gpu/command_buffer/service/shader_translator.cc @@ -27,9 +27,15 @@ bool InitializeShaderTranslator() { return initialized; } +#if !defined(ANGLE_SH_VERSION) || ANGLE_SH_VERSION < 108 +typedef int ANGLEGetInfoType; +#else +typedef size_t ANGLEGetInfoType; +#endif + void GetVariableInfo(ShHandle compiler, ShShaderInfo var_type, ShaderTranslator::VariableMap* var_map) { - int name_len = 0, mapped_name_len = 0; + ANGLEGetInfoType name_len = 0, mapped_name_len = 0; switch (var_type) { case SH_ACTIVE_ATTRIBUTES: ShGetInfo(compiler, SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, &name_len); @@ -44,10 +50,10 @@ void GetVariableInfo(ShHandle compiler, ShShaderInfo var_type, scoped_array<char> name(new char[name_len]); scoped_array<char> mapped_name(new char[mapped_name_len]); - int num_vars = 0; + ANGLEGetInfoType num_vars = 0; ShGetInfo(compiler, var_type, &num_vars); - for (int i = 0; i < num_vars; ++i) { - int len = 0; + for (ANGLEGetInfoType i = 0; i < num_vars; ++i) { + ANGLEGetInfoType len = 0; int size = 0; ShDataType type = SH_NONE; @@ -77,19 +83,19 @@ void GetVariableInfo(ShHandle compiler, ShShaderInfo var_type, void GetNameHashingInfo( ShHandle compiler, ShaderTranslator::NameMap* name_map) { - int hashed_names_count = 0; + ANGLEGetInfoType hashed_names_count = 0; ShGetInfo(compiler, SH_HASHED_NAMES_COUNT, &hashed_names_count); if (hashed_names_count == 0) return; - int name_max_len = 0, hashed_name_max_len = 0; + ANGLEGetInfoType name_max_len = 0, hashed_name_max_len = 0; ShGetInfo(compiler, SH_NAME_MAX_LENGTH, &name_max_len); ShGetInfo(compiler, SH_HASHED_NAME_MAX_LENGTH, &hashed_name_max_len); scoped_array<char> name(new char[name_max_len]); scoped_array<char> hashed_name(new char[hashed_name_max_len]); - for (int i = 0; i < hashed_names_count; ++i) { + for (ANGLEGetInfoType i = 0; i < hashed_names_count; ++i) { ShGetNameHashingEntry(compiler, i, name.get(), hashed_name.get()); (*name_map)[hashed_name.get()] = name.get(); } @@ -157,7 +163,7 @@ bool ShaderTranslator::Translate(const char* shader) { if (ShCompile(compiler_, &shader, 1, compile_options)) { success = true; // Get translated shader. - int obj_code_len = 0; + ANGLEGetInfoType obj_code_len = 0; ShGetInfo(compiler_, SH_OBJECT_CODE_LENGTH, &obj_code_len); if (obj_code_len > 1) { translated_shader_.reset(new char[obj_code_len]); @@ -171,7 +177,7 @@ bool ShaderTranslator::Translate(const char* shader) { } // Get info log. - int info_log_len = 0; + ANGLEGetInfoType info_log_len = 0; ShGetInfo(compiler_, SH_INFO_LOG_LENGTH, &info_log_len); if (info_log_len > 1) { info_log_.reset(new char[info_log_len]); diff --git a/webkit/gpu/webgraphicscontext3d_in_process_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_impl.cc index a100b1f..847acda 100644 --- a/webkit/gpu/webgraphicscontext3d_in_process_impl.cc +++ b/webkit/gpu/webgraphicscontext3d_in_process_impl.cc @@ -1797,7 +1797,11 @@ bool WebGraphicsContext3DInProcessImpl::AngleValidateShaderSource( char* source = entry->source.get(); if (!ShCompile(compiler, &source, 1, SH_OBJECT_CODE)) { +#if !defined(ANGLE_SH_VERSION) || ANGLE_SH_VERSION < 108 int logSize = 0; +#else + size_t logSize = 0; +#endif ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &logSize); if (logSize > 1) { entry->log.reset(new char[logSize]); @@ -1806,7 +1810,11 @@ bool WebGraphicsContext3DInProcessImpl::AngleValidateShaderSource( return false; } +#if !defined(ANGLE_SH_VERSION) || ANGLE_SH_VERSION < 108 int length = 0; +#else + size_t length = 0; +#endif ShGetInfo(compiler, SH_OBJECT_CODE_LENGTH, &length); if (length > 1) { entry->translated_source.reset(new char[length]); |