1 #ifndef _GLUSTRUTIL_HPP
2 #define _GLUSTRUTIL_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 OpenGL value to string utilities.
24 *//*--------------------------------------------------------------------*/
26 #include "gluDefs.hpp"
27 #include "gluRenderContext.hpp"
28 #include "tcuFormatUtil.hpp"
33 // Internal format utilities.
40 typedef const char* (*GetEnumNameFunc) (int value);
42 const deUint32* const value;
44 const GetEnumNameFunc getName;
46 EnumPointerFmt (const deUint32* value_, deUint32 size_, GetEnumNameFunc getName_) : value(value_), size(size_), getName(getName_) {}
49 class BooleanPointerFmt
52 const deUint8* const value;
55 BooleanPointerFmt (const deUint8* value_, deUint32 size_) : value(value_), size(size_) {}
61 const deUint32 texUnit;
62 TextureUnitStr (deUint32 texUnit_) : texUnit(texUnit_) {}
65 class TextureParameterValueStr
70 TextureParameterValueStr (deUint32 param_, int value_) : param(param_), value(value_) {}
73 std::ostream& operator<< (std::ostream& str, const TextureUnitStr& unitStr);
74 std::ostream& operator<< (std::ostream& str, const TextureParameterValueStr& valueStr);
75 std::ostream& operator<< (std::ostream& str, const BooleanPointerFmt& fmt);
76 std::ostream& operator<< (std::ostream& str, const EnumPointerFmt& fmt);
80 inline detail::EnumPointerFmt getEnumPointerStr (const deUint32* value, deInt32 size, detail::EnumPointerFmt::GetEnumNameFunc getName)
82 return detail::EnumPointerFmt(value, (deUint32)de::max(0, size), getName);
85 inline detail::BooleanPointerFmt getBooleanPointerStr (const deUint8* value, deInt32 size)
87 return detail::BooleanPointerFmt(value, (deUint32)de::max(0, size));
90 inline detail::TextureUnitStr getTextureUnitStr (deUint32 unit) { return detail::TextureUnitStr(unit); }
91 inline detail::TextureParameterValueStr getTextureParameterValueStr (deUint32 param, int value) { return detail::TextureParameterValueStr(param, value); }
92 detail::EnumPointerFmt getInvalidateAttachmentStr (const deUint32* attachments, int numAttachments);
94 std::ostream& operator<< (std::ostream& str, ApiType apiType);
95 std::ostream& operator<< (std::ostream& str, ContextType contextType);
97 // prevent implicit conversions from bool to int.
99 // While it is well-defined that (int)true == GL_TRUE and (int)false == GL_FALSE,
100 // using these functions to convert non-GL-types suggests a that the calling code is
101 // mixing and matching GLboolean and bool types which may not be safe.
103 // \note return value is void to prevent compilation. Otherwise this would only break linking.
104 void getBooleanPointerStr (const bool* value, deInt32 size); // delete
105 void getBooleanStr (bool); // delete
106 void getBooleanName (bool); // delete
108 #include "gluStrUtilPrototypes.inl"
112 #endif // _GLUSTRUTIL_HPP