1 // 2 // Copyright 2013 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 // Query11.h: Defines the rx::Query11 class which implements rx::QueryImpl. 8 9 #ifndef LIBANGLE_RENDERER_D3D_D3D11_QUERY11_H_ 10 #define LIBANGLE_RENDERER_D3D_D3D11_QUERY11_H_ 11 12 #include <deque> 13 14 #include "libANGLE/renderer/QueryImpl.h" 15 #include "libANGLE/renderer/d3d/d3d11/ResourceManager11.h" 16 17 namespace rx 18 { 19 class Context11; 20 class Renderer11; 21 22 class Query11 : public QueryImpl 23 { 24 public: 25 Query11(Renderer11 *renderer, gl::QueryType type); 26 ~Query11() override; 27 28 angle::Result begin(const gl::Context *context) override; 29 angle::Result end(const gl::Context *context) override; 30 angle::Result queryCounter(const gl::Context *context) override; 31 angle::Result getResult(const gl::Context *context, GLint *params) override; 32 angle::Result getResult(const gl::Context *context, GLuint *params) override; 33 angle::Result getResult(const gl::Context *context, GLint64 *params) override; 34 angle::Result getResult(const gl::Context *context, GLuint64 *params) override; 35 angle::Result isResultAvailable(const gl::Context *context, bool *available) override; 36 37 angle::Result pause(Context11 *context11); 38 angle::Result resume(Context11 *context11); 39 40 private: 41 struct QueryState final : private angle::NonCopyable 42 { 43 QueryState(); 44 ~QueryState(); 45 46 unsigned int getDataAttemptCount; 47 48 d3d11::Query query; 49 d3d11::Query beginTimestamp; 50 d3d11::Query endTimestamp; 51 bool finished; 52 }; 53 54 angle::Result flush(Context11 *context11, bool force); 55 angle::Result testQuery(Context11 *context11, QueryState *queryState); 56 57 template <typename T> 58 angle::Result getResultBase(Context11 *context11, T *params); 59 60 GLuint64 mResult; 61 GLuint64 mResultSum; 62 63 Renderer11 *mRenderer; 64 65 std::unique_ptr<QueryState> mActiveQuery; 66 std::deque<std::unique_ptr<QueryState>> mPendingQueries; 67 }; 68 69 } // namespace rx 70 71 #endif // LIBANGLE_RENDERER_D3D_D3D11_QUERY11_H_ 72