| 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 "platform/graphics/gpu/SharedContextRateLimiter.h" | 5 #include "platform/graphics/gpu/SharedContextRateLimiter.h" |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_interface.h" | |
| 8 #include "platform/graphics/gpu/Extensions3DUtil.h" | 7 #include "platform/graphics/gpu/Extensions3DUtil.h" |
| 9 #include "public/platform/Platform.h" | 8 #include "public/platform/Platform.h" |
| 10 #include "public/platform/WebGraphicsContext3D.h" | 9 #include "public/platform/WebGraphicsContext3D.h" |
| 11 #include "public/platform/WebGraphicsContext3DProvider.h" | 10 #include "public/platform/WebGraphicsContext3DProvider.h" |
| 12 | 11 |
| 13 #ifndef GL_COMMANDS_COMPLETED_CHROMIUM | 12 #ifndef GL_COMMANDS_COMPLETED_CHROMIUM |
| 14 #define GL_COMMANDS_COMPLETED_CHROMIUM 0x84F7 | 13 #define GL_COMMANDS_COMPLETED_CHROMIUM 0x84F7 |
| 15 #endif | 14 #endif |
| 16 | 15 |
| 17 namespace blink { | 16 namespace blink { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 48 | 47 |
| 49 m_queries.append(0); | 48 m_queries.append(0); |
| 50 if (m_canUseSyncQueries) | 49 if (m_canUseSyncQueries) |
| 51 gl->GenQueriesEXT(1, &m_queries.last()); | 50 gl->GenQueriesEXT(1, &m_queries.last()); |
| 52 if (m_canUseSyncQueries) { | 51 if (m_canUseSyncQueries) { |
| 53 gl->BeginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM, m_queries.last()); | 52 gl->BeginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM, m_queries.last()); |
| 54 gl->EndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM); | 53 gl->EndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM); |
| 55 } | 54 } |
| 56 if (m_queries.size() > m_maxPendingTicks) { | 55 if (m_queries.size() > m_maxPendingTicks) { |
| 57 if (m_canUseSyncQueries) { | 56 if (m_canUseSyncQueries) { |
| 58 WGC3Duint result; | 57 GLuint result; |
| 59 gl->GetQueryObjectuivEXT(m_queries.first(), GL_QUERY_RESULT_EXT, &re
sult); | 58 gl->GetQueryObjectuivEXT(m_queries.first(), GL_QUERY_RESULT_EXT, &re
sult); |
| 60 gl->DeleteQueriesEXT(1, &m_queries.first()); | 59 gl->DeleteQueriesEXT(1, &m_queries.first()); |
| 61 m_queries.removeFirst(); | 60 m_queries.removeFirst(); |
| 62 } else { | 61 } else { |
| 63 gl->Finish(); | 62 gl->Finish(); |
| 64 reset(); | 63 reset(); |
| 65 } | 64 } |
| 66 } | 65 } |
| 67 } | 66 } |
| 68 | 67 |
| 69 void SharedContextRateLimiter::reset() | 68 void SharedContextRateLimiter::reset() |
| 70 { | 69 { |
| 71 if (!m_contextProvider) | 70 if (!m_contextProvider) |
| 72 return; | 71 return; |
| 73 | 72 |
| 74 gpu::gles2::GLES2Interface* gl = m_contextProvider->contextGL(); | 73 gpu::gles2::GLES2Interface* gl = m_contextProvider->contextGL(); |
| 75 if (gl && gl->GetGraphicsResetStatusKHR() == GL_NO_ERROR) { | 74 if (gl && gl->GetGraphicsResetStatusKHR() == GL_NO_ERROR) { |
| 76 while (m_queries.size() > 0) { | 75 while (m_queries.size() > 0) { |
| 77 gl->DeleteQueriesEXT(1, &m_queries.first()); | 76 gl->DeleteQueriesEXT(1, &m_queries.first()); |
| 78 m_queries.removeFirst(); | 77 m_queries.removeFirst(); |
| 79 } | 78 } |
| 80 } else { | 79 } else { |
| 81 m_queries.clear(); | 80 m_queries.clear(); |
| 82 } | 81 } |
| 83 } | 82 } |
| 84 | 83 |
| 85 } // namespace blink | 84 } // namespace blink |
| OLD | NEW |