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;
64 class GetCompressedTextureFormats
67 std::set<int> operator() (const RenderContext& context) const;
70 typedef CachedValue<std::set<int>, GetCompressedTextureFormats> CompressedTextureFormats;
72 /*--------------------------------------------------------------------*//*!
73 * \brief Context information & limit query.
74 *//*--------------------------------------------------------------------*/
78 virtual ~ContextInfo (void);
80 virtual int getInt (int param) const;
81 virtual bool getBool (int param) const;
82 virtual const char* getString (int param) const;
84 virtual bool isVertexUniformLoopSupported (void) const { return true; }
85 virtual bool isVertexDynamicLoopSupported (void) const { return true; }
86 virtual bool isFragmentHighPrecisionSupported (void) const { return true; }
87 virtual bool isFragmentUniformLoopSupported (void) const { return true; }
88 virtual bool isFragmentDynamicLoopSupported (void) const { return true; }
90 virtual bool isCompressedTextureFormatSupported (int format) const;
92 const std::vector<std::string>& getExtensions (void) const { return m_extensions; }
93 bool isExtensionSupported (const char* extName) const;
95 static ContextInfo* create (const RenderContext& context);
98 ContextInfo (const RenderContext& context);
100 const RenderContext& m_context;
103 ContextInfo (const ContextInfo& other);
104 ContextInfo& operator= (const ContextInfo& other);
106 std::vector<std::string> m_extensions;
107 CompressedTextureFormats m_compressedTextureFormats;
112 #endif // _GLUCONTEXTINFO_HPP