• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*-------------------------------------------------------------------------
2  * drawElements Quality Program Tester Core
3  * ----------------------------------------
4  *
5  * Copyright 2014 The Android Open Source Project
6  *
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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  *//*!
20  * \file
21  * \brief Test Log C++ Wrapper.
22  *//*--------------------------------------------------------------------*/
23 
24 #include "deCommandLine.h"
25 #include "tcuTestLog.hpp"
26 #include "tcuTextureUtil.hpp"
27 #include "tcuSurface.hpp"
28 #include "deMath.h"
29 
30 #include <limits>
31 
32 namespace tcu
33 {
34 
35 class LogWriteFailedError : public ResourceError
36 {
37 public:
LogWriteFailedError(void)38 	LogWriteFailedError (void) : ResourceError("Writing to test log failed") {}
39 };
40 
41 enum
42 {
43 	MAX_IMAGE_SIZE_2D		= 4096,
44 	MAX_IMAGE_SIZE_3D		= 128
45 };
46 
47 // LogImage
48 
LogImage(const std::string & name,const std::string & description,const Surface & surface,qpImageCompressionMode compression)49 LogImage::LogImage (const std::string& name, const std::string& description, const Surface& surface, qpImageCompressionMode compression)
50 	: m_name		(name)
51 	, m_description	(description)
52 	, m_access		(surface.getAccess())
53 	, m_scale		(1.0f, 1.0f, 1.0f, 1.0f)
54 	, m_bias		(0.0f, 0.0f, 0.0f, 0.0f)
55 	, m_compression	(compression)
56 {
57 }
58 
LogImage(const std::string & name,const std::string & description,const ConstPixelBufferAccess & access,qpImageCompressionMode compression)59 LogImage::LogImage (const std::string& name, const std::string& description, const ConstPixelBufferAccess& access, qpImageCompressionMode compression)
60 	: m_name		(name)
61 	, m_description	(description)
62 	, m_access		(access)
63 	, m_scale		(1.0f, 1.0f, 1.0f, 1.0f)
64 	, m_bias		(0.0f, 0.0f, 0.0f, 0.0f)
65 	, m_compression	(compression)
66 {
67 	// Simplify combined formats that only use a single channel
68 	if (tcu::isCombinedDepthStencilType(m_access.getFormat().type))
69 	{
70 		if (m_access.getFormat().order == tcu::TextureFormat::D)
71 			m_access = tcu::getEffectiveDepthStencilAccess(m_access, tcu::Sampler::MODE_DEPTH);
72 		else if (m_access.getFormat().order == tcu::TextureFormat::S)
73 			m_access = tcu::getEffectiveDepthStencilAccess(m_access, tcu::Sampler::MODE_STENCIL);
74 	}
75 
76 	// Implicit scale and bias
77 	if (m_access.getFormat().order != tcu::TextureFormat::DS)
78 		computePixelScaleBias(m_access, m_scale, m_bias);
79 	else
80 	{
81 		// Pack D and S bias and scale to R and G
82 		const ConstPixelBufferAccess	depthAccess		= tcu::getEffectiveDepthStencilAccess(m_access, tcu::Sampler::MODE_DEPTH);
83 		const ConstPixelBufferAccess	stencilAccess	= tcu::getEffectiveDepthStencilAccess(m_access, tcu::Sampler::MODE_STENCIL);
84 		tcu::Vec4						depthScale;
85 		tcu::Vec4						depthBias;
86 		tcu::Vec4						stencilScale;
87 		tcu::Vec4						stencilBias;
88 
89 		computePixelScaleBias(depthAccess, depthScale, depthBias);
90 		computePixelScaleBias(stencilAccess, stencilScale, stencilBias);
91 
92 		m_scale = tcu::Vec4(depthScale.x(), stencilScale.x(), 0.0f, 0.0f);
93 		m_bias = tcu::Vec4(depthBias.x(), stencilBias.x(), 0.0f, 0.0f);
94 	}
95 }
96 
LogImage(const std::string & name,const std::string & description,const ConstPixelBufferAccess & access,const Vec4 & scale,const Vec4 & bias,qpImageCompressionMode compression)97 LogImage::LogImage (const std::string& name, const std::string& description, const ConstPixelBufferAccess& access, const Vec4& scale, const Vec4& bias, qpImageCompressionMode compression)
98 	: m_name		(name)
99 	, m_description	(description)
100 	, m_access		(access)
101 	, m_scale		(scale)
102 	, m_bias		(bias)
103 	, m_compression	(compression)
104 {
105 	// Cannot set scale and bias of combined formats
106 	DE_ASSERT(access.getFormat().order != tcu::TextureFormat::DS);
107 
108 	// Simplify access
109 	if (tcu::isCombinedDepthStencilType(access.getFormat().type))
110 	{
111 		if (access.getFormat().order == tcu::TextureFormat::D)
112 			m_access = tcu::getEffectiveDepthStencilAccess(access, tcu::Sampler::MODE_DEPTH);
113 		if (access.getFormat().order == tcu::TextureFormat::S)
114 			m_access = tcu::getEffectiveDepthStencilAccess(access, tcu::Sampler::MODE_STENCIL);
115 		else
116 		{
117 			// Cannot log a DS format
118 			DE_ASSERT(false);
119 			return;
120 		}
121 	}
122 }
123 
write(TestLog & log) const124 void LogImage::write (TestLog& log) const
125 {
126 	if (m_access.getFormat().order != tcu::TextureFormat::DS)
127 		log.writeImage(m_name.c_str(), m_description.c_str(), m_access, m_scale, m_bias, m_compression);
128 	else
129 	{
130 		const ConstPixelBufferAccess	depthAccess		= tcu::getEffectiveDepthStencilAccess(m_access, tcu::Sampler::MODE_DEPTH);
131 		const ConstPixelBufferAccess	stencilAccess	= tcu::getEffectiveDepthStencilAccess(m_access, tcu::Sampler::MODE_STENCIL);
132 
133 		log.startImageSet(m_name.c_str(), m_description.c_str());
134 		log.writeImage("Depth", "Depth channel", depthAccess, m_scale.swizzle(0, 0, 0, 0), m_bias.swizzle(0, 0, 0, 0), m_compression);
135 		log.writeImage("Stencil", "Stencil channel", stencilAccess, m_scale.swizzle(1, 1, 1, 1), m_bias.swizzle(1, 1, 1, 1), m_compression);
136 		log.endImageSet();
137 	}
138 }
139 
140 // MessageBuilder
141 
MessageBuilder(const MessageBuilder & other)142 MessageBuilder::MessageBuilder (const MessageBuilder& other)
143 	: m_log(other.m_log)
144 {
145 	m_str.str(other.m_str.str());
146 }
147 
operator =(const MessageBuilder & other)148 MessageBuilder& MessageBuilder::operator= (const MessageBuilder& other)
149 {
150 	m_log = other.m_log;
151 	m_str.str(other.m_str.str());
152 	return *this;
153 }
154 
operator <<(const TestLog::EndMessageToken &)155 TestLog& MessageBuilder::operator<< (const TestLog::EndMessageToken&)
156 {
157 	m_log->writeMessage(m_str.str().c_str());
158 	return *m_log;
159 }
160 
161 // SampleBuilder
162 
operator <<(const TestLog::EndSampleToken &)163 TestLog& SampleBuilder::operator<< (const TestLog::EndSampleToken&)
164 {
165 	m_log->startSample();
166 
167 	for (std::vector<Value>::const_iterator val = m_values.begin(); val != m_values.end(); ++val)
168 	{
169 		if (val->type == Value::TYPE_FLOAT64)
170 			m_log->writeSampleValue(val->value.float64);
171 		else if (val->type == Value::TYPE_INT64)
172 			m_log->writeSampleValue(val->value.int64);
173 		else
174 			DE_ASSERT(false);
175 	}
176 
177 	m_log->endSample();
178 
179 	return *m_log;
180 }
181 
182 // TestLog
183 
TestLog(const char * fileName,deUint32 flags)184 TestLog::TestLog (const char* fileName, deUint32 flags)
185 	: m_log(qpTestLog_createFileLog(fileName, flags)), m_logSupressed(false)
186 {
187 	if (!m_log)
188 		throw ResourceError(std::string("Failed to open test log file '") + fileName + "'");
189 }
190 
writeSessionInfo(std::string additionalInfo)191 void TestLog::writeSessionInfo(std::string additionalInfo)
192 {
193 	qpTestLog_beginSession(m_log, additionalInfo.c_str());
194 }
195 
~TestLog(void)196 TestLog::~TestLog (void)
197 {
198 	qpTestLog_destroy(m_log);
199 }
200 
writeMessage(const char * msgStr)201 void TestLog::writeMessage (const char* msgStr)
202 {
203 	if (m_logSupressed) return;
204 	if (qpTestLog_writeText(m_log, DE_NULL, DE_NULL, QP_KEY_TAG_NONE, msgStr) == DE_FALSE)
205 		throw LogWriteFailedError();
206 }
207 
startImageSet(const char * name,const char * description)208 void TestLog::startImageSet (const char* name, const char* description)
209 {
210 	if (m_logSupressed) return;
211 	if (qpTestLog_startImageSet(m_log, name, description) == DE_FALSE)
212 		throw LogWriteFailedError();
213 }
214 
endImageSet(void)215 void TestLog::endImageSet (void)
216 {
217 	if (m_logSupressed) return;
218 	if (qpTestLog_endImageSet(m_log) == DE_FALSE)
219 		throw LogWriteFailedError();
220 }
221 
222 template <int Size>
computeScaledSize(const Vector<int,Size> & imageSize,int maxSize)223 static Vector<int, Size> computeScaledSize (const Vector<int, Size>& imageSize, int maxSize)
224 {
225 	bool allInRange = true;
226 	for (int i = 0; i < Size; i++)
227 		allInRange = allInRange && (imageSize[i] <= maxSize);
228 
229 	if (allInRange)
230 		return imageSize;
231 	else
232 	{
233 		float d = 1.0f;
234 		for (int i = 0; i < Size; i++)
235 			d = de::max(d, (float)imageSize[i] / (float)maxSize);
236 
237 		Vector<int, Size> res;
238 		for (int i = 0; i < Size; i++)
239 			res[i] = de::max(1, deRoundFloatToInt32((float)imageSize[i] / d));
240 
241 		return res;
242 	}
243 }
244 
writeImage(const char * name,const char * description,const ConstPixelBufferAccess & access,const Vec4 & pixelScale,const Vec4 & pixelBias,qpImageCompressionMode compressionMode)245 void TestLog::writeImage (const char* name, const char* description, const ConstPixelBufferAccess& access, const Vec4& pixelScale, const Vec4& pixelBias, qpImageCompressionMode compressionMode)
246 {
247 	if (m_logSupressed) return;
248 	const TextureFormat&	format		= access.getFormat();
249 	int						width		= access.getWidth();
250 	int						height		= access.getHeight();
251 	int						depth		= access.getDepth();
252 
253 	// Writing a combined image does not make sense
254 	DE_ASSERT(!tcu::isCombinedDepthStencilType(access.getFormat().type));
255 
256 	// Do not bother with preprocessing if images are not stored
257 	if ((qpTestLog_getLogFlags(m_log) & QP_TEST_LOG_EXCLUDE_IMAGES) != 0)
258 		return;
259 
260 	if (depth == 1 && format.type == TextureFormat::UNORM_INT8
261 		&& width <= MAX_IMAGE_SIZE_2D && height <= MAX_IMAGE_SIZE_2D
262 		&& (format.order == TextureFormat::RGB || format.order == TextureFormat::RGBA)
263 		&& access.getPixelPitch() == access.getFormat().getPixelSize()
264 		&& pixelBias[0] == 0.0f && pixelBias[1] == 0.0f && pixelBias[2] == 0.0f && pixelBias[3] == 0.0f
265 		&& pixelScale[0] == 1.0f && pixelScale[1] == 1.0f && pixelScale[2] == 1.0f && pixelScale[3] == 1.0f)
266 	{
267 		// Fast-path.
268 		bool isRGBA = format.order == TextureFormat::RGBA;
269 
270 		writeImage(name, description, compressionMode,
271 				   isRGBA ? QP_IMAGE_FORMAT_RGBA8888 : QP_IMAGE_FORMAT_RGB888,
272 				   width, height, access.getRowPitch(), access.getDataPtr());
273 	}
274 	else if (depth == 1)
275 	{
276 		Sampler				sampler			(Sampler::CLAMP_TO_EDGE, Sampler::CLAMP_TO_EDGE, Sampler::CLAMP_TO_EDGE, Sampler::LINEAR, Sampler::NEAREST);
277 		IVec2				logImageSize	= computeScaledSize(IVec2(width, height), MAX_IMAGE_SIZE_2D);
278 		tcu::TextureLevel	logImage		(TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), logImageSize.x(), logImageSize.y(), 1);
279 		PixelBufferAccess	logImageAccess	= logImage.getAccess();
280 		std::ostringstream	longDesc;
281 
282 		longDesc << description << " (p' = p * " << pixelScale << " + " << pixelBias << ")";
283 
284 		for (int y = 0; y < logImage.getHeight(); y++)
285 		{
286 			for (int x = 0; x < logImage.getWidth(); x++)
287 			{
288 				float	yf	= ((float)y + 0.5f) / (float)logImage.getHeight();
289 				float	xf	= ((float)x + 0.5f) / (float)logImage.getWidth();
290 				Vec4	s	= access.sample2D(sampler, sampler.minFilter, xf, yf, 0)*pixelScale + pixelBias;
291 
292 				logImageAccess.setPixel(s, x, y);
293 			}
294 		}
295 
296 		writeImage(name, longDesc.str().c_str(), compressionMode, QP_IMAGE_FORMAT_RGBA8888,
297 				   logImageAccess.getWidth(), logImageAccess.getHeight(), logImageAccess.getRowPitch(),
298 				   logImageAccess.getDataPtr());
299 	}
300 	else
301 	{
302 		// Isometric splat volume rendering.
303 		const float			blendFactor			= 0.85f;
304 		IVec3				scaledSize			= computeScaledSize(IVec3(width, height, depth), MAX_IMAGE_SIZE_3D);
305 		int					w					= scaledSize.x();
306 		int					h					= scaledSize.y();
307 		int					d					= scaledSize.z();
308 		int					logImageW			= w+d - 1;
309 		int					logImageH			= w+d+h;
310 		std::vector<float>	blendImage			(logImageW*logImageH*4, 0.0f);
311 		PixelBufferAccess	blendImageAccess	(TextureFormat(TextureFormat::RGBA, TextureFormat::FLOAT), logImageW, logImageH, 1, &blendImage[0]);
312 		tcu::TextureLevel	logImage			(TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), logImageW, logImageH, 1);
313 		PixelBufferAccess	logImageAccess		= logImage.getAccess();
314 		Sampler				sampler				(Sampler::CLAMP_TO_EDGE, Sampler::CLAMP_TO_EDGE, Sampler::CLAMP_TO_EDGE, Sampler::NEAREST, Sampler::NEAREST);
315 		std::ostringstream	longDesc;
316 
317 		// \note Back-to-front.
318 		for (int z = d-1; z >= 0; z--)
319 		{
320 			for (int y = 0; y < h; y++)
321 			{
322 				for (int x = 0; x < w; x++)
323 				{
324 					int		px	= w - (x + 1) + z;
325 					int		py	= (w + d + h) - (x + y + z + 1);
326 
327 					float	xf	= ((float)x + 0.5f) / (float)w;
328 					float	yf	= ((float)y + 0.5f) / (float)h;
329 					float	zf	= ((float)z + 0.5f) / (float)d;
330 
331 					Vec4	p	= blendImageAccess.getPixel(px, py);
332 					Vec4	s	= access.sample3D(sampler, sampler.minFilter, xf, yf, zf);
333 					Vec4	b	= s + p*blendFactor;
334 
335 					blendImageAccess.setPixel(b, px, py);
336 				}
337 			}
338 		}
339 
340 		// Scale blend image nicely.
341 		longDesc << description << " (p' = p * " << pixelScale << " + " << pixelBias << ")";
342 
343 		// Write to final image.
344 		tcu::clear(logImageAccess, tcu::IVec4(0x33, 0x66, 0x99, 0xff));
345 
346 		for (int z = 0; z < d; z++)
347 		{
348 			for (int y = 0; y < h; y++)
349 			{
350 				for (int x = 0; x < w; x++)
351 				{
352 					if (z != 0 && !(x == 0 || y == h-1 || y == h-2))
353 						continue;
354 
355 					int		px	= w - (x + 1) + z;
356 					int		py	= (w + d + h) - (x + y + z + 1);
357 					Vec4	s	= blendImageAccess.getPixel(px, py)*pixelScale + pixelBias;
358 
359 					logImageAccess.setPixel(s, px, py);
360 				}
361 			}
362 		}
363 
364 		writeImage(name, longDesc.str().c_str(), compressionMode, QP_IMAGE_FORMAT_RGBA8888,
365 				   logImageAccess.getWidth(), logImageAccess.getHeight(), logImageAccess.getRowPitch(),
366 				   logImageAccess.getDataPtr());
367 	}
368 }
369 
writeImage(const char * name,const char * description,qpImageCompressionMode compressionMode,qpImageFormat format,int width,int height,int stride,const void * data)370 void TestLog::writeImage (const char* name, const char* description, qpImageCompressionMode compressionMode, qpImageFormat format, int width, int height, int stride, const void* data)
371 {
372 	if (m_logSupressed) return;
373 	if (qpTestLog_writeImage(m_log, name, description, compressionMode, format, width, height, stride, data) == DE_FALSE)
374 		throw LogWriteFailedError();
375 }
376 
startSection(const char * name,const char * description)377 void TestLog::startSection (const char* name, const char* description)
378 {
379 	if (m_logSupressed) return;
380 	if (qpTestLog_startSection(m_log, name, description) == DE_FALSE)
381 		throw LogWriteFailedError();
382 }
383 
endSection(void)384 void TestLog::endSection (void)
385 {
386 	if (m_logSupressed) return;
387 	if (qpTestLog_endSection(m_log) == DE_FALSE)
388 		throw LogWriteFailedError();
389 }
390 
startShaderProgram(bool linkOk,const char * linkInfoLog)391 void TestLog::startShaderProgram (bool linkOk, const char* linkInfoLog)
392 {
393 	if (m_logSupressed) return;
394 	if (qpTestLog_startShaderProgram(m_log, linkOk?DE_TRUE:DE_FALSE, linkInfoLog) == DE_FALSE)
395 		throw LogWriteFailedError();
396 }
397 
endShaderProgram(void)398 void TestLog::endShaderProgram (void)
399 {
400 	if (m_logSupressed) return;
401 	if (qpTestLog_endShaderProgram(m_log) == DE_FALSE)
402 		throw LogWriteFailedError();
403 }
404 
writeShader(qpShaderType type,const char * source,bool compileOk,const char * infoLog)405 void TestLog::writeShader (qpShaderType type, const char* source, bool compileOk, const char* infoLog)
406 {
407 	if (m_logSupressed) return;
408 	if (qpTestLog_writeShader(m_log, type, source, compileOk?DE_TRUE:DE_FALSE, infoLog) == DE_FALSE)
409 		throw LogWriteFailedError();
410 }
411 
writeSpirVAssemblySource(const char * source)412 void TestLog::writeSpirVAssemblySource (const char* source)
413 {
414 	if (m_logSupressed) return;
415 	if (qpTestLog_writeSpirVAssemblySource(m_log, source) == DE_FALSE)
416 		throw LogWriteFailedError();
417 }
418 
writeKernelSource(const char * source)419 void TestLog::writeKernelSource (const char* source)
420 {
421 	if (m_logSupressed) return;
422 	if (qpTestLog_writeKernelSource(m_log, source) == DE_FALSE)
423 		throw LogWriteFailedError();
424 }
425 
writeCompileInfo(const char * name,const char * description,bool compileOk,const char * infoLog)426 void TestLog::writeCompileInfo (const char* name, const char* description, bool compileOk, const char* infoLog)
427 {
428 	if (m_logSupressed) return;
429 	if (qpTestLog_writeCompileInfo(m_log, name, description, compileOk ? DE_TRUE : DE_FALSE, infoLog) == DE_FALSE)
430 		throw LogWriteFailedError();
431 }
432 
writeFloat(const char * name,const char * description,const char * unit,qpKeyValueTag tag,float value)433 void TestLog::writeFloat (const char* name, const char* description, const char* unit, qpKeyValueTag tag, float value)
434 {
435 	if (m_logSupressed) return;
436 	if (qpTestLog_writeFloat(m_log, name, description, unit, tag, value) == DE_FALSE)
437 		throw LogWriteFailedError();
438 }
439 
writeInteger(const char * name,const char * description,const char * unit,qpKeyValueTag tag,deInt64 value)440 void TestLog::writeInteger (const char* name, const char* description, const char* unit, qpKeyValueTag tag, deInt64 value)
441 {
442 	if (m_logSupressed) return;
443 	if (qpTestLog_writeInteger(m_log, name, description, unit, tag, value) == DE_FALSE)
444 		throw LogWriteFailedError();
445 }
446 
startEglConfigSet(const char * name,const char * description)447 void TestLog::startEglConfigSet (const char* name, const char* description)
448 {
449 	if (m_logSupressed) return;
450 	if (qpTestLog_startEglConfigSet(m_log, name, description) == DE_FALSE)
451 		throw LogWriteFailedError();
452 }
453 
writeEglConfig(const qpEglConfigInfo * config)454 void TestLog::writeEglConfig (const qpEglConfigInfo* config)
455 {
456 	if (m_logSupressed) return;
457 	if (qpTestLog_writeEglConfig(m_log, config) == DE_FALSE)
458 		throw LogWriteFailedError();
459 }
460 
endEglConfigSet(void)461 void TestLog::endEglConfigSet (void)
462 {
463 	if (m_logSupressed) return;
464 	if (qpTestLog_endEglConfigSet(m_log) == DE_FALSE)
465 		throw LogWriteFailedError();
466 }
467 
startCase(const char * testCasePath,qpTestCaseType testCaseType)468 void TestLog::startCase (const char* testCasePath, qpTestCaseType testCaseType)
469 {
470 	if (m_logSupressed) return;
471 	if (qpTestLog_startCase(m_log, testCasePath, testCaseType) == DE_FALSE)
472 		throw LogWriteFailedError();
473 }
474 
endCase(qpTestResult result,const char * description)475 void TestLog::endCase (qpTestResult result, const char* description)
476 {
477 	if (m_logSupressed) return;
478 	if (qpTestLog_endCase(m_log, result, description) == DE_FALSE)
479 		throw LogWriteFailedError();
480 }
481 
terminateCase(qpTestResult result)482 void TestLog::terminateCase (qpTestResult result)
483 {
484 	if (m_logSupressed) return;
485 	if (qpTestLog_terminateCase(m_log, result) == DE_FALSE)
486 		throw LogWriteFailedError();
487 }
488 
startTestsCasesTime(void)489 void TestLog::startTestsCasesTime (void)
490 {
491 	if (m_logSupressed) return;
492 	if (qpTestLog_startTestsCasesTime(m_log) == DE_FALSE)
493 		throw LogWriteFailedError();
494 }
495 
endTestsCasesTime(void)496 void TestLog::endTestsCasesTime (void)
497 {
498 	if (m_logSupressed) return;
499 	if (qpTestLog_endTestsCasesTime(m_log) == DE_FALSE)
500 		throw LogWriteFailedError();
501 }
502 
startSampleList(const std::string & name,const std::string & description)503 void TestLog::startSampleList (const std::string& name, const std::string& description)
504 {
505 	if (m_logSupressed) return;
506 	if (qpTestLog_startSampleList(m_log, name.c_str(), description.c_str()) == DE_FALSE)
507 		throw LogWriteFailedError();
508 }
509 
startSampleInfo(void)510 void TestLog::startSampleInfo (void)
511 {
512 	if (m_logSupressed) return;
513 	if (qpTestLog_startSampleInfo(m_log) == DE_FALSE)
514 		throw LogWriteFailedError();
515 }
516 
writeValueInfo(const std::string & name,const std::string & description,const std::string & unit,qpSampleValueTag tag)517 void TestLog::writeValueInfo (const std::string& name, const std::string& description, const std::string& unit, qpSampleValueTag tag)
518 {
519 	if (m_logSupressed) return;
520 	if (qpTestLog_writeValueInfo(m_log, name.c_str(), description.c_str(), unit.empty() ? DE_NULL : unit.c_str(), tag) == DE_FALSE)
521 		throw LogWriteFailedError();
522 }
523 
endSampleInfo(void)524 void TestLog::endSampleInfo (void)
525 {
526 	if (m_logSupressed) return;
527 	if (qpTestLog_endSampleInfo(m_log) == DE_FALSE)
528 		throw LogWriteFailedError();
529 }
530 
startSample(void)531 void TestLog::startSample (void)
532 {
533 	if (m_logSupressed) return;
534 	if (qpTestLog_startSample(m_log) == DE_FALSE)
535 		throw LogWriteFailedError();
536 }
537 
writeSampleValue(double value)538 void TestLog::writeSampleValue (double value)
539 {
540 	if (m_logSupressed) return;
541 	if (qpTestLog_writeValueFloat(m_log, value) == DE_FALSE)
542 		throw LogWriteFailedError();
543 }
544 
writeSampleValue(deInt64 value)545 void TestLog::writeSampleValue (deInt64 value)
546 {
547 	if (m_logSupressed) return;
548 	if (qpTestLog_writeValueInteger(m_log, value) == DE_FALSE)
549 		throw LogWriteFailedError();
550 }
551 
endSample(void)552 void TestLog::endSample (void)
553 {
554 	if (m_logSupressed) return;
555 	if (qpTestLog_endSample(m_log) == DE_FALSE)
556 		throw LogWriteFailedError();
557 }
558 
endSampleList(void)559 void TestLog::endSampleList (void)
560 {
561 	if (m_logSupressed) return;
562 	if (qpTestLog_endSampleList(m_log) == DE_FALSE)
563 		throw LogWriteFailedError();
564 }
565 
writeRaw(const char * rawContents)566 void TestLog::writeRaw(const char* rawContents)
567 {
568 	if (m_logSupressed) return;
569 	qpTestLog_writeRaw(m_log, rawContents);
570 }
571 
isShaderLoggingEnabled(void)572 bool TestLog::isShaderLoggingEnabled (void)
573 {
574 	return (qpTestLog_getLogFlags(m_log) & QP_TEST_LOG_EXCLUDE_SHADER_SOURCES) == 0;
575 }
576 
supressLogging(bool value)577 void TestLog::supressLogging (bool value)
578 {
579 	m_logSupressed = value;
580 }
581 
isSupressLogging(void)582 bool TestLog::isSupressLogging (void)
583 {
584 	return m_logSupressed;
585 }
586 
587 const TestLog::BeginMessageToken		TestLog::Message			= TestLog::BeginMessageToken();
588 const TestLog::EndMessageToken			TestLog::EndMessage			= TestLog::EndMessageToken();
589 const TestLog::EndImageSetToken			TestLog::EndImageSet		= TestLog::EndImageSetToken();
590 const TestLog::EndSectionToken			TestLog::EndSection			= TestLog::EndSectionToken();
591 const TestLog::EndShaderProgramToken	TestLog::EndShaderProgram	= TestLog::EndShaderProgramToken();
592 const TestLog::SampleInfoToken			TestLog::SampleInfo			= TestLog::SampleInfoToken();
593 const TestLog::EndSampleInfoToken		TestLog::EndSampleInfo		= TestLog::EndSampleInfoToken();
594 const TestLog::BeginSampleToken			TestLog::Sample				= TestLog::BeginSampleToken();
595 const TestLog::EndSampleToken			TestLog::EndSample			= TestLog::EndSampleToken();
596 const TestLog::EndSampleListToken		TestLog::EndSampleList		= TestLog::EndSampleListToken();
597 
598 } // tcu
599