OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "../client/gles2_implementation.h" | 7 #include "../client/gles2_implementation.h" |
8 | 8 |
9 #include <GLES2/gl2ext.h> | 9 #include <GLES2/gl2ext.h> |
10 #include <GLES2/gles2_command_buffer.h> | |
11 #include "../client/mapped_memory.h" | 10 #include "../client/mapped_memory.h" |
12 #include "../client/program_info_manager.h" | 11 #include "../client/program_info_manager.h" |
13 #include "../common/gles2_cmd_utils.h" | 12 #include "../common/gles2_cmd_utils.h" |
14 #include "../common/id_allocator.h" | 13 #include "../common/id_allocator.h" |
15 #include "../common/trace_event.h" | 14 #include "../common/trace_event.h" |
16 | 15 |
17 #if defined(__native_client__) && !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) | 16 #if defined(__native_client__) && !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) |
18 #define GLES2_SUPPORT_CLIENT_SIDE_ARRAYS | 17 #define GLES2_SUPPORT_CLIENT_SIDE_ARRAYS |
19 #endif | 18 #endif |
20 | 19 |
(...skipping 2120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2141 index, pname, result_shm_id(), result_shm_offset()); | 2140 index, pname, result_shm_id(), result_shm_offset()); |
2142 WaitForCmd(); | 2141 WaitForCmd(); |
2143 result->CopyResult(params); | 2142 result->CopyResult(params); |
2144 GPU_CLIENT_LOG_CODE_BLOCK({ | 2143 GPU_CLIENT_LOG_CODE_BLOCK({ |
2145 for (int32 i = 0; i < result->GetNumResults(); ++i) { | 2144 for (int32 i = 0; i < result->GetNumResults(); ++i) { |
2146 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); | 2145 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); |
2147 } | 2146 } |
2148 }); | 2147 }); |
2149 } | 2148 } |
2150 | 2149 |
2151 GLboolean GLES2Implementation::CommandBufferEnableCHROMIUM( | 2150 GLboolean GLES2Implementation::EnableFeatureCHROMIUM( |
2152 const char* feature) { | 2151 const char* feature) { |
2153 GPU_CLIENT_LOG("[" << this << "] glCommandBufferEnableCHROMIUM(" | 2152 GPU_CLIENT_LOG("[" << this << "] glEnableFeatureCHROMIUM(" |
2154 << feature << ")"); | 2153 << feature << ")"); |
2155 TRACE_EVENT0("gpu", "GLES2::CommandBufferEnableCHROMIUM"); | 2154 TRACE_EVENT0("gpu", "GLES2::EnableFeatureCHROMIUM"); |
2156 typedef CommandBufferEnableCHROMIUM::Result Result; | 2155 typedef EnableFeatureCHROMIUM::Result Result; |
2157 Result* result = GetResultAs<Result*>(); | 2156 Result* result = GetResultAs<Result*>(); |
2158 *result = 0; | 2157 *result = 0; |
2159 SetBucketAsCString(kResultBucketId, feature); | 2158 SetBucketAsCString(kResultBucketId, feature); |
2160 helper_->CommandBufferEnableCHROMIUM( | 2159 helper_->EnableFeatureCHROMIUM( |
2161 kResultBucketId, result_shm_id(), result_shm_offset()); | 2160 kResultBucketId, result_shm_id(), result_shm_offset()); |
2162 WaitForCmd(); | 2161 WaitForCmd(); |
2163 helper_->SetBucketSize(kResultBucketId, 0); | 2162 helper_->SetBucketSize(kResultBucketId, 0); |
2164 GPU_CLIENT_LOG(" returned " << GLES2Util::GetStringBool(*result)); | 2163 GPU_CLIENT_LOG(" returned " << GLES2Util::GetStringBool(*result)); |
2165 return *result; | 2164 return *result; |
2166 } | 2165 } |
2167 | 2166 |
2168 void* GLES2Implementation::MapBufferSubDataCHROMIUM( | 2167 void* GLES2Implementation::MapBufferSubDataCHROMIUM( |
2169 GLuint target, GLintptr offset, GLsizeiptr size, GLenum access) { | 2168 GLuint target, GLintptr offset, GLsizeiptr size, GLenum access) { |
2170 GPU_CLIENT_LOG("[" << this << "] glMapBufferSubDataCHROMIUM(" | 2169 GPU_CLIENT_LOG("[" << this << "] glMapBufferSubDataCHROMIUM(" |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2422 if (static_cast<size_t>(bufsize) < result.size()) { | 2421 if (static_cast<size_t>(bufsize) < result.size()) { |
2423 SetGLError(GL_INVALID_OPERATION, | 2422 SetGLError(GL_INVALID_OPERATION, |
2424 "glProgramInfoCHROMIUM: bufsize is too small for result."); | 2423 "glProgramInfoCHROMIUM: bufsize is too small for result."); |
2425 return; | 2424 return; |
2426 } | 2425 } |
2427 memcpy(info, &result[0], result.size()); | 2426 memcpy(info, &result[0], result.size()); |
2428 } | 2427 } |
2429 | 2428 |
2430 } // namespace gles2 | 2429 } // namespace gles2 |
2431 } // namespace gpu | 2430 } // namespace gpu |
OLD | NEW |