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

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

Issue 2818993002: GL Implementation for GPU Discardable
Patch Set: rebase Created 3 years, 8 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/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index b34e6909a82681ff189bf3e9dd063074748a2a8b..15e5376177728fd2a28759bf2c0923effd2f46c4 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -60,6 +60,7 @@
#include "gpu/command_buffer/service/query_manager.h"
#include "gpu/command_buffer/service/renderbuffer_manager.h"
#include "gpu/command_buffer/service/sampler_manager.h"
+#include "gpu/command_buffer/service/service_discardable_manager.h"
#include "gpu/command_buffer/service/shader_manager.h"
#include "gpu/command_buffer/service/shader_translator.h"
#include "gpu/command_buffer/service/texture_manager.h"
@@ -4211,6 +4212,9 @@ void GLES2DecoderImpl::DeleteTexturesHelper(GLsizei n,
->UnbindTexture(GL_FRAMEBUFFER, texture_ref);
}
}
+
+ GetContextGroup()->discardable_manager()->OnTextureDeleted(client_id,
+ group_.get());
RemoveTexture(client_id);
}
}
@@ -19576,6 +19580,43 @@ void GLES2DecoderImpl::RestoreAllExternalTextureBindingsIfNeeded() {
texture_manager()->GetServiceIdGeneration();
}
+error::Error GLES2DecoderImpl::HandleInitializeDiscardableTextureCHROMIUM(
+ uint32_t immediate_data_size,
+ const volatile void* cmd_data) {
+ const volatile gles2::cmds::InitializeDiscardableTextureCHROMIUM& c =
+ *static_cast<
+ const volatile gles2::cmds::InitializeDiscardableTextureCHROMIUM*>(
+ cmd_data);
+ TextureRef* texture = texture_manager()->GetTexture(c.texture_id);
+ if (!texture) {
+ LOCAL_SET_GL_ERROR(GL_INVALID_VALUE,
+ "glInitializeDiscardableTextureCHROMIUM",
+ "Invalid texture ID");
+ return error::kNoError;
+ }
+ size_t size = texture->texture()->estimated_size();
+ ServiceDiscardableHandle handle(GetSharedMemoryBuffer(c.shm_id), c.shm_offset,
+ c.shm_id);
+ GetContextGroup()->discardable_manager()->InsertLockedTexture(
+ c.texture_id, size, group_.get(), std::move(handle));
+ return error::kNoError;
+}
+
+error::Error GLES2DecoderImpl::HandleUnlockDiscardableTextureCHROMIUM(
+ uint32_t immediate_data_size,
+ const volatile void* cmd_data) {
+ const volatile gles2::cmds::UnlockDiscardableTextureCHROMIUM& c =
+ *static_cast<
+ const volatile gles2::cmds::UnlockDiscardableTextureCHROMIUM*>(
+ cmd_data);
+ if (!GetContextGroup()->discardable_manager()->UnlockTexture(c.texture_id,
+ group_.get())) {
+ LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glUnlockDiscardableTextureCHROMIUM",
+ "Texture ID not initialized");
+ }
+ return error::kNoError;
+}
+
// Include the auto-generated part of this file. We split this because it means
// we can easily edit the non-auto generated parts right here in this file
// instead of having to edit some template or the code generator.

Powered by Google App Engine
This is Rietveld 408576698