diff options
author | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-05 19:56:36 +0000 |
---|---|---|
committer | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-05 19:56:36 +0000 |
commit | b3cbad18d0dfda956b782ce575b632f4de785d55 (patch) | |
tree | 8613688a238fe36277b18035c2b5998f2fd84920 /gpu | |
parent | ce19e7b570c970a9a800483baf6c30308e5ee754 (diff) | |
download | chromium_src-b3cbad18d0dfda956b782ce575b632f4de785d55.zip chromium_src-b3cbad18d0dfda956b782ce575b632f4de785d55.tar.gz chromium_src-b3cbad18d0dfda956b782ce575b632f4de785d55.tar.bz2 |
Advertise extensions for virtual GL api.
Also restore GL_TEXTURE_EXTERNAL_OES binding.
BUG=160710
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/11418300
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171286 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/service/context_state.cc | 19 | ||||
-rw-r--r-- | gpu/command_buffer/service/context_state.h | 6 | ||||
-rw-r--r-- | gpu/command_buffer/service/gl_context_virtual.cc | 4 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 1 |
4 files changed, 24 insertions, 6 deletions
diff --git a/gpu/command_buffer/service/context_state.cc b/gpu/command_buffer/service/context_state.cc index a0e2c8c..9942e9d 100644 --- a/gpu/command_buffer/service/context_state.cc +++ b/gpu/command_buffer/service/context_state.cc @@ -30,13 +30,14 @@ TextureUnit::TextureUnit() TextureUnit::~TextureUnit() { } -ContextState::ContextState() +ContextState::ContextState(FeatureInfo* feature_info) : pack_alignment(4), unpack_alignment(4), active_texture_unit(0), hint_generate_mipmap(GL_DONT_CARE), hint_fragment_shader_derivative(GL_DONT_CARE), - pack_reverse_row_order(false) { + pack_reverse_row_order(false), + feature_info_(feature_info) { Initialize(); } @@ -64,8 +65,18 @@ void ContextState::RestoreState() const { service_id = texture_unit.bound_texture_cube_map ? texture_unit.bound_texture_cube_map->service_id() : 0; glBindTexture(GL_TEXTURE_CUBE_MAP, service_id); - // TODO: Restore bindings for GL_TEXTURE_RECTANGLE_ARB and - // GL_TEXTURE_EXTERNAL_OES. + + if (feature_info_->feature_flags().oes_egl_image_external) { + service_id = texture_unit.bound_texture_external_oes ? + texture_unit.bound_texture_external_oes->service_id() : 0; + glBindTexture(GL_TEXTURE_EXTERNAL_OES, service_id); + } + + if (feature_info_->feature_flags().arb_texture_rectangle) { + service_id = texture_unit.bound_texture_rectangle_arb ? + texture_unit.bound_texture_rectangle_arb->service_id() : 0; + glBindTexture(GL_TEXTURE_RECTANGLE_ARB, service_id); + } } glActiveTexture(GL_TEXTURE0 + active_texture_unit); diff --git a/gpu/command_buffer/service/context_state.h b/gpu/command_buffer/service/context_state.h index d2f428b..18e8a36 100644 --- a/gpu/command_buffer/service/context_state.h +++ b/gpu/command_buffer/service/context_state.h @@ -23,6 +23,8 @@ namespace gpu { namespace gles2 { +class FeatureInfo; + // State associated with each texture unit. struct GPU_EXPORT TextureUnit { TextureUnit(); @@ -88,7 +90,7 @@ struct Vec4 { }; struct GPU_EXPORT ContextState { - ContextState(); + explicit ContextState(FeatureInfo* feature_info); ~ContextState(); void Initialize(); @@ -148,6 +150,8 @@ struct GPU_EXPORT ContextState { GLenum hint_fragment_shader_derivative; bool pack_reverse_row_order; + + FeatureInfo* feature_info_; }; } // namespace gles2 diff --git a/gpu/command_buffer/service/gl_context_virtual.cc b/gpu/command_buffer/service/gl_context_virtual.cc index ff5fd20..4632650 100644 --- a/gpu/command_buffer/service/gl_context_virtual.cc +++ b/gpu/command_buffer/service/gl_context_virtual.cc @@ -18,7 +18,6 @@ GLContextVirtual::GLContextVirtual( display_(NULL), state_restorer_(new GLStateRestorerImpl(decoder)), decoder_(decoder) { - shared_context_->SetupForVirtualization(); } gfx::Display* GLContextVirtual::display() { @@ -32,11 +31,14 @@ bool GLContextVirtual::Initialize( if (!shared_context_->MakeCurrent(compatible_surface)) return false; + shared_context_->SetupForVirtualization(); + shared_context_->ReleaseCurrent(compatible_surface); return true; } void GLContextVirtual::Destroy() { + shared_context_->OnDestroyVirtualContext(this); shared_context_ = NULL; display_ = NULL; } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 06dea03..b1292f0 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -1933,6 +1933,7 @@ GLES2Decoder* GLES2Decoder::Create(ContextGroup* group) { GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group) : GLES2Decoder(), group_(group), + state_(group_->feature_info()), error_bits_(0), unpack_flip_y_(false), unpack_premultiply_alpha_(false), |