OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
50  std::shared_ptr<Catalog_Namespace::SessionInfo const> getSessionInfoPtr() const;
51  void setForceNonInSituData();
52  bool queryRanWithInSituData() const;
53  bool hasInSituData() const;
54  bool isInSituDataFlagUnset() const;
55  bool couldRunInSitu() const;
56  bool isPotentialInSituRender() const;
57  bool useCudaBuffers() const;
58  void disableCudaBuffers();
59 
60  std::shared_ptr<QueryRenderer::QueryDataLayout> getQueryVboLayout() const;
61  void setQueryVboLayout(
62  const std::shared_ptr<QueryRenderer::QueryDataLayout>& vbo_layout);
63  std::shared_ptr<QueryRenderer::QueryDataLayout> getQuerySsboLayout() const;
64  void setQuerySsboLayout(
65  const std::shared_ptr<QueryRenderer::QueryDataLayout>& ssbo_layout);
66 
69 
70  bool setInSituDataIfUnset(const bool is_in_situ_data);
71 
72  void reset(RenderQueryOptions in_query_opts,
73  const bool in_force_non_in_situ_data,
74  const bool in_disallow_in_situ_only_if_final_ED_is_aggregate);
75 
76  private:
79  in_situ_data; // Should be set to true if query results can be written directly
80  // to CUDA-mapped opengl buffers for rendering. Should be set
81  // to false otherwise, meaning results are written to CPU first,
82  // and buffered back to GPU for rendering.
83  // An alternative meaning is that when false, you've encountered
84  // a non-projection query.
85  // Can only be set once for the lifetime of the object.
87 
88  enum class RendererBufferMode { CUDA, GL };
89  RendererBufferMode buffer_mode_; // The Renderer buffer mode determines how query
90  // results are bused to the Rendering engine.
91 
92  std::shared_ptr<QueryRenderer::QueryDataLayout> query_vbo_layout;
93  std::shared_ptr<QueryRenderer::QueryDataLayout> query_ssbo_layout;
95 };
96 
97 #endif // QUERYENGINE_RENDERINFO_H
Defines data structures for the semantic analysis phase of query processing.
bool hasInSituData() const
Definition: RenderInfo.cpp:51
void disableCudaBuffers()
Definition: RenderInfo.cpp:71
const RenderQueryOptions * getRenderQueryOptsPtr() const
Definition: RenderInfo.cpp:100
bool useCudaBuffers() const
Definition: RenderInfo.cpp:66
std::shared_ptr< Catalog_Namespace::SessionInfo const > getSessionInfoPtr() const
Definition: RenderInfo.cpp:36
std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner
Definition: RenderInfo.h:34
void setForceNonInSituData()
Definition: RenderInfo.cpp:42
std::shared_ptr< QueryRenderer::QueryDataLayout > getQuerySsboLayout() const
Definition: RenderInfo.cpp:85
std::vector< std::shared_ptr< Analyzer::TargetEntry > > targets
Definition: RenderInfo.h:38
bool queryRanWithInSituData() const
Definition: RenderInfo.cpp:46
bool setInSituDataIfUnset(const bool is_in_situ_data)
Definition: RenderInfo.cpp:95
RendererBufferMode buffer_mode_
Definition: RenderInfo.h:89
bool couldRunInSitu() const
const Catalog_Namespace::SessionInfo & getSessionInfo() const
Definition: RenderInfo.cpp:29
const RenderQueryOptions & getRenderQueryOpts() const
Definition: RenderInfo.cpp:105
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.
std::shared_ptr< QueryRenderer::QueryDataLayout > getQueryVboLayout() const
Definition: RenderInfo.cpp:75
InSituState in_situ_data
Definition: RenderInfo.h:79
RendererBufferMode
Definition: RenderInfo.h:88
RenderQueryOptions render_query_opts_
Definition: RenderInfo.h:94
void reset(RenderQueryOptions in_query_opts, const bool in_force_non_in_situ_data, const bool in_disallow_in_situ_only_if_final_ED_is_aggregate)
Definition: RenderInfo.cpp:110
std::shared_ptr< QueryRenderer::QueryDataLayout > query_ssbo_layout
Definition: RenderInfo.h:93
const std::shared_ptr< const ::QueryRenderer::RenderSession > render_session
Definition: RenderInfo.h:33
RenderInfo(const std::shared_ptr< const ::QueryRenderer::RenderSession > in_render_session, RenderQueryOptions in_render_query_opts, const bool force_non_in_situ_data=false)
Definition: RenderInfo.cpp:20
bool force_non_in_situ_data
Definition: RenderInfo.h:86
bool isInSituDataFlagUnset() const
Definition: RenderInfo.cpp:56
std::unique_ptr< RenderAllocatorMap > render_allocator_map_ptr
Definition: RenderInfo.h:32
void setQuerySsboLayout(const std::shared_ptr< QueryRenderer::QueryDataLayout > &ssbo_layout)
Definition: RenderInfo.cpp:90
bool isPotentialInSituRender() const
Definition: RenderInfo.cpp:61
void setQueryVboLayout(const std::shared_ptr< QueryRenderer::QueryDataLayout > &vbo_layout)
Definition: RenderInfo.cpp:80
std::shared_ptr< QueryRenderer::QueryDataLayout > query_vbo_layout
Definition: RenderInfo.h:92