diff options
author | kkinnunen <kkinnunen@nvidia.com> | 2015-12-04 01:36:31 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-04 09:37:12 +0000 |
commit | 8cefb231216c2777281f37a30e3fb8e67513ee2b (patch) | |
tree | 2d0163eed0729e5f7a8fb55fb03b034eddcb5305 /gpu/command_buffer/client/program_info_manager.cc | |
parent | 91db68e8cb2080d1e9e07858efea3f7e198112a9 (diff) | |
download | chromium_src-8cefb231216c2777281f37a30e3fb8e67513ee2b.zip chromium_src-8cefb231216c2777281f37a30e3fb8e67513ee2b.tar.gz chromium_src-8cefb231216c2777281f37a30e3fb8e67513ee2b.tar.bz2 |
command_buffer: Implement EXT_blend_func_extended
Implement EXT_blend_func_extended for command buffer ES 2.0 and ES 3.0
contexts.
For the ES 2.0 context, the extension supports dual-source blending with
pre-defined gl_SecondaryFragColorEXT and gl_SecondaryFragDataEXT
variables.
Currently EXT_blend_func_extended is only exposed if the service context
supports program interface query. This means OpenGL context or OpenGL
ES 3.1 context. This is to simplify the unit test expectation conditions.
Theoretically also ES 2.0 and ES 3.0 service contexts could support
EXT_blend_func_extended, but probably there will never be such a driver.
BUG=506765
Review URL: https://codereview.chromium.org/1309743005
Cr-Commit-Position: refs/heads/master@{#363175}
Diffstat (limited to 'gpu/command_buffer/client/program_info_manager.cc')
-rw-r--r-- | gpu/command_buffer/client/program_info_manager.cc | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gpu/command_buffer/client/program_info_manager.cc b/gpu/command_buffer/client/program_info_manager.cc index 939473a..d047b57 100644 --- a/gpu/command_buffer/client/program_info_manager.cc +++ b/gpu/command_buffer/client/program_info_manager.cc @@ -160,6 +160,19 @@ GLuint ProgramInfoManager::Program::GetUniformIndex( return GL_INVALID_INDEX; } +GLint ProgramInfoManager::Program::GetFragDataIndex( + const std::string& name) const { + auto iter = frag_data_indices_.find(name); + if (iter == frag_data_indices_.end()) + return -1; + return iter->second; +} + +void ProgramInfoManager::Program::CacheFragDataIndex(const std::string& name, + GLint index) { + frag_data_indices_[name] = index; +} + GLint ProgramInfoManager::Program::GetFragDataLocation( const std::string& name) const { base::hash_map<std::string, GLint>::const_iterator iter = @@ -725,6 +738,31 @@ GLint ProgramInfoManager::GetUniformLocation( return gl->GetUniformLocationHelper(program, name); } +GLint ProgramInfoManager::GetFragDataIndex(GLES2Implementation* gl, + GLuint program, + const char* name) { + // TODO(zmo): make FragData indexes part of the ProgramInfo that are + // fetched from the service side. See crbug.com/452104. + { + base::AutoLock auto_lock(lock_); + Program* info = GetProgramInfo(gl, program, kNone); + if (info) { + GLint possible_index = info->GetFragDataIndex(name); + if (possible_index != -1) + return possible_index; + } + } + GLint index = gl->GetFragDataIndexEXTHelper(program, name); + if (index != -1) { + base::AutoLock auto_lock(lock_); + Program* info = GetProgramInfo(gl, program, kNone); + if (info) { + info->CacheFragDataIndex(name, index); + } + } + return index; +} + GLint ProgramInfoManager::GetFragDataLocation( GLES2Implementation* gl, GLuint program, const char* name) { // TODO(zmo): make FragData locations part of the ProgramInfo that are |