13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _TCUTESTLOG_HPP
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _TCUTESTLOG_HPP
33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*-------------------------------------------------------------------------
43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program Tester Core
53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ----------------------------------------
63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project
83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License");
103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License.
113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at
123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *      http://www.apache.org/licenses/LICENSE-2.0
143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software
163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS,
173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and
193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License.
203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*!
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Test Log C++ Wrapper.
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuDefs.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "qpTestLog.h"
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTexture.hpp"
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <sstream>
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace tcu
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Surface;
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass MessageBuilder;
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LogImageSet;
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LogImage;
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LogSection;
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LogShaderProgram;
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LogShader;
42133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevskiclass LogSpirVAssemblySource;
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LogKernelSource;
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LogSampleList;
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LogValueInfo;
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass SampleBuilder;
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytemplate<typename T> class LogNumber;
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*!
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Test log
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * TestLog provides convinient C++ API for logging. The API has been designed
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * around stream operators much like STL iostream library. The following
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * examples demonstrate how to use TestLog.
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \code
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * TestLog& log = m_testCtx.getLog();
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * // Write message to log.
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * log << TestLog::Message << "Hello, World!" << TestLog::EndMessage;
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * int myNumber = 3;
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * log << TestLog::Message << "Diff is " << myNumber << TestLog::EndMessage;
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * // Write image
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Surface myImage(256, 256);
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * log << TestLog::Image("TestImage", "My test image", myImage);
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * // Multiple commands can be combined:
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * log << TestLog::Section("Details", "Test case details")
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *     << TestLog::Message << "Here be dragons" << TestLog::EndMessage
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *     << TestLog::ImageSet("Result", "Result images")
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *     << TestLog::Image("ImageA", "Image A", imageA)
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *     << TestLog::Image("ImageB", "Image B", imageB)
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *     << TestLog::EndImageSet << TestLog::EndSection;
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \endcode
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TestLog
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Tokens
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static const class BeginMessageToken {}			Message;
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static const class EndMessageToken {}			EndMessage;
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static const class EndImageSetToken {}			EndImageSet;
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static const class EndSectionToken {}			EndSection;
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static const class EndShaderProgramToken {}		EndShaderProgram;
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static const class SampleInfoToken {}			SampleInfo;
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static const class EndSampleInfoToken {}		EndSampleInfo;
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static const class BeginSampleToken {}			Sample;
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static const class EndSampleToken {}			EndSample;
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static const class EndSampleListToken {}		EndSampleList;
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Typedefs.
93133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski	typedef LogImageSet				ImageSet;
94133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski	typedef LogImage				Image;
95133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski	typedef LogSection				Section;
96133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski	typedef LogShaderProgram		ShaderProgram;
97133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski	typedef LogShader				Shader;
98133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski	typedef LogSpirVAssemblySource	SpirVAssemblySource;
99133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski	typedef LogKernelSource			KernelSource;
100133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski	typedef LogSampleList			SampleList;
101133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski	typedef LogValueInfo			ValueInfo;
102133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski	typedef LogNumber<float>		Float;
103133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski	typedef LogNumber<deInt64>		Integer;
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	explicit			TestLog					(const char* fileName, deUint32 flags = 0);
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						~TestLog				(void);
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	MessageBuilder		operator<<				(const BeginMessageToken&);
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	MessageBuilder		message					(void);
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog&			operator<<				(const ImageSet& imageSet);
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog&			operator<<				(const Image& image);
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog&			operator<<				(const EndImageSetToken&);
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog&			operator<<				(const Section& section);
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog&			operator<<				(const EndSectionToken&);
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog&			operator<<				(const ShaderProgram& shaderProgram);
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog&			operator<<				(const EndShaderProgramToken&);
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog&			operator<<				(const Shader& shader);
121133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski	TestLog&			operator<<				(const SpirVAssemblySource& module);
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog&			operator<<				(const KernelSource& kernelSrc);
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	template<typename T>
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog&			operator<<				(const LogNumber<T>& number);
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog&			operator<<				(const SampleList& sampleList);
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog&			operator<<				(const SampleInfoToken&);
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog&			operator<<				(const ValueInfo& valueInfo);
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog&			operator<<				(const EndSampleInfoToken&);
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	SampleBuilder		operator<<				(const BeginSampleToken&);
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog&			operator<<				(const EndSampleListToken&);
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Raw api
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				writeMessage			(const char* message);
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				startImageSet			(const char* name, const char* description);
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				endImageSet				(void);
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				writeImage				(const char* name, const char* description, const ConstPixelBufferAccess& surface, const Vec4& scale, const Vec4& bias, qpImageCompressionMode compressionMode = QP_IMAGE_COMPRESSION_MODE_BEST);
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				writeImage				(const char* name, const char* description, qpImageCompressionMode compressionMode, qpImageFormat format, int width, int height, int stride, const void* data);
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				startSection			(const char* name, const char* description);
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				endSection				(void);
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				startShaderProgram		(bool linkOk, const char* linkInfoLog);
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				endShaderProgram		(void);
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				writeShader				(qpShaderType type, const char* source, bool compileOk, const char* infoLog);
149133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski	void				writeSpirVAssemblySource(const char* source);
1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				writeKernelSource		(const char* source);
1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				writeCompileInfo		(const char* name, const char* description, bool compileOk, const char* infoLog);
1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				writeFloat				(const char* name, const char* description, const char* unit, qpKeyValueTag tag, float value);
1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				writeInteger			(const char* name, const char* description, const char* unit, qpKeyValueTag tag, deInt64 value);
1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				startEglConfigSet		(const char* name, const char* description);
1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				writeEglConfig			(const qpEglConfigInfo* config);
1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				endEglConfigSet			(void);
1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				startCase				(const char* testCasePath, qpTestCaseType testCaseType);
1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				endCase					(qpTestResult result, const char* description);
1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				terminateCase			(qpTestResult result);
1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				startSampleList			(const std::string& name, const std::string& description);
1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				startSampleInfo			(void);
1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				writeValueInfo			(const std::string& name, const std::string& description, const std::string& unit, qpSampleValueTag tag);
1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				endSampleInfo			(void);
1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				startSample				(void);
1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				writeSampleValue		(double value);
1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				writeSampleValue		(deInt64 value);
1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				endSample				(void);
1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				endSampleList			(void);
1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						TestLog					(const TestLog& other); // Not allowed!
1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog&			operator=				(const TestLog& other); // Not allowed!
1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	qpTestLog*			m_log;
1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass MessageBuilder
1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	explicit				MessageBuilder		(TestLog* log) : m_log(log) {}
1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							~MessageBuilder		(void) {}
1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string				toString			(void) const { return m_str.str(); }
1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog&				operator<<			(const TestLog::EndMessageToken&);
1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	template <typename T>
1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	MessageBuilder&			operator<<			(const T& value);
1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							MessageBuilder		(const MessageBuilder& other);
1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	MessageBuilder&			operator=			(const MessageBuilder& other);
1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog*				m_log;
1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::ostringstream		m_str;
2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass SampleBuilder
2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							SampleBuilder		(TestLog* log) : m_log(log) {}
2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	SampleBuilder&			operator<<			(int v)		{ m_values.push_back(Value((deInt64)v));	return *this; }
2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	SampleBuilder&			operator<<			(deInt64 v)	{ m_values.push_back(Value(v));				return *this; }
2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	SampleBuilder&			operator<<			(float v)	{ m_values.push_back(Value((double)v));		return *this; }
2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	SampleBuilder&			operator<<			(double v)	{ m_values.push_back(Value(v));				return *this; }
2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog&				operator<<			(const TestLog::EndSampleToken&);
2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	struct Value
2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		enum Type { TYPE_INT64 = 0, TYPE_FLOAT64, TYPE_LAST };
2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		Type	type;
2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		union
2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			deInt64		int64;
2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			double		float64;
2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		} value;
2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		Value (void)		: type(TYPE_LAST)		{ value.int64 = 0;		}
2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		Value (double v)	: type(TYPE_FLOAT64)	{ value.float64 = v;	}
2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		Value (deInt64 v)	: type(TYPE_INT64)		{ value.int64 = v;		}
2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog*				m_log;
2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<Value>		m_values;
2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LogImageSet
2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	LogImageSet (const std::string& name, const std::string& description)
2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: m_name		(name)
2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_description	(description)
2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void write (TestLog& log) const;
2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string		m_name;
2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string		m_description;
2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// \note Doesn't take copy of surface contents
2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LogImage
2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	LogImage (const std::string& name, const std::string& description, const Surface& surface, qpImageCompressionMode compression = QP_IMAGE_COMPRESSION_MODE_BEST);
2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	LogImage (const std::string& name, const std::string& description, const ConstPixelBufferAccess& access, qpImageCompressionMode compression = QP_IMAGE_COMPRESSION_MODE_BEST);
2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
259fcbb91dc538f174f8798417e5a44f74ec2b092c0Jarkko Pöyry	LogImage (const std::string& name, const std::string& description, const ConstPixelBufferAccess& access, const Vec4& scale, const Vec4& bias, qpImageCompressionMode compression = QP_IMAGE_COMPRESSION_MODE_BEST);
2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void write (TestLog& log) const;
2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string				m_name;
2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string				m_description;
2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ConstPixelBufferAccess	m_access;
2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	Vec4					m_scale;
2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	Vec4					m_bias;
2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	qpImageCompressionMode	m_compression;
2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LogSection
2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	LogSection (const std::string& name, const std::string& description)
2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: m_name		(name)
2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_description	(description)
2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void write (TestLog& log) const;
2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string		m_name;
2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string		m_description;
2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LogShaderProgram
2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	LogShaderProgram (bool linkOk, const std::string& linkInfoLog)
2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: m_linkOk		(linkOk)
2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_linkInfoLog	(linkInfoLog)
2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void write (TestLog& log) const;
2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool			m_linkOk;
3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string		m_linkInfoLog;
3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LogShader
3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	LogShader (qpShaderType type, const std::string& source, bool compileOk, const std::string& infoLog)
3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: m_type		(type)
3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_source		(source)
3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_compileOk	(compileOk)
3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_infoLog		(infoLog)
3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void write (TestLog& log) const;
3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	qpShaderType	m_type;
3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string		m_source;
3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool			m_compileOk;
3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string		m_infoLog;
3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
324133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevskiclass LogSpirVAssemblySource
325133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski{
326133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevskipublic:
327133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski	LogSpirVAssemblySource (const std::string& source)
328133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski		: m_source		(source)
329133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski	{
330133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski	}
331133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski
332133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski	void write (TestLog& log) const;
333133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski
334133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevskiprivate:
335133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski	std::string		m_source;
336133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski};
337133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski
3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LogKernelSource
3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	explicit LogKernelSource (const std::string& source)
3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: m_source(source)
3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void write (TestLog& log) const;
3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string	m_source;
3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LogSampleList
3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	LogSampleList (const std::string& name, const std::string& description)
3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: m_name		(name)
3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_description	(description)
3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void write (TestLog& log) const;
3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string		m_name;
3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string		m_description;
3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LogValueInfo
3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	LogValueInfo (const std::string& name, const std::string& description, const std::string& unit, qpSampleValueTag tag)
3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: m_name		(name)
3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_description	(description)
3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_unit		(unit)
3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_tag			(tag)
3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void write (TestLog& log) const;
3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string			m_name;
3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string			m_description;
3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string			m_unit;
3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	qpSampleValueTag	m_tag;
3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytemplate<typename T>
3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass LogNumber
3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	LogNumber (const std::string& name, const std::string& desc, const std::string& unit, qpKeyValueTag tag, T value)
3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: m_name	(name)
3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_desc	(desc)
3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_unit	(unit)
3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_tag		(tag)
3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_value	(value)
3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void write (TestLog& log) const;
4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string		m_name;
4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string		m_desc;
4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string		m_unit;
4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	qpKeyValueTag	m_tag;
4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	T				m_value;
4093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Section helper that closes section when leaving scope.
4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ScopedLogSection
4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ScopedLogSection (TestLog& log, const std::string& name, const std::string& description)
4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: m_log(log)
4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_log << TestLog::Section(name, description);
4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	~ScopedLogSection (void)
4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_log << TestLog::EndSection;
4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog& m_log;
4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
4293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// TestLog stream operators.
4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline TestLog& TestLog::operator<< (const ImageSet& imageSet)			{ imageSet.write(*this);	return *this;	}
4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline TestLog& TestLog::operator<< (const Image& image)				{ image.write(*this);		return *this;	}
4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline TestLog& TestLog::operator<< (const EndImageSetToken&)			{ endImageSet();			return *this;	}
4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline TestLog& TestLog::operator<< (const Section& section)			{ section.write(*this);		return *this;	}
4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline TestLog& TestLog::operator<< (const EndSectionToken&)			{ endSection();				return *this;	}
4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline TestLog& TestLog::operator<< (const ShaderProgram& shaderProg)	{ shaderProg.write(*this);	return *this;	}
4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline TestLog& TestLog::operator<< (const EndShaderProgramToken&)		{ endShaderProgram();		return *this;	}
4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline TestLog& TestLog::operator<< (const Shader& shader)				{ shader.write(*this);		return *this;	}
440133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevskiinline TestLog& TestLog::operator<< (const SpirVAssemblySource& module)	{ module.write(*this);		return *this;	}
4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline TestLog& TestLog::operator<< (const KernelSource& kernelSrc)		{ kernelSrc.write(*this);	return *this;	}
4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline TestLog&	TestLog::operator<<	(const SampleList& sampleList)		{ sampleList.write(*this);	return *this;	}
4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline TestLog&	TestLog::operator<<	(const SampleInfoToken&)			{ startSampleInfo();		return *this;	}
4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline TestLog&	TestLog::operator<<	(const ValueInfo& valueInfo)		{ valueInfo.write(*this);	return *this;	}
4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline TestLog&	TestLog::operator<<	(const EndSampleInfoToken&)			{ endSampleInfo();			return *this;	}
4463c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline TestLog&	TestLog::operator<<	(const EndSampleListToken&)			{ endSampleList();			return *this;	}
4473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4483c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytemplate<typename T>
4493c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline TestLog& TestLog::operator<< (const LogNumber<T>& number)
4503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	number.write(*this);
4523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return *this;
4533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4553c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline TestLog& operator<< (TestLog& log, const std::exception& e)
4563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// \todo [2012-10-18 pyry] Print type info?
4583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return log << TestLog::Message << e.what() << TestLog::EndMessage;
4593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Utility class inline implementations.
4623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4633c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytemplate <typename T>
4643c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline MessageBuilder& MessageBuilder::operator<< (const T& value)
4653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Overload stream operator to implement custom format
4673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_str << value;
4683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return *this;
4693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4713c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline MessageBuilder TestLog::operator<< (const BeginMessageToken&)
4723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return MessageBuilder(this);
4743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4763c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline MessageBuilder TestLog::message (void)
4773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return MessageBuilder(this);
4793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4813c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline SampleBuilder TestLog::operator<< (const BeginSampleToken&)
4823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return SampleBuilder(this);
4843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4863c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline void LogImageSet::write (TestLog& log) const
4873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	log.startImageSet(m_name.c_str(), m_description.c_str());
4893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4913c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline void LogSection::write (TestLog& log) const
4923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	log.startSection(m_name.c_str(), m_description.c_str());
4943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4963c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline void LogShaderProgram::write (TestLog& log) const
4973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	log.startShaderProgram(m_linkOk, m_linkInfoLog.c_str());
4993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
5003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5013c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline void LogShader::write (TestLog& log) const
5023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
5033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	log.writeShader(m_type, m_source.c_str(), m_compileOk, m_infoLog.c_str());
5043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
5053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
506133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevskiinline void LogSpirVAssemblySource::write (TestLog& log) const
507133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski{
508133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski	log.writeSpirVAssemblySource(m_source.c_str());
509133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski}
510133cd2f4e4966f3df1ebea16ca33ef571e7b37dbDejan Mircevski
5113c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline void LogKernelSource::write (TestLog& log) const
5123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
5133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	log.writeKernelSource(m_source.c_str());
5143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
5153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5163c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline void LogSampleList::write (TestLog& log) const
5173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
5183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	log.startSampleList(m_name, m_description);
5193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
5203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5213c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline void LogValueInfo::write (TestLog& log) const
5223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
5233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	log.writeValueInfo(m_name, m_description, m_unit, m_tag);
5243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
5253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5263c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytemplate<>
5273c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline void LogNumber<float>::write (TestLog& log) const
5283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
5293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	log.writeFloat(m_name.c_str(), m_desc.c_str(), m_unit.c_str(), m_tag, m_value);
5303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
5313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5323c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytemplate<>
5333c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline void LogNumber<deInt64>::write (TestLog& log) const
5343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
5353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	log.writeInteger(m_name.c_str(), m_desc.c_str(), m_unit.c_str(), m_tag, m_value);
5363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
5373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // tcu
5393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif // _TCUTESTLOG_HPP
541