| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "modules/webgl/EXTDisjointTimerQueryWebGL2.h" |
| 6 |
| 7 #include "bindings/modules/v8/WebGLAny.h" |
| 8 #include "gpu/command_buffer/client/gles2_interface.h" |
| 9 #include "modules/webgl/WebGLRenderingContextBase.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 EXTDisjointTimerQueryWebGL2::~EXTDisjointTimerQueryWebGL2() {} |
| 14 |
| 15 WebGLExtensionName EXTDisjointTimerQueryWebGL2::name() const { |
| 16 return EXTDisjointTimerQueryWebGL2Name; |
| 17 } |
| 18 |
| 19 EXTDisjointTimerQueryWebGL2* EXTDisjointTimerQueryWebGL2::create( |
| 20 WebGLRenderingContextBase* context) { |
| 21 EXTDisjointTimerQueryWebGL2* o = new EXTDisjointTimerQueryWebGL2(context); |
| 22 return o; |
| 23 } |
| 24 |
| 25 bool EXTDisjointTimerQueryWebGL2::supported( |
| 26 WebGLRenderingContextBase* context) { |
| 27 return context->extensionsUtil()->supportsExtension( |
| 28 "GL_EXT_disjoint_timer_query"); |
| 29 } |
| 30 |
| 31 const char* EXTDisjointTimerQueryWebGL2::extensionName() { |
| 32 return "EXT_disjoint_timer_query_webgl2"; |
| 33 } |
| 34 |
| 35 void EXTDisjointTimerQueryWebGL2::queryCounterEXT(WebGLQuery* query, |
| 36 GLenum target) { |
| 37 WebGLExtensionScopedContext scoped(this); |
| 38 if (scoped.isLost()) |
| 39 return; |
| 40 |
| 41 if (!query || query->isDeleted() || |
| 42 !query->validate(scoped.context()->contextGroup(), scoped.context())) { |
| 43 scoped.context()->synthesizeGLError(GL_INVALID_OPERATION, "queryCounterEXT", |
| 44 "invalid query"); |
| 45 return; |
| 46 } |
| 47 |
| 48 if (target != GL_TIMESTAMP_EXT) { |
| 49 scoped.context()->synthesizeGLError(GL_INVALID_ENUM, "queryCounterEXT", |
| 50 "invalid target"); |
| 51 return; |
| 52 } |
| 53 |
| 54 if (query->hasTarget() && query->getTarget() != target) { |
| 55 scoped.context()->synthesizeGLError(GL_INVALID_OPERATION, "queryCounterEXT", |
| 56 "target does not match query"); |
| 57 return; |
| 58 } |
| 59 |
| 60 // Timestamps are disabled in WebGL due to lack of driver support on multiple |
| 61 // platforms, so we don't actually perform a GL call. |
| 62 query->setTarget(target); |
| 63 query->resetCachedResult(); |
| 64 } |
| 65 |
| 66 DEFINE_TRACE(EXTDisjointTimerQueryWebGL2) { |
| 67 WebGLExtension::trace(visitor); |
| 68 } |
| 69 |
| 70 EXTDisjointTimerQueryWebGL2::EXTDisjointTimerQueryWebGL2( |
| 71 WebGLRenderingContextBase* context) |
| 72 : WebGLExtension(context) { |
| 73 context->extensionsUtil()->ensureExtensionEnabled( |
| 74 "GL_EXT_disjoint_timer_query_webgl2"); |
| 75 } |
| 76 |
| 77 } // namespace blink |
| OLD | NEW |