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

Unified Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 2814583002: Service/ClientDiscardableManager (Closed)
Patch Set: rebase Created 3 years, 7 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
Index: gpu/command_buffer/client/gles2_implementation.cc
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 1d75323d8c254ac7c3f7d4a0254610548cb477cb..38975cc581b68133c8ad5d9f6b186e3015f6b89e 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -4630,6 +4630,8 @@ void GLES2Implementation::DeleteTexturesHelper(
return;
}
for (GLsizei ii = 0; ii < n; ++ii) {
+ share_group_->discardable_manager()->FreeTexture(textures[ii]);
+
for (GLint tt = 0; tt < capabilities_.max_combined_texture_image_units;
++tt) {
TextureUnit& unit = texture_units_[tt];
@@ -7038,6 +7040,47 @@ void GLES2Implementation::ProgramPathFragmentInputGenCHROMIUM(
CheckGLError();
}
+void GLES2Implementation::InitializeDiscardableTextureCHROMIUM(
+ GLuint texture_id) {
+ ClientDiscardableManager* manager = share_group()->discardable_manager();
+ if (manager->TextureIsValid(texture_id)) {
+ SetGLError(GL_INVALID_VALUE, "glInitializeDiscardableTextureCHROMIUM",
+ "Texture ID already initialized");
+ return;
+ }
+ ClientDiscardableHandle handle =
+ manager->InitializeTexture(helper_->command_buffer(), texture_id);
+ helper_->InitializeDiscardableTextureCHROMIUM(texture_id, handle.shm_id(),
+ handle.byte_offset());
+}
+
+void GLES2Implementation::UnlockDiscardableTextureCHROMIUM(GLuint texture_id) {
+ ClientDiscardableManager* manager = share_group()->discardable_manager();
+ if (!manager->TextureIsValid(texture_id)) {
+ SetGLError(GL_INVALID_VALUE, "glUnlockDiscardableTextureCHROMIUM",
+ "Texture ID not initialized");
+ return;
+ }
+ helper_->UnlockDiscardableTextureCHROMIUM(texture_id);
+}
+
+bool GLES2Implementation::LockDiscardableTextureCHROMIUM(GLuint texture_id) {
+ ClientDiscardableManager* manager = share_group()->discardable_manager();
+ if (!manager->TextureIsValid(texture_id)) {
+ SetGLError(GL_INVALID_VALUE, "glLockDiscardableTextureCHROMIUM",
+ "Texture ID not initialized");
+ return false;
+ }
+ if (!manager->LockTexture(texture_id)) {
+ // Failure to lock means that this texture has been deleted on the service
+ // side. Delete it here as well.
+ DeleteTexturesHelper(1, &texture_id);
+ return false;
+ }
+ helper_->LockDiscardableTextureCHROMIUM(texture_id);
+ return true;
+}
+
void GLES2Implementation::UpdateCachedExtensionsIfNeeded() {
if (cached_extension_string_) {
return;
« no previous file with comments | « gpu/command_buffer/client/gles2_cmd_helper_autogen.h ('k') | gpu/command_buffer/client/gles2_implementation_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698