1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program EGL Utilities
3 * ------------------------------------------
5 * Copyright 2014 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief EGL String Utilities.
22 *//*--------------------------------------------------------------------*/
24 #include "egluStrUtil.hpp"
25 #include "eglwEnums.hpp"
30 std::ostream& operator<< (std::ostream& str, const ConfigAttribValueFmt& attribFmt)
32 switch (attribFmt.attribute)
34 case EGL_COLOR_BUFFER_TYPE:
35 return str << getColorBufferTypeStr(attribFmt.value);
37 case EGL_CONFIG_CAVEAT:
38 return str << getConfigCaveatStr(attribFmt.value);
41 case EGL_RENDERABLE_TYPE:
42 return str << getAPIBitsStr(attribFmt.value);
44 case EGL_SURFACE_TYPE:
45 return str << getSurfaceBitsStr(attribFmt.value);
47 case EGL_MATCH_NATIVE_PIXMAP:
48 if (attribFmt.value == EGL_NONE)
49 return str << "EGL_NONE";
51 return str << tcu::toHex(attribFmt.value);
53 case EGL_TRANSPARENT_TYPE:
54 return str << getTransparentTypeStr(attribFmt.value);
56 case EGL_BIND_TO_TEXTURE_RGB:
57 case EGL_BIND_TO_TEXTURE_RGBA:
58 case EGL_NATIVE_RENDERABLE:
59 return str << getBoolDontCareStr(attribFmt.value);
61 case EGL_ALPHA_MASK_SIZE:
69 case EGL_LUMINANCE_SIZE:
70 case EGL_MAX_SWAP_INTERVAL:
71 case EGL_MIN_SWAP_INTERVAL:
73 case EGL_SAMPLE_BUFFERS:
75 case EGL_STENCIL_SIZE:
76 case EGL_TRANSPARENT_RED_VALUE:
77 case EGL_TRANSPARENT_GREEN_VALUE:
78 case EGL_TRANSPARENT_BLUE_VALUE:
79 return str << (int)attribFmt.value;
82 return str << tcu::toHex(attribFmt.value);
86 std::ostream& operator<< (std::ostream& str, const ContextAttribValueFmt& attribFmt)
88 switch (attribFmt.attribute)
91 case EGL_CONTEXT_CLIENT_VERSION:
92 return str << (int)attribFmt.value;
94 case EGL_CONTEXT_CLIENT_TYPE:
95 return str << getAPIStr(attribFmt.value);
97 case EGL_RENDER_BUFFER:
98 return str << getRenderBufferStr(attribFmt.value);
101 return str << tcu::toHex(attribFmt.value);
105 std::ostream& operator<< (std::ostream& str, const SurfaceAttribValueFmt& attribFmt)
107 switch (attribFmt.attribute)
112 case EGL_HORIZONTAL_RESOLUTION:
113 case EGL_VERTICAL_RESOLUTION:
114 case EGL_PIXEL_ASPECT_RATIO:
115 return str << (int)attribFmt.value;
117 case EGL_LARGEST_PBUFFER:
118 case EGL_MIPMAP_TEXTURE:
119 return str << getBoolDontCareStr(attribFmt.value);
121 case EGL_MULTISAMPLE_RESOLVE:
122 return str << getMultisampleResolveStr(attribFmt.value);
124 case EGL_RENDER_BUFFER:
125 return str << getRenderBufferStr(attribFmt.value);
127 case EGL_SWAP_BEHAVIOR:
128 return str << getSwapBehaviorStr(attribFmt.value);
130 case EGL_TEXTURE_FORMAT:
131 return str << getTextureFormatStr(attribFmt.value);
133 case EGL_TEXTURE_TARGET:
134 return str << getTextureTargetStr(attribFmt.value);
136 case EGL_ALPHA_FORMAT:
137 return str << getAlphaFormatStr(attribFmt.value);
140 return str << getColorspaceStr(attribFmt.value);
143 return str << tcu::toHex(attribFmt.value);
147 std::ostream& operator<< (std::ostream& str, const ConfigAttribListFmt& fmt)
155 int attrib = fmt.attribs[pos];
160 if (attrib == EGL_NONE)
167 const char* attribName = getConfigAttribName(attrib);
171 // Valid attribute, print value.
172 str << attribName << ", " << getConfigAttribValueStr(attrib, fmt.attribs[pos+1]);
177 // Invalid attribute. Terminate parsing.
178 str << tcu::toHex(attrib) << ", ???";
187 std::ostream& operator<< (std::ostream& str, const SurfaceAttribListFmt& fmt)
195 int attrib = fmt.attribs[pos];
200 if (attrib == EGL_NONE)
207 const char* attribName = getSurfaceAttribName(attrib);
211 // Valid attribute, print value.
212 str << attribName << ", " << getSurfaceAttribValueStr(attrib, fmt.attribs[pos+1]);
217 // Invalid attribute. Terminate parsing.
218 str << tcu::toHex(attrib) << ", ???";
227 std::ostream& operator<< (std::ostream& str, const ContextAttribListFmt& fmt)
235 int attrib = fmt.attribs[pos];
240 if (attrib == EGL_NONE)
247 const char* attribName = getContextAttribName(attrib);
251 // Valid attribute, print value.
252 str << attribName << ", " << getContextAttribValueStr(attrib, fmt.attribs[pos+1]);
257 // Invalid attribute. Terminate parsing.
258 str << tcu::toHex(attrib) << ", ???";
267 #include "egluStrUtil.inl"