OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "config.h" | 5 #include "config.h" |
6 #include "ThrottledTextureUploader.h" | 6 #include "ThrottledTextureUploader.h" |
7 | 7 |
| 8 #include "third_party/khronos/GLES2/gl2.h" |
| 9 #include "third_party/khronos/GLES2/gl2ext.h" |
8 #include "CCPrioritizedTexture.h" | 10 #include "CCPrioritizedTexture.h" |
9 #include "CCProxy.h" | 11 #include "CCProxy.h" |
10 #include "Extensions3DChromium.h" | |
11 #include "SkGpuDevice.h" | 12 #include "SkGpuDevice.h" |
12 #include "TraceEvent.h" | 13 #include "TraceEvent.h" |
13 #include <algorithm> | 14 #include <algorithm> |
14 #include <public/Platform.h> | 15 #include <public/Platform.h> |
15 #include <public/WebGraphicsContext3D.h> | 16 #include <public/WebGraphicsContext3D.h> |
16 #include <public/WebSharedGraphicsContext3D.h> | 17 #include <public/WebSharedGraphicsContext3D.h> |
17 #include <vector> | 18 #include <vector> |
18 | 19 |
19 using WebKit::WebGraphicsContext3D; | 20 using WebKit::WebGraphicsContext3D; |
20 using WebKit::WebSharedGraphicsContext3D; | 21 using WebKit::WebSharedGraphicsContext3D; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 62 |
62 ThrottledTextureUploader::Query::~Query() | 63 ThrottledTextureUploader::Query::~Query() |
63 { | 64 { |
64 m_context->deleteQueryEXT(m_queryId); | 65 m_context->deleteQueryEXT(m_queryId); |
65 } | 66 } |
66 | 67 |
67 void ThrottledTextureUploader::Query::begin() | 68 void ThrottledTextureUploader::Query::begin() |
68 { | 69 { |
69 m_hasValue = false; | 70 m_hasValue = false; |
70 m_isNonBlocking = false; | 71 m_isNonBlocking = false; |
71 m_context->beginQueryEXT(Extensions3DChromium::COMMANDS_ISSUED_CHROMIUM, m_q
ueryId); | 72 m_context->beginQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM, m_queryId); |
72 } | 73 } |
73 | 74 |
74 void ThrottledTextureUploader::Query::end() | 75 void ThrottledTextureUploader::Query::end() |
75 { | 76 { |
76 m_context->endQueryEXT(Extensions3DChromium::COMMANDS_ISSUED_CHROMIUM); | 77 m_context->endQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM); |
77 } | 78 } |
78 | 79 |
79 bool ThrottledTextureUploader::Query::isPending() | 80 bool ThrottledTextureUploader::Query::isPending() |
80 { | 81 { |
81 unsigned available = 1; | 82 unsigned available = 1; |
82 m_context->getQueryObjectuivEXT(m_queryId, Extensions3DChromium::QUERY_RESUL
T_AVAILABLE_EXT, &available); | 83 m_context->getQueryObjectuivEXT(m_queryId, GL_QUERY_RESULT_AVAILABLE_EXT, &a
vailable); |
83 return !available; | 84 return !available; |
84 } | 85 } |
85 | 86 |
86 void ThrottledTextureUploader::Query::wait() | 87 void ThrottledTextureUploader::Query::wait() |
87 { | 88 { |
88 value(); | 89 value(); |
89 return; | 90 return; |
90 } | 91 } |
91 | 92 |
92 unsigned ThrottledTextureUploader::Query::value() | 93 unsigned ThrottledTextureUploader::Query::value() |
93 { | 94 { |
94 if (!m_hasValue) { | 95 if (!m_hasValue) { |
95 m_context->getQueryObjectuivEXT(m_queryId, Extensions3DChromium::QUERY_R
ESULT_EXT, &m_value); | 96 m_context->getQueryObjectuivEXT(m_queryId, GL_QUERY_RESULT_EXT, &m_value
); |
96 m_hasValue = true; | 97 m_hasValue = true; |
97 } | 98 } |
98 return m_value; | 99 return m_value; |
99 } | 100 } |
100 | 101 |
101 void ThrottledTextureUploader::Query::markAsNonBlocking() | 102 void ThrottledTextureUploader::Query::markAsNonBlocking() |
102 { | 103 { |
103 m_isNonBlocking = true; | 104 m_isNonBlocking = true; |
104 } | 105 } |
105 | 106 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // Remove the oldest values from our history and insert the new one | 272 // Remove the oldest values from our history and insert the new one |
272 double texturesPerSecond = 1.0 / (usElapsed * 1e-6); | 273 double texturesPerSecond = 1.0 / (usElapsed * 1e-6); |
273 m_texturesPerSecondHistory.pop_back(); | 274 m_texturesPerSecondHistory.pop_back(); |
274 m_texturesPerSecondHistory.push_front(texturesPerSecond); | 275 m_texturesPerSecondHistory.push_front(texturesPerSecond); |
275 | 276 |
276 m_availableQueries.append(m_pendingQueries.takeFirst()); | 277 m_availableQueries.append(m_pendingQueries.takeFirst()); |
277 } | 278 } |
278 } | 279 } |
279 | 280 |
280 } | 281 } |
OLD | NEW |