1#ifndef _QPTESTLOG_H
2#define _QPTESTLOG_H
3/*-------------------------------------------------------------------------
4 * drawElements Quality Program Helper Library
5 * -------------------------------------------
6 *
7 * Copyright 2014 The Android Open Source Project
8 *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 *
13 *      http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 *
21 *//*!
22 * \defgroup TestLog
23 * \ingroup TestLog
24 * \{
25 * \file
26 * \brief Test log library
27 *
28 * qpTestLog Conventions:
29 *
30 * Each function takes qpTestLog pointer. Operations are done on that log
31 * instance.
32 *
33 * When function takes a 'name' parameter, that name is exepected to
34 * be a unique identifier within the scope of one test case. Test case
35 * begins with a call to qpTestLog_startCase and ends with a call to
36 * qpTestLog_endCase or qpTestLog_terminateCase. The human readable
37 * "name" for a piece of information is given with the parameter
38 * called 'description'.
39 *
40 * All functions writing to the log return a boolean value. False
41 * means that the current write operation failed and the current log
42 * instance should be abandoned.
43 *
44 *//*--------------------------------------------------------------------*/
45
46#include "deDefs.h"
47
48typedef struct qpTestLog_s	qpTestLog;
49
50/* Test results supported by current report version */
51/* \note Keep in sync with TestCaseStatus in Candy project. */
52typedef enum qpTestResult_e
53{
54	QP_TEST_RESULT_PASS = 0,				/*!< Test case passed.																	*/
55	QP_TEST_RESULT_FAIL,					/*!< Implementation produced incorrect results											*/
56	QP_TEST_RESULT_QUALITY_WARNING,			/*!< Result is within specification, but is not of high quality 						*/
57	QP_TEST_RESULT_COMPATIBILITY_WARNING,	/*!< Result is within specification, but likely to cause fragmentation in the market 	*/
58	QP_TEST_RESULT_PENDING,					/*!< The test is still running. Not a valid end result									*/
59	QP_TEST_RESULT_NOT_SUPPORTED,			/*!< Implementation does not support functionality needed by this test case 			*/
60	QP_TEST_RESULT_RESOURCE_ERROR,			/*!< Implementation fails to pass the test due to lack of resources						*/
61	QP_TEST_RESULT_INTERNAL_ERROR,			/*!< Error occurred within Tester Core													*/
62	QP_TEST_RESULT_CRASH,					/*!< Crash occurred in test execution.													*/
63	QP_TEST_RESULT_TIMEOUT,					/*!< Timeout occurred in test execution.												*/
64
65	QP_TEST_RESULT_LAST
66} qpTestResult;
67
68/* Test case types. */
69typedef enum qpTestCaseType_e
70{
71	QP_TEST_CASE_TYPE_SELF_VALIDATE = 0,	/*!< Self-validating test case			*/
72	QP_TEST_CASE_TYPE_PERFORMANCE,			/*!< Performace test case				*/
73	QP_TEST_CASE_TYPE_CAPABILITY,			/*!< Capability score case				*/
74	QP_TEST_CASE_TYPE_ACCURACY,				/*!< Accuracy test case					*/
75
76	QP_TEST_CASE_TYPE_LAST
77} qpTestCaseType;
78
79/*--------------------------------------------------------------------*//*!
80 * \brief Tag key-value pairs to give cues on proper visualization in GUI
81 *//*--------------------------------------------------------------------*/
82typedef enum qpKeyValueTag_e
83{
84	QP_KEY_TAG_NONE = 0,
85	QP_KEY_TAG_PERFORMANCE,
86	QP_KEY_TAG_QUALITY,
87	QP_KEY_TAG_PRECISION,
88	QP_KEY_TAG_TIME,
89
90	/* Add new values here if needed, remember to update relevant code in qpTestLog.c and change format revision */
91
92	QP_KEY_TAG_LAST	/* Do not remove */
93} qpKeyValueTag;
94
95/*--------------------------------------------------------------------*//*!
96 * \brief Sample value tag for giving hints for analysis
97 *//*--------------------------------------------------------------------*/
98typedef enum qpSampleValueTag_e
99{
100	QP_SAMPLE_VALUE_TAG_PREDICTOR = 0,		/*!< Predictor for sample, such as number of operations.	*/
101	QP_SAMPLE_VALUE_TAG_RESPONSE,			/*!< Response, i.e. measured value, such as render time.	*/
102
103	/* Add new values here if needed, remember to update relevant code in qpTestLog.c and change format revision */
104
105	QP_SAMPLE_VALUE_TAG_LAST	/* Do not remove */
106} qpSampleValueTag;
107
108/* Image compression type. */
109typedef enum qpImageCompressionMode_e
110{
111	QP_IMAGE_COMPRESSION_MODE_NONE	= 0,	/*!< Do not compress images.					*/
112	QP_IMAGE_COMPRESSION_MODE_PNG,			/*!< Compress images using lossless libpng.		*/
113	QP_IMAGE_COMPRESSION_MODE_BEST,			/*!< Choose the best image compression mode.	*/
114
115	QP_IMAGE_COMPRESSION_MODE_LAST
116} qpImageCompressionMode;
117
118/*--------------------------------------------------------------------*//*!
119 * \brief Image formats.
120 *
121 * Pixels are handled as a byte stream, i.e., endianess does not
122 * affect component ordering.
123 *//*--------------------------------------------------------------------*/
124typedef enum qpImageFormat_e
125{
126	QP_IMAGE_FORMAT_RGB888 = 0,
127	QP_IMAGE_FORMAT_RGBA8888,
128
129	QP_IMAGE_FORMAT_LAST
130} qpImageFormat;
131
132/* Test log flags. */
133typedef enum qpTestLogFlag_e
134{
135	QP_TEST_LOG_EXCLUDE_IMAGES	= (1<<0)		/*!< Do not log images. This reduces log size considerably.		*/
136} qpTestLogFlag;
137
138/* Shader type. */
139typedef enum qpShaderType_e
140{
141	QP_SHADER_TYPE_VERTEX = 0,
142	QP_SHADER_TYPE_FRAGMENT,
143	QP_SHADER_TYPE_GEOMETRY,
144	QP_SHADER_TYPE_TESS_CONTROL,
145	QP_SHADER_TYPE_TESS_EVALUATION,
146	QP_SHADER_TYPE_COMPUTE,
147
148	QP_SHADER_TYPE_LAST
149} qpShaderType;
150
151DE_BEGIN_EXTERN_C
152
153/* \todo [2013-04-13 pyry] Clean up & document. Do we actually want this? */
154typedef struct qpEglConfigInfo_s
155{
156	int							bufferSize;
157	int							redSize;
158	int							greenSize;
159	int							blueSize;
160	int							luminanceSize;
161	int							alphaSize;
162	int							alphaMaskSize;
163	deBool						bindToTextureRGB;
164	deBool						bindToTextureRGBA;
165	const char*					colorBufferType;
166	const char*					configCaveat;
167	int							configID;
168	const char*					conformant;
169	int							depthSize;
170	int							level;
171	int							maxPBufferWidth;
172	int							maxPBufferHeight;
173	int							maxPBufferPixels;
174	int							maxSwapInterval;
175	int							minSwapInterval;
176	deBool						nativeRenderable;
177	const char*					renderableType;
178	int							sampleBuffers;
179	int							samples;
180	int							stencilSize;
181	const char*					surfaceTypes;
182	const char*					transparentType;
183	int							transparentRedValue;
184	int							transparentGreenValue;
185	int							transparentBlueValue;
186} qpEglConfigInfo;
187
188
189qpTestLog*		qpTestLog_createFileLog			(const char* fileName, deUint32 flags);
190void			qpTestLog_destroy				(qpTestLog* log);
191
192deBool			qpTestLog_startCase				(qpTestLog* log, const char* testCasePath, qpTestCaseType testCaseType);
193deBool			qpTestLog_endCase				(qpTestLog* log, qpTestResult result, const char* description);
194deBool			qpTestLog_terminateCase			(qpTestLog* log, qpTestResult result);
195
196deBool 			qpTestLog_writeMessage			(qpTestLog* log, const char* format, ...) DE_PRINTF_FUNC_ATTR(2,3);
197deBool 			qpTestLog_startSection			(qpTestLog* log, const char* name, const char* description);
198deBool 			qpTestLog_endSection			(qpTestLog* log);
199deBool 			qpTestLog_writeText				(qpTestLog* log, const char* name, const char* description, qpKeyValueTag tag, const char* value);
200deBool 			qpTestLog_writeInteger			(qpTestLog* log, const char* name, const char* description, const char* unit, qpKeyValueTag tag, deInt64 value);
201deBool 			qpTestLog_writeFloat			(qpTestLog* log, const char* name, const char* description, const char* unit, qpKeyValueTag tag, float value);
202
203deBool 			qpTestLog_startImageSet			(qpTestLog* log, const char* name, const char* description);
204deBool 			qpTestLog_endImageSet			(qpTestLog* log);
205deBool 			qpTestLog_writeImage			(qpTestLog* log, const char* name, const char* description, qpImageCompressionMode compressionMode, qpImageFormat format, int width, int height, int stride, const void* data);
206
207deBool 			qpTestLog_startEglConfigSet		(qpTestLog* log, const char* key, const char* description);
208deBool 			qpTestLog_writeEglConfig		(qpTestLog* log, const qpEglConfigInfo* config);
209deBool 			qpTestLog_endEglConfigSet		(qpTestLog* log);
210
211/* \todo [2013-08-26 pyry] Unify ShaderProgram & KernelSource & CompileInfo. */
212
213deBool			qpTestLog_startShaderProgram	(qpTestLog* log, deBool linkOk, const char* linkInfoLog);
214deBool			qpTestLog_endShaderProgram		(qpTestLog* log);
215deBool 			qpTestLog_writeShader			(qpTestLog* log, qpShaderType type, const char* source, deBool compileOk, const char* infoLog);
216
217deBool 			qpTestLog_writeKernelSource		(qpTestLog* log, const char* source);
218deBool 			qpTestLog_writeCompileInfo		(qpTestLog* log, const char* name, const char* description, deBool compileOk, const char* infoLog);
219
220deBool			qpTestLog_startSampleList		(qpTestLog* log, const char* name, const char* description);
221deBool			qpTestLog_startSampleInfo		(qpTestLog* log);
222deBool			qpTestLog_writeValueInfo		(qpTestLog* log, const char* name, const char* description, const char* unit, qpSampleValueTag tag);
223deBool			qpTestLog_endSampleInfo			(qpTestLog* log);
224deBool			qpTestLog_startSample			(qpTestLog* log);
225deBool			qpTestLog_writeValueFloat		(qpTestLog* log, double value);
226deBool			qpTestLog_writeValueInteger		(qpTestLog* log, deInt64 value);
227deBool			qpTestLog_endSample				(qpTestLog* log);
228deBool			qpTestLog_endSampleList			(qpTestLog* log);
229
230deUint32		qpTestLog_getLogFlags			(const qpTestLog* log);
231
232const char*		qpGetTestResultName				(qpTestResult result);
233
234DE_END_EXTERN_C
235
236/*! \} */
237
238#endif /* _QPTESTLOG_H */
239