OmniSciDB  91042dcc5b
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 #pragma once
18 
19 #include "Analyzer/Analyzer.h"
20 #include "Catalog/Catalog.h"
24 
25 namespace QueryRenderer {
26 struct RenderSessionKey;
27 }
28 
29 class RenderInfo {
30  public:
31  std::unique_ptr<RenderAllocatorMap> render_allocator_map_ptr;
32  const ::QueryRenderer::RenderSessionKey& render_session_key;
33 
34  // Info for all the column targets retrieved in in a query. Used to extract column/table
35  // info when rendering.
36  std::vector<std::shared_ptr<Analyzer::TargetEntry>> targets;
37 
38  // All the "selected from" tables in a query. Includes resolved and un-resolved views.
39  std::unordered_set<std::string> table_names;
41 
42  RenderInfo(const ::QueryRenderer::RenderSessionKey& in_render_session_key,
43  const RenderQueryOptions& in_render_query_opts,
44  const bool force_non_in_situ_data = false);
45 
47  std::shared_ptr<Catalog_Namespace::SessionInfo const> getSessionInfoPtr() const;
48  void setForceNonInSituData();
49  bool queryRanWithInSituData() const;
50  bool hasInSituData() const;
51  bool isInSituDataFlagUnset() const;
52  bool couldRunInSitu() const;
53  bool isPotentialInSituRender() const;
54  bool useCudaBuffers() const;
55  void disableCudaBuffers();
56 
57  std::shared_ptr<QueryRenderer::QueryDataLayout> getQueryVboLayout() const;
58  void setQueryVboLayout(
59  const std::shared_ptr<QueryRenderer::QueryDataLayout>& vbo_layout);
60  std::shared_ptr<QueryRenderer::QueryDataLayout> getQuerySsboLayout() const;
61  void setQuerySsboLayout(
62  const std::shared_ptr<QueryRenderer::QueryDataLayout>& ssbo_layout);
63 
65 
66  bool setInSituDataIfUnset(const bool is_in_situ_data);
67 
68  void reset(std::unique_ptr<RenderQueryOptions> in_query_opts,
69  const bool in_force_non_in_situ_data,
70  const bool in_disallow_in_situ_only_if_final_ED_is_aggregate);
71 
72  private:
75  in_situ_data; // Should be set to true if query results can be written directly
76  // to CUDA-mapped opengl buffers for rendering. Should be set
77  // to false otherwise, meaning results are written to CPU first,
78  // and buffered back to GPU for rendering.
79  // An alternative meaning is that when false, you've encountered
80  // a non-projection query.
81  // Can only be set once for the lifetime of the object.
83 
84  enum class RendererBufferMode { CUDA, GL };
85  RendererBufferMode buffer_mode_; // The Renderer buffer mode determines how query
86  // results are bused to the Rendering engine.
87 
88  std::shared_ptr<QueryRenderer::QueryDataLayout> query_vbo_layout;
89  std::shared_ptr<QueryRenderer::QueryDataLayout> query_ssbo_layout;
91 };
Defines data structures for the semantic analysis phase of query processing.
bool hasInSituData() const
Definition: RenderInfo.cpp:53
void disableCudaBuffers()
Definition: RenderInfo.cpp:73
const ::QueryRenderer::RenderSessionKey & render_session_key
Definition: RenderInfo.h:32
bool useCudaBuffers() const
Definition: RenderInfo.cpp:68
std::shared_ptr< Catalog_Namespace::SessionInfo const > getSessionInfoPtr() const
Definition: RenderInfo.cpp:38
void setForceNonInSituData()
Definition: RenderInfo.cpp:44
std::shared_ptr< QueryRenderer::QueryDataLayout > getQuerySsboLayout() const
Definition: RenderInfo.cpp:87
std::vector< std::shared_ptr< Analyzer::TargetEntry > > targets
Definition: RenderInfo.h:36
bool queryRanWithInSituData() const
Definition: RenderInfo.cpp:48
bool setInSituDataIfUnset(const bool is_in_situ_data)
Definition: RenderInfo.cpp:97
RenderInfo(const ::QueryRenderer::RenderSessionKey &in_render_session_key, const RenderQueryOptions &in_render_query_opts, const bool force_non_in_situ_data=false)
Definition: RenderInfo.cpp:20
RendererBufferMode buffer_mode_
Definition: RenderInfo.h:85
bool couldRunInSitu() const
const Catalog_Namespace::SessionInfo & getSessionInfo() const
Definition: RenderInfo.cpp:28
bool disallow_in_situ_only_if_final_ED_is_aggregate
Definition: RenderInfo.h:40
std::unordered_set< std::string > table_names
Definition: RenderInfo.h:39
This file contains the class specification and related data structures for Catalog.
const RenderQueryOptions & getRenderQueryOptions() const
Definition: RenderInfo.cpp:102
std::shared_ptr< QueryRenderer::QueryDataLayout > getQueryVboLayout() const
Definition: RenderInfo.cpp:77
InSituState in_situ_data
Definition: RenderInfo.h:75
RendererBufferMode
Definition: RenderInfo.h:84
RenderQueryOptions render_query_opts_
Definition: RenderInfo.h:90
void reset(std::unique_ptr< 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:107
std::shared_ptr< QueryRenderer::QueryDataLayout > query_ssbo_layout
Definition: RenderInfo.h:89
bool force_non_in_situ_data
Definition: RenderInfo.h:82
bool isInSituDataFlagUnset() const
Definition: RenderInfo.cpp:58
std::unique_ptr< RenderAllocatorMap > render_allocator_map_ptr
Definition: RenderInfo.h:31
void setQuerySsboLayout(const std::shared_ptr< QueryRenderer::QueryDataLayout > &ssbo_layout)
Definition: RenderInfo.cpp:92
bool isPotentialInSituRender() const
Definition: RenderInfo.cpp:63
void setQueryVboLayout(const std::shared_ptr< QueryRenderer::QueryDataLayout > &vbo_layout)
Definition: RenderInfo.cpp:82
std::shared_ptr< QueryRenderer::QueryDataLayout > query_vbo_layout
Definition: RenderInfo.h:88