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 "gpu/command_buffer/client/gles2_interface.h" | 7 #include "gpu/command_buffer/client/gles2_interface.h" |
8 #include "modules/webgl/WebGLRenderingContextBase.h" | 8 #include "modules/webgl/WebGLRenderingContextBase.h" |
9 #include "public/platform/Platform.h" | 9 #include "public/platform/Platform.h" |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 { | 50 { |
51 if (m_queryResultAvailable) | 51 if (m_queryResultAvailable) |
52 return; | 52 return; |
53 | 53 |
54 if (!m_canUpdateAvailability) | 54 if (!m_canUpdateAvailability) |
55 return; | 55 return; |
56 | 56 |
57 if (!hasTarget()) | 57 if (!hasTarget()) |
58 return; | 58 return; |
59 | 59 |
| 60 // If this is a timestamp query, set the result to 0 and make it available a
s we don't support timestamps in WebGL due to very poor driver support for them |
| 61 if (m_target == GL_TIMESTAMP_EXT) { |
| 62 m_queryResult = 0; |
| 63 m_queryResultAvailable = true; |
| 64 return; |
| 65 } |
| 66 |
60 // We can only update the cached result when control returns to the browser. | 67 // We can only update the cached result when control returns to the browser. |
61 m_canUpdateAvailability = false; | 68 m_canUpdateAvailability = false; |
62 GLuint available = 0; | 69 GLuint available = 0; |
63 gl->GetQueryObjectuivEXT(object(), GL_QUERY_RESULT_AVAILABLE_EXT, &available
); | 70 gl->GetQueryObjectuivEXT(object(), GL_QUERY_RESULT_AVAILABLE_EXT, &available
); |
64 m_queryResultAvailable = !!available; | 71 m_queryResultAvailable = !!available; |
65 if (m_queryResultAvailable) { | 72 if (m_queryResultAvailable) { |
66 GLuint64 result = 0; | 73 GLuint64 result = 0; |
67 gl->GetQueryObjectui64vEXT(object(), GL_QUERY_RESULT_EXT, &result); | 74 gl->GetQueryObjectui64vEXT(object(), GL_QUERY_RESULT_EXT, &result); |
68 m_queryResult = result; | 75 m_queryResult = result; |
69 unregisterTaskObserver(); | 76 unregisterTaskObserver(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 Platform::current()->currentThread()->removeTaskObserver(this); | 108 Platform::current()->currentThread()->removeTaskObserver(this); |
102 } | 109 } |
103 } | 110 } |
104 | 111 |
105 void WebGLTimerQueryEXT::didProcessTask() | 112 void WebGLTimerQueryEXT::didProcessTask() |
106 { | 113 { |
107 m_canUpdateAvailability = true; | 114 m_canUpdateAvailability = true; |
108 } | 115 } |
109 | 116 |
110 } // namespace blink | 117 } // namespace blink |
OLD | NEW |