1 #ifndef _GLUCONTEXTINFO_HPP
2 #define _GLUCONTEXTINFO_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program OpenGL ES Utilities
5 * ------------------------------------------------
7 * Copyright 2014 The Android Open Source Project
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * \brief Context Info Class.
24 *//*--------------------------------------------------------------------*/
26 #include "gluDefs.hpp"
37 template <typename T, class ComputeValue>
41 CachedValue (ComputeValue compute = ComputeValue(), const T& defaultValue = T())
43 , m_value (defaultValue)
44 , m_isComputed (false)
48 const T& getValue (const RenderContext& context) const
52 m_value = m_compute(context);
59 ComputeValue m_compute;
61 mutable bool m_isComputed;
67 std::vector<std::string> operator() (const RenderContext& context) const;
70 class GetCompressedTextureFormats
73 std::set<int> operator() (const RenderContext& context) const;
76 typedef CachedValue<std::vector<std::string>, GetExtensions> ExtensionList;
77 typedef CachedValue<std::set<int>, GetCompressedTextureFormats> CompressedTextureFormats;
79 /*--------------------------------------------------------------------*//*!
80 * \brief Context information & limit query.
81 *//*--------------------------------------------------------------------*/
85 virtual ~ContextInfo (void);
87 virtual int getInt (int param) const;
88 virtual bool getBool (int param) const;
89 virtual const char* getString (int param) const;
91 virtual bool isVertexUniformLoopSupported (void) const { return true; }
92 virtual bool isVertexDynamicLoopSupported (void) const { return true; }
93 virtual bool isFragmentHighPrecisionSupported (void) const { return true; }
94 virtual bool isFragmentUniformLoopSupported (void) const { return true; }
95 virtual bool isFragmentDynamicLoopSupported (void) const { return true; }
97 virtual bool isCompressedTextureFormatSupported (int format) const;
99 const std::vector<std::string>& getExtensions (void) const { return m_extensions.getValue(m_context); }
100 bool isExtensionSupported (const char* extName) const;
102 static ContextInfo* create (const RenderContext& context);
105 ContextInfo (const RenderContext& context);
107 const RenderContext& m_context;
110 ContextInfo (const ContextInfo& other);
111 ContextInfo& operator= (const ContextInfo& other);
113 ExtensionList m_extensions;
114 CompressedTextureFormats m_compressedTextureFormats;
119 #endif // _GLUCONTEXTINFO_HPP