OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "modules/webgl/WebGLTimerQueryEXT.h" | 5 #include "modules/webgl/WebGLTimerQueryEXT.h" |
6 | 6 |
7 #include "core/dom/TaskRunnerHelper.h" | 7 #include "core/dom/TaskRunnerHelper.h" |
8 #include "gpu/command_buffer/client/gles2_interface.h" | 8 #include "gpu/command_buffer/client/gles2_interface.h" |
9 #include "modules/webgl/WebGLRenderingContextBase.h" | 9 #include "modules/webgl/WebGLRenderingContextBase.h" |
10 #include "public/platform/Platform.h" | 10 #include "public/platform/Platform.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 void WebGLTimerQueryEXT::updateCachedResult(gpu::gles2::GLES2Interface* gl) { | 49 void WebGLTimerQueryEXT::updateCachedResult(gpu::gles2::GLES2Interface* gl) { |
50 if (m_queryResultAvailable) | 50 if (m_queryResultAvailable) |
51 return; | 51 return; |
52 | 52 |
53 if (!m_canUpdateAvailability) | 53 if (!m_canUpdateAvailability) |
54 return; | 54 return; |
55 | 55 |
56 if (!hasTarget()) | 56 if (!hasTarget()) |
57 return; | 57 return; |
58 | 58 |
59 // If this is a timestamp query, set the result to 0 and make it available as
we don't support timestamps in WebGL due to very poor driver support for them | 59 // If this is a timestamp query, set the result to 0 and make it available as |
| 60 // we don't support timestamps in WebGL due to very poor driver support for |
| 61 // them. |
60 if (m_target == GL_TIMESTAMP_EXT) { | 62 if (m_target == GL_TIMESTAMP_EXT) { |
61 m_queryResult = 0; | 63 m_queryResult = 0; |
62 m_queryResultAvailable = true; | 64 m_queryResultAvailable = true; |
63 return; | 65 return; |
64 } | 66 } |
65 | 67 |
66 // We can only update the cached result when control returns to the browser. | 68 // We can only update the cached result when control returns to the browser. |
67 m_canUpdateAvailability = false; | 69 m_canUpdateAvailability = false; |
68 GLuint available = 0; | 70 GLuint available = 0; |
69 gl->GetQueryObjectuivEXT(object(), GL_QUERY_RESULT_AVAILABLE_EXT, &available); | 71 gl->GetQueryObjectuivEXT(object(), GL_QUERY_RESULT_AVAILABLE_EXT, &available); |
(...skipping 25 matching lines...) Expand all Loading... |
95 if (!m_cancellableTaskFactory->isPending()) | 97 if (!m_cancellableTaskFactory->isPending()) |
96 m_taskRunner->postTask(BLINK_FROM_HERE, | 98 m_taskRunner->postTask(BLINK_FROM_HERE, |
97 m_cancellableTaskFactory->cancelAndCreate()); | 99 m_cancellableTaskFactory->cancelAndCreate()); |
98 } | 100 } |
99 | 101 |
100 void WebGLTimerQueryEXT::allowAvailabilityUpdate() { | 102 void WebGLTimerQueryEXT::allowAvailabilityUpdate() { |
101 m_canUpdateAvailability = true; | 103 m_canUpdateAvailability = true; |
102 } | 104 } |
103 | 105 |
104 } // namespace blink | 106 } // namespace blink |
OLD | NEW |