OmniSciDB  c07336695a
RenderInfo.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 MapD Technologies, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef QUERYENGINE_RENDERINFO_H
18 #define QUERYENGINE_RENDERINFO_H
19 
20 #include <Analyzer/Analyzer.h>
21 #include <Catalog/Catalog.h>
23 #include "../Descriptors/RowSetMemoryOwner.h"
24 #include "RenderAllocator.h"
25 
26 namespace QueryRenderer {
27 struct RenderSession;
28 } // namespace QueryRenderer
29 
30 class RenderInfo {
31  public:
32  std::unique_ptr<RenderAllocatorMap> render_allocator_map_ptr;
33  const std::shared_ptr<const ::QueryRenderer::RenderSession> render_session;
34  std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner;
35 
36  // Info for all the column targets retrieved in in a query. Used to extract column/table
37  // info when rendering.
38  std::vector<std::shared_ptr<Analyzer::TargetEntry>> targets;
39 
40  // All the "selected from" tables in a query. Includes resolved and un-resolved views.
41  std::unordered_set<std::string> table_names;
43 
44  RenderInfo(
45  const std::shared_ptr<const ::QueryRenderer::RenderSession> in_render_session,
46  RenderQueryOptions in_render_query_opts,
47  const bool force_non_in_situ_data = false);
48 
49  const Catalog_Namespace::SessionInfo& getSessionInfo() const;
50  void setForceNonInSituData();
51  bool queryRanWithInSituData() const;
52  bool hasInSituData() const;
53  bool isInSituDataFlagUnset() const;
54  bool couldRunInSitu() const;
55  bool isPotentialInSituRender() const;
56  bool useCudaBuffers() const;
57  void disableCudaBuffers();
58 
59  std::shared_ptr<QueryRenderer::QueryDataLayout> getQueryVboLayout() const;
60  void setQueryVboLayout(
61  const std::shared_ptr<QueryRenderer::QueryDataLayout>& vbo_layout);
62  std::shared_ptr<QueryRenderer::QueryDataLayout> getQuerySsboLayout() const;
63  void setQuerySsboLayout(
64  const std::shared_ptr<QueryRenderer::QueryDataLayout>& ssbo_layout);
65 
66  const RenderQueryOptions* getRenderQueryOptsPtr() const;
67  const RenderQueryOptions& getRenderQueryOpts() const;
68 
69  bool setInSituDataIfUnset(const bool is_in_situ_data);
70 
71  void reset(RenderQueryOptions in_query_opts,
72  const bool disallow_in_situ_only_if_final_ED_is_aggregate_in);
73 
74  private:
75  enum class InSituState { UNSET, IS_IN_SITU, IS_NOT_IN_SITU };
77  in_situ_data; // Should be set to true if query results can be written directly
78  // to CUDA-mapped opengl buffers for rendering. Should be set
79  // to false otherwise, meaning results are written to CPU first,
80  // and buffered back to GPU for rendering.
81  // An alternative meaning is that when false, you've encountered
82  // a non-projection query.
83  // Can only be set once for the lifetime of the object.
85 
86  enum class RendererBufferMode { CUDA, GL };
87  RendererBufferMode buffer_mode_; // The Renderer buffer mode determines how query
88  // results are bused to the Rendering engine.
89 
90  std::shared_ptr<QueryRenderer::QueryDataLayout> query_vbo_layout;
91  std::shared_ptr<QueryRenderer::QueryDataLayout> query_ssbo_layout;
93 };
94 
95 #endif // QUERYENGINE_RENDERINFO_H
Defines data structures for the semantic analysis phase of query processing.
std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner
Definition: RenderInfo.h:34
std::vector< std::shared_ptr< Analyzer::TargetEntry > > targets
Definition: RenderInfo.h:38
RendererBufferMode buffer_mode_
Definition: RenderInfo.h:87
bool disallow_in_situ_only_if_final_ED_is_aggregate
Definition: RenderInfo.h:42
std::unordered_set< std::string > table_names
Definition: RenderInfo.h:41
This file contains the class specification and related data structures for Catalog.
InSituState in_situ_data
Definition: RenderInfo.h:77
RendererBufferMode
Definition: RenderInfo.h:86
RenderQueryOptions render_query_opts_
Definition: RenderInfo.h:92
std::shared_ptr< QueryRenderer::QueryDataLayout > query_ssbo_layout
Definition: RenderInfo.h:91
const std::shared_ptr< const ::QueryRenderer::RenderSession > render_session
Definition: RenderInfo.h:33
bool force_non_in_situ_data
Definition: RenderInfo.h:84
std::unique_ptr< RenderAllocatorMap > render_allocator_map_ptr
Definition: RenderInfo.h:32
std::shared_ptr< QueryRenderer::QueryDataLayout > query_vbo_layout
Definition: RenderInfo.h:90