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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A class to emulate GLES2 over command buffers. 5 // A class to emulate GLES2 over command buffers.
6 6
7 #include "gpu/command_buffer/client/gles2_implementation.h" 7 #include "gpu/command_buffer/client/gles2_implementation.h"
8 8
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
(...skipping 6267 matching lines...) Expand 10 before | Expand all | Expand 10 after
6278 << "] glCreateGpuMemoryBufferImageCHROMIUM(" << width 6278 << "] glCreateGpuMemoryBufferImageCHROMIUM(" << width
6279 << ", " << height << ", " 6279 << ", " << height << ", "
6280 << GLES2Util::GetStringImageInternalFormat(internalformat) 6280 << GLES2Util::GetStringImageInternalFormat(internalformat)
6281 << ", " << GLES2Util::GetStringImageUsage(usage) << ")"); 6281 << ", " << GLES2Util::GetStringImageUsage(usage) << ")");
6282 GLuint image_id = CreateGpuMemoryBufferImageCHROMIUMHelper( 6282 GLuint image_id = CreateGpuMemoryBufferImageCHROMIUMHelper(
6283 width, height, internalformat, usage); 6283 width, height, internalformat, usage);
6284 CheckGLError(); 6284 CheckGLError();
6285 return image_id; 6285 return image_id;
6286 } 6286 }
6287 6287
6288 GLuint GLES2Implementation::CreateFenceCHROMIUMHelper(ClientFence fence) {
6289 int32_t fence_id = gpu_control_->CreateFence(fence);
6290 if (fence_id < 0) {
6291 SetGLError(GL_OUT_OF_MEMORY, "glCreateFenceCHROMIUM", "fence_id < 0");
6292 return 0;
6293 }
6294 return fence_id;
6295 }
6296
6297 GLuint GLES2Implementation::CreateFenceCHROMIUM(ClientFence fence) {
6298 GPU_CLIENT_SINGLE_THREAD_CHECK();
6299 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateFenceCHROMIUM()");
6300 GLuint fence_id = CreateFenceCHROMIUMHelper(fence);
6301 CheckGLError();
6302 return fence_id;
6303 }
6304
6305 void GLES2Implementation::DestroyFenceCHROMIUMHelper(GLuint fence_id) {
6306 // Flush the command stream to make sure all pending commands
6307 // that may refer to the fence_id are executed on the service side.
6308 helper_->CommandBufferHelper::Flush();
6309 gpu_control_->DestroyFence(fence_id);
6310 }
6311
6312 void GLES2Implementation::DestroyFenceCHROMIUM(GLuint fence_id) {
6313 GPU_CLIENT_SINGLE_THREAD_CHECK();
6314 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDestroyFenceCHROMIUM("
6315 << fence_id << ")");
6316 DestroyFenceCHROMIUMHelper(fence_id);
6317 CheckGLError();
6318 }
6319
6288 bool GLES2Implementation::ValidateSize(const char* func, GLsizeiptr size) { 6320 bool GLES2Implementation::ValidateSize(const char* func, GLsizeiptr size) {
6289 if (size < 0) { 6321 if (size < 0) {
6290 SetGLError(GL_INVALID_VALUE, func, "size < 0"); 6322 SetGLError(GL_INVALID_VALUE, func, "size < 0");
6291 return false; 6323 return false;
6292 } 6324 }
6293 if (!base::IsValueInRangeForNumericType<int32_t>(size)) { 6325 if (!base::IsValueInRangeForNumericType<int32_t>(size)) {
6294 SetGLError(GL_INVALID_OPERATION, func, "size more than 32-bit"); 6326 SetGLError(GL_INVALID_OPERATION, func, "size more than 32-bit");
6295 return false; 6327 return false;
6296 } 6328 }
6297 return true; 6329 return true;
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
7030 cached_extensions_.clear(); 7062 cached_extensions_.clear();
7031 } 7063 }
7032 7064
7033 // Include the auto-generated part of this file. We split this because it means 7065 // Include the auto-generated part of this file. We split this because it means
7034 // we can easily edit the non-auto generated parts right here in this file 7066 // we can easily edit the non-auto generated parts right here in this file
7035 // instead of having to edit some template or the code generator. 7067 // instead of having to edit some template or the code generator.
7036 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 7068 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
7037 7069
7038 } // namespace gles2 7070 } // namespace gles2
7039 } // namespace gpu 7071 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698