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/gl2ext.h> | 9 #include <GLES2/gl2ext.h> |
10 #include <GLES2/gl2extchromium.h> | 10 #include <GLES2/gl2extchromium.h> |
11 #include <GLES3/gl3.h> | 11 #include <GLES3/gl3.h> |
12 #include <algorithm> | 12 #include <algorithm> |
13 #include <limits> | 13 #include <limits> |
14 #include <map> | 14 #include <map> |
15 #include <queue> | 15 #include <queue> |
16 #include <set> | 16 #include <set> |
17 #include <sstream> | 17 #include <sstream> |
18 #include <string> | 18 #include <string> |
19 #include "base/bind.h" | 19 #include "base/bind.h" |
| 20 #include "base/compiler_specific.h" |
20 #include "base/numerics/safe_math.h" | 21 #include "base/numerics/safe_math.h" |
21 #include "gpu/command_buffer/client/buffer_tracker.h" | 22 #include "gpu/command_buffer/client/buffer_tracker.h" |
22 #include "gpu/command_buffer/client/gpu_control.h" | 23 #include "gpu/command_buffer/client/gpu_control.h" |
23 #include "gpu/command_buffer/client/program_info_manager.h" | 24 #include "gpu/command_buffer/client/program_info_manager.h" |
24 #include "gpu/command_buffer/client/query_tracker.h" | 25 #include "gpu/command_buffer/client/query_tracker.h" |
25 #include "gpu/command_buffer/client/transfer_buffer.h" | 26 #include "gpu/command_buffer/client/transfer_buffer.h" |
26 #include "gpu/command_buffer/client/vertex_array_object_manager.h" | 27 #include "gpu/command_buffer/client/vertex_array_object_manager.h" |
27 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 28 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
28 #include "gpu/command_buffer/common/trace_event.h" | 29 #include "gpu/command_buffer/common/trace_event.h" |
29 | 30 |
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 vertex_array_object_manager_->SetAttribDivisor(index, divisor); | 1233 vertex_array_object_manager_->SetAttribDivisor(index, divisor); |
1233 helper_->VertexAttribDivisorANGLE(index, divisor); | 1234 helper_->VertexAttribDivisorANGLE(index, divisor); |
1234 CheckGLError(); | 1235 CheckGLError(); |
1235 } | 1236 } |
1236 | 1237 |
1237 void GLES2Implementation::BufferDataHelper( | 1238 void GLES2Implementation::BufferDataHelper( |
1238 GLenum target, GLsizeiptr size, const void* data, GLenum usage) { | 1239 GLenum target, GLsizeiptr size, const void* data, GLenum usage) { |
1239 if (!ValidateSize("glBufferData", size)) | 1240 if (!ValidateSize("glBufferData", size)) |
1240 return; | 1241 return; |
1241 | 1242 |
| 1243 #if defined(MEMORY_SANITIZER) && !defined(OS_NACL) |
| 1244 // Do not upload uninitialized data. Even if it's not a bug, it can cause a |
| 1245 // bogus MSan report during a readback later. This is because MSan doesn't |
| 1246 // understand shared memory and would assume we were reading back the same |
| 1247 // unintialized data. |
| 1248 if (data) __msan_check_mem_is_initialized(data, size); |
| 1249 #endif |
| 1250 |
1242 GLuint buffer_id; | 1251 GLuint buffer_id; |
1243 if (GetBoundPixelTransferBuffer(target, "glBufferData", &buffer_id)) { | 1252 if (GetBoundPixelTransferBuffer(target, "glBufferData", &buffer_id)) { |
1244 if (!buffer_id) { | 1253 if (!buffer_id) { |
1245 return; | 1254 return; |
1246 } | 1255 } |
1247 | 1256 |
1248 BufferTracker::Buffer* buffer = buffer_tracker_->GetBuffer(buffer_id); | 1257 BufferTracker::Buffer* buffer = buffer_tracker_->GetBuffer(buffer_id); |
1249 if (buffer) | 1258 if (buffer) |
1250 RemoveTransferBuffer(buffer); | 1259 RemoveTransferBuffer(buffer); |
1251 | 1260 |
(...skipping 3121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4373 return false; | 4382 return false; |
4374 } | 4383 } |
4375 | 4384 |
4376 // Include the auto-generated part of this file. We split this because it means | 4385 // Include the auto-generated part of this file. We split this because it means |
4377 // we can easily edit the non-auto generated parts right here in this file | 4386 // we can easily edit the non-auto generated parts right here in this file |
4378 // instead of having to edit some template or the code generator. | 4387 // instead of having to edit some template or the code generator. |
4379 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 4388 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
4380 | 4389 |
4381 } // namespace gles2 | 4390 } // namespace gles2 |
4382 } // namespace gpu | 4391 } // namespace gpu |
OLD | NEW |