OLD | NEW |
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 12 matching lines...) Expand all Loading... |
23 #include "base/trace_event/process_memory_dump.h" | 23 #include "base/trace_event/process_memory_dump.h" |
24 #include "gpu/command_buffer/client/buffer_tracker.h" | 24 #include "gpu/command_buffer/client/buffer_tracker.h" |
25 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 25 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
26 #include "gpu/command_buffer/client/gpu_control.h" | 26 #include "gpu/command_buffer/client/gpu_control.h" |
27 #include "gpu/command_buffer/client/program_info_manager.h" | 27 #include "gpu/command_buffer/client/program_info_manager.h" |
28 #include "gpu/command_buffer/client/query_tracker.h" | 28 #include "gpu/command_buffer/client/query_tracker.h" |
29 #include "gpu/command_buffer/client/transfer_buffer.h" | 29 #include "gpu/command_buffer/client/transfer_buffer.h" |
30 #include "gpu/command_buffer/client/vertex_array_object_manager.h" | 30 #include "gpu/command_buffer/client/vertex_array_object_manager.h" |
31 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 31 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
32 #include "gpu/command_buffer/common/id_allocator.h" | 32 #include "gpu/command_buffer/common/id_allocator.h" |
33 #include "gpu/command_buffer/common/sync_token.h" | |
34 #include "gpu/command_buffer/common/trace_event.h" | 33 #include "gpu/command_buffer/common/trace_event.h" |
35 #include "ui/gfx/geometry/rect.h" | 34 #include "ui/gfx/geometry/rect.h" |
36 #include "ui/gfx/geometry/rect_f.h" | 35 #include "ui/gfx/geometry/rect_f.h" |
37 | 36 |
38 #if defined(GPU_CLIENT_DEBUG) | 37 #if defined(GPU_CLIENT_DEBUG) |
39 #include "base/command_line.h" | 38 #include "base/command_line.h" |
40 #include "gpu/command_buffer/client/gpu_switches.h" | 39 #include "gpu/command_buffer/client/gpu_switches.h" |
41 #endif | 40 #endif |
42 | 41 |
43 namespace gpu { | 42 namespace gpu { |
(...skipping 5338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5382 return; | 5381 return; |
5383 } else if (!gpu_control_->IsFenceSyncFlushed(fence_sync)) { | 5382 } else if (!gpu_control_->IsFenceSyncFlushed(fence_sync)) { |
5384 SetGLError(GL_INVALID_OPERATION, "glGenSyncTokenCHROMIUM", | 5383 SetGLError(GL_INVALID_OPERATION, "glGenSyncTokenCHROMIUM", |
5385 "fence sync must be flushed before generating sync token"); | 5384 "fence sync must be flushed before generating sync token"); |
5386 return; | 5385 return; |
5387 } | 5386 } |
5388 | 5387 |
5389 SyncToken* sync_token_data = reinterpret_cast<SyncToken*>(sync_token); | 5388 SyncToken* sync_token_data = reinterpret_cast<SyncToken*>(sync_token); |
5390 memset(sync_token_data, 0, sizeof(SyncToken)); | 5389 memset(sync_token_data, 0, sizeof(SyncToken)); |
5391 | 5390 |
5392 sync_token_data->SetData(gpu_control_->GetNamespaceID(), | 5391 sync_token_data->namespace_id = gpu_control_->GetNamespaceID(); |
5393 gpu_control_->GetCommandBufferID(), | 5392 sync_token_data->command_buffer_id = gpu_control_->GetCommandBufferID(); |
5394 fence_sync); | 5393 sync_token_data->release_count = fence_sync; |
5395 } | 5394 } |
5396 | 5395 |
5397 void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) { | 5396 void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) { |
5398 if (!sync_token) { | 5397 if (!sync_token) { |
5399 SetGLError(GL_INVALID_VALUE, "glWaitSyncTokenCHROMIUM", "empty sync_token"); | 5398 SetGLError(GL_INVALID_VALUE, "glWaitSyncTokenCHROMIUM", "empty sync_token"); |
5400 return; | 5399 return; |
5401 }; | 5400 }; |
5402 | 5401 |
5403 const SyncToken* sync_token_data = | 5402 const SyncToken* sync_token_data = |
5404 reinterpret_cast<const SyncToken*>(sync_token); | 5403 reinterpret_cast<const SyncToken*>(sync_token); |
5405 helper_->WaitSyncTokenCHROMIUM(sync_token_data->GetNamespaceId(), | 5404 helper_->WaitSyncTokenCHROMIUM(sync_token_data->namespace_id, |
5406 sync_token_data->GetCommandBufferId(), | 5405 sync_token_data->command_buffer_id, |
5407 sync_token_data->GetReleaseCount()); | 5406 sync_token_data->release_count); |
5408 } | 5407 } |
5409 | 5408 |
5410 namespace { | 5409 namespace { |
5411 | 5410 |
5412 bool ValidImageFormat(GLenum internalformat, | 5411 bool ValidImageFormat(GLenum internalformat, |
5413 const Capabilities& capabilities) { | 5412 const Capabilities& capabilities) { |
5414 switch (internalformat) { | 5413 switch (internalformat) { |
5415 case GL_ATC_RGB_AMD: | 5414 case GL_ATC_RGB_AMD: |
5416 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: | 5415 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: |
5417 return capabilities.texture_format_atc; | 5416 return capabilities.texture_format_atc; |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5925 CheckGLError(); | 5924 CheckGLError(); |
5926 } | 5925 } |
5927 | 5926 |
5928 // Include the auto-generated part of this file. We split this because it means | 5927 // Include the auto-generated part of this file. We split this because it means |
5929 // we can easily edit the non-auto generated parts right here in this file | 5928 // we can easily edit the non-auto generated parts right here in this file |
5930 // instead of having to edit some template or the code generator. | 5929 // instead of having to edit some template or the code generator. |
5931 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 5930 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
5932 | 5931 |
5933 } // namespace gles2 | 5932 } // namespace gles2 |
5934 } // namespace gpu | 5933 } // namespace gpu |
OLD | NEW |