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));
58 inline detail::EnumPointerFmt getEnumPointerStr (const deUint32* value, glw::GLsizei size, detail::EnumPointerFmt::GetEnumNameFunc getName)
60 return detail::EnumPointerFmt(value, (deUint32)de::max(0, size), getName);
63 inline detail::BooleanPointerFmt getBooleanPointerStr (const deUint8* value, glw::GLsizei size)
65 return detail::BooleanPointerFmt(value, (deUint32)de::max(0, size));
73 const glw::GLchar* str;
74 StringFmt (const glw::GLchar* str_) : str(str_) {}
77 inline std::ostream& operator<< (std::ostream& str, StringFmt fmt)
79 return str << (fmt.str ? (const char*)fmt.str : "NULL");
82 inline StringFmt getStringStr (const char* value) { return StringFmt(value); }
83 inline StringFmt getStringStr (const glw::GLubyte* value) { return StringFmt((const char*)value); }
85 // Framebuffer parameter pointer formatter.
93 FboParamPtrFmt (deUint32 param_, const int* value_) : param(param_), value(value_) {}
96 std::ostream& operator<< (std::ostream& str, FboParamPtrFmt fmt)
102 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
103 return str << tcu::Format::Enum<int, 2>(getFramebufferAttachmentTypeName, *fmt.value);
105 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
106 return str << tcu::Format::Enum<int, 2>(getCubeMapFaceName, *fmt.value);
108 case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
109 return str << tcu::Format::Enum<int, 2>(getTypeName, *fmt.value);
111 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
112 return str << tcu::Format::Enum<int, 2>(getFramebufferColorEncodingName, *fmt.value);
114 case GL_FRAMEBUFFER_ATTACHMENT_LAYERED:
115 return str << tcu::Format::Enum<int, 2>(getBooleanName, *fmt.value);
117 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
118 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
119 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
120 case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
121 case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
122 case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
123 case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
124 case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
125 case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
126 return str << *fmt.value;
129 return str << tcu::toHex(*fmt.value);
133 return str << "(null)";
136 inline FboParamPtrFmt getFramebufferAttachmentParameterValueStr (deUint32 param, const int* value)
138 return FboParamPtrFmt(param, value);
141 #include "gluQueryUtil.inl"
143 // API entry-point implementations are auto-generated
144 #include "gluCallLogWrapper.inl"