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 "modules/webgl/WebGLRenderingContextBase.h" | 7 #include "modules/webgl/WebGLRenderingContextBase.h" |
8 #include "public/platform/Platform.h" | 8 #include "public/platform/Platform.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 { | 49 { |
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 a
s we don't support timestamps in WebGL due to very poor driver support for them |
| 60 if (m_target == GL_TIMESTAMP_EXT) { |
| 61 m_queryResult = 0; |
| 62 m_queryResultAvailable = true; |
| 63 return; |
| 64 } |
| 65 |
59 // We can only update the cached result when control returns to the browser. | 66 // We can only update the cached result when control returns to the browser. |
60 m_canUpdateAvailability = false; | 67 m_canUpdateAvailability = false; |
61 GLuint available = 0; | 68 GLuint available = 0; |
62 ctx->getQueryObjectuivEXT(object(), GL_QUERY_RESULT_AVAILABLE_EXT, &availabl
e); | 69 ctx->getQueryObjectuivEXT(object(), GL_QUERY_RESULT_AVAILABLE_EXT, &availabl
e); |
63 m_queryResultAvailable = !!available; | 70 m_queryResultAvailable = !!available; |
64 if (m_queryResultAvailable) { | 71 if (m_queryResultAvailable) { |
65 GLuint64 result = 0; | 72 GLuint64 result = 0; |
66 ctx->getQueryObjectui64vEXT(object(), GL_QUERY_RESULT_EXT, &result); | 73 ctx->getQueryObjectui64vEXT(object(), GL_QUERY_RESULT_EXT, &result); |
67 m_queryResult = result; | 74 m_queryResult = result; |
68 unregisterTaskObserver(); | 75 unregisterTaskObserver(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 Platform::current()->currentThread()->removeTaskObserver(this); | 107 Platform::current()->currentThread()->removeTaskObserver(this); |
101 } | 108 } |
102 } | 109 } |
103 | 110 |
104 void WebGLTimerQueryEXT::didProcessTask() | 111 void WebGLTimerQueryEXT::didProcessTask() |
105 { | 112 { |
106 m_canUpdateAvailability = true; | 113 m_canUpdateAvailability = true; |
107 } | 114 } |
108 | 115 |
109 } // namespace blink | 116 } // namespace blink |
OLD | NEW |