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

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

Issue 2383753002: gpu: Add GpuFence framework.
Patch Set: rebase Created 4 years, 1 month 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 3424bc2a5310224463bbed535e1e84eed8e336d0..5884f51c3a88900d8acf3545cb30ae438b605881 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -6285,6 +6285,38 @@ GLuint GLES2Implementation::CreateGpuMemoryBufferImageCHROMIUM(
return image_id;
}
+GLuint GLES2Implementation::CreateFenceCHROMIUMHelper(ClientFence fence) {
+ int32_t fence_id = gpu_control_->CreateFence(fence);
+ if (fence_id < 0) {
+ SetGLError(GL_OUT_OF_MEMORY, "glCreateFenceCHROMIUM", "fence_id < 0");
+ return 0;
+ }
+ return fence_id;
+}
+
+GLuint GLES2Implementation::CreateFenceCHROMIUM(ClientFence fence) {
+ GPU_CLIENT_SINGLE_THREAD_CHECK();
+ GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateFenceCHROMIUM()");
+ GLuint fence_id = CreateFenceCHROMIUMHelper(fence);
+ CheckGLError();
+ return fence_id;
+}
+
+void GLES2Implementation::DestroyFenceCHROMIUMHelper(GLuint fence_id) {
+ // Flush the command stream to make sure all pending commands
+ // that may refer to the fence_id are executed on the service side.
+ helper_->CommandBufferHelper::Flush();
+ gpu_control_->DestroyFence(fence_id);
+}
+
+void GLES2Implementation::DestroyFenceCHROMIUM(GLuint fence_id) {
+ GPU_CLIENT_SINGLE_THREAD_CHECK();
+ GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDestroyFenceCHROMIUM("
+ << fence_id << ")");
+ DestroyFenceCHROMIUMHelper(fence_id);
+ CheckGLError();
+}
+
bool GLES2Implementation::ValidateSize(const char* func, GLsizeiptr size) {
if (size < 0) {
SetGLError(GL_INVALID_VALUE, func, "size < 0");

Powered by Google App Engine
This is Rietveld 408576698