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 "glwFunctions.hpp"
27 #include "gluDefs.hpp"
38 template <typename T, class ComputeValue>
42 CachedValue (ComputeValue compute = ComputeValue(), const T& defaultValue = T())
44 , m_value (defaultValue)
45 , m_isComputed (false)
49 const T& getValue (const RenderContext& context) const
53 m_value = m_compute(context);
60 ComputeValue m_compute;
62 mutable bool m_isComputed;
65 class GetCompressedTextureFormats
68 std::set<int> operator() (const RenderContext& context) const;
71 typedef CachedValue<std::set<int>, GetCompressedTextureFormats> CompressedTextureFormats;
73 bool IsES3Compatible(const glw::Functions& gl);
75 /*--------------------------------------------------------------------*//*!
76 * \brief Context information & limit query.
77 *//*--------------------------------------------------------------------*/
81 virtual ~ContextInfo (void);
83 virtual int getInt (int param) const;
84 virtual bool getBool (int param) const;
85 virtual const char* getString (int param) const;
87 virtual bool isVertexUniformLoopSupported (void) const { return true; }
88 virtual bool isVertexDynamicLoopSupported (void) const { return true; }
89 virtual bool isFragmentHighPrecisionSupported (void) const { return true; }
90 virtual bool isFragmentUniformLoopSupported (void) const { return true; }
91 virtual bool isFragmentDynamicLoopSupported (void) const { return true; }
93 virtual bool isCompressedTextureFormatSupported (int format) const;
95 const std::vector<std::string>& getExtensions (void) const { return m_extensions; }
96 bool isExtensionSupported (const char* extName) const;
98 bool isES3Compatible() const;
100 static ContextInfo* create (const RenderContext& context);
103 ContextInfo (const RenderContext& context);
105 const RenderContext& m_context;
108 ContextInfo (const ContextInfo& other);
109 ContextInfo& operator= (const ContextInfo& other);
111 std::vector<std::string> m_extensions;
112 CompressedTextureFormats m_compressedTextureFormats;
117 #endif // _GLUCONTEXTINFO_HPP