1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 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 GL call wrapper for logging.
22 *//*--------------------------------------------------------------------*/
24 #include "gluCallLogWrapper.hpp"
25 #include "gluStrUtil.hpp"
26 #include "glwFunctions.hpp"
27 #include "glwEnums.hpp"
35 CallLogWrapper::CallLogWrapper (const glw::Functions& gl, tcu::TestLog& log)
42 CallLogWrapper::~CallLogWrapper (void)
47 inline tcu::Format::ArrayPointer<T> getPointerStr (const T* arr, deUint32 size)
49 return tcu::formatArray(arr, (int)size);
53 inline tcu::Format::ArrayPointer<T> getPointerStr (const T* arr, int size)
55 return tcu::formatArray(arr, de::max(size, 0));
63 const glw::GLchar* str;
64 StringFmt (const glw::GLchar* str_) : str(str_) {}
67 inline std::ostream& operator<< (std::ostream& str, StringFmt fmt)
69 return str << (fmt.str ? (const char*)fmt.str : "NULL");
72 inline StringFmt getStringStr (const char* value) { return StringFmt(value); }
73 inline StringFmt getStringStr (const glw::GLubyte* value) { return StringFmt((const char*)value); }
75 // Framebuffer parameter pointer formatter.
83 FboParamPtrFmt (deUint32 param_, const int* value_) : param(param_), value(value_) {}
86 std::ostream& operator<< (std::ostream& str, FboParamPtrFmt fmt)
92 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
93 return str << tcu::Format::Enum<int, 2>(getFramebufferAttachmentTypeName, *fmt.value);
95 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
96 return str << tcu::Format::Enum<int, 2>(getCubeMapFaceName, *fmt.value);
98 case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
99 return str << tcu::Format::Enum<int, 2>(getTypeName, *fmt.value);
101 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
102 return str << tcu::Format::Enum<int, 2>(getFramebufferColorEncodingName, *fmt.value);
104 case GL_FRAMEBUFFER_ATTACHMENT_LAYERED:
105 return str << tcu::Format::Enum<int, 2>(getBooleanName, *fmt.value);
107 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
108 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
109 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
110 case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
111 case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
112 case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
113 case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
114 case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
115 case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
116 return str << *fmt.value;
119 return str << tcu::toHex(*fmt.value);
123 return str << "(null)";
126 inline FboParamPtrFmt getFramebufferAttachmentParameterValueStr (deUint32 param, const int* value)
128 return FboParamPtrFmt(param, value);
131 #include "gluQueryUtil.inl"
132 #include "gluCallLogUtil.inl"
134 // API entry-point implementations are auto-generated
135 #include "gluCallLogWrapper.inl"