Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Unified Diff: gpu/command_buffer/service/context_state.cc

Issue 205843002: GPU: Only restore one texture unit in ScopedTextureBinder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Mock. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/context_state.h ('k') | gpu/command_buffer/service/gl_state_restorer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/context_state.cc
diff --git a/gpu/command_buffer/service/context_state.cc b/gpu/command_buffer/service/context_state.cc
index 88358ef80f9ba7bcd34bba26b3758251cee36391..f046872a72ff9887d9bbb89de3b807c46a195c6e 100644
--- a/gpu/command_buffer/service/context_state.cc
+++ b/gpu/command_buffer/service/context_state.cc
@@ -46,6 +46,38 @@ GLuint GetArbServiceId(const TextureUnit& unit) {
? unit.bound_texture_rectangle_arb->service_id() : 0;
}
+GLuint GetServiceId(const TextureUnit& unit, GLuint target) {
+ switch (target) {
+ case GL_TEXTURE_2D:
+ return Get2dServiceId(unit);
+ case GL_TEXTURE_CUBE_MAP:
+ return GetCubeServiceId(unit);
+ case GL_TEXTURE_RECTANGLE_ARB:
+ return GetArbServiceId(unit);
+ case GL_TEXTURE_EXTERNAL_OES:
+ return GetOesServiceId(unit);
+ default:
+ NOTREACHED();
+ return 0;
+ }
+}
+
+bool TargetIsSupported(const FeatureInfo* feature_info, GLuint target) {
+ switch (target) {
+ case GL_TEXTURE_2D:
+ return true;
+ case GL_TEXTURE_CUBE_MAP:
+ return true;
+ case GL_TEXTURE_RECTANGLE_ARB:
+ return feature_info->feature_flags().arb_texture_rectangle;
+ case GL_TEXTURE_EXTERNAL_OES:
+ return feature_info->feature_flags().oes_egl_image_external;
+ default:
+ NOTREACHED();
+ return false;
+ }
+}
+
} // anonymous namespace.
TextureUnit::TextureUnit()
@@ -147,6 +179,13 @@ void ContextState::RestoreAllTextureUnitBindings(
RestoreActiveTexture();
}
+void ContextState::RestoreActiveTextureUnitBinding(unsigned int target) const {
+ DCHECK_LT(active_texture_unit, texture_units.size());
+ const TextureUnit& texture_unit = texture_units[active_texture_unit];
+ if (TargetIsSupported(feature_info_, target))
+ glBindTexture(target, GetServiceId(texture_unit, target));
+}
+
void ContextState::RestoreAttribute(GLuint attrib_index) const {
const VertexAttrib* attrib =
vertex_attrib_manager->GetVertexAttrib(attrib_index);
« no previous file with comments | « gpu/command_buffer/service/context_state.h ('k') | gpu/command_buffer/service/gl_state_restorer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698