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 EGL config dst->
22 *//*--------------------------------------------------------------------*/
23
24#include "egluConfigInfo.hpp"
25#include "egluDefs.hpp"
26
27namespace eglu
28{
29
30deInt32 ConfigInfo::getAttribute (deUint32 attribute) const
31{
32	switch (attribute)
33	{
34		case EGL_BUFFER_SIZE:				return bufferSize;
35		case EGL_RED_SIZE:					return redSize;
36		case EGL_GREEN_SIZE:				return greenSize;
37		case EGL_BLUE_SIZE:					return blueSize;
38		case EGL_LUMINANCE_SIZE:			return luminanceSize;
39		case EGL_ALPHA_SIZE:				return alphaSize;
40		case EGL_ALPHA_MASK_SIZE:			return alphaMaskSize;
41		case EGL_BIND_TO_TEXTURE_RGB:		return bindToTextureRGB;
42		case EGL_BIND_TO_TEXTURE_RGBA:		return bindToTextureRGBA;
43		case EGL_COLOR_BUFFER_TYPE:			return colorBufferType;
44		case EGL_CONFIG_CAVEAT:				return configCaveat;
45		case EGL_CONFIG_ID:					return configId;
46		case EGL_CONFORMANT:				return conformant;
47		case EGL_DEPTH_SIZE:				return depthSize;
48		case EGL_LEVEL:						return level;
49		case EGL_MAX_PBUFFER_WIDTH:			return maxPbufferWidth;
50		case EGL_MAX_PBUFFER_HEIGHT:		return maxPbufferHeight;
51		case EGL_MAX_SWAP_INTERVAL:			return maxSwapInterval;
52		case EGL_MIN_SWAP_INTERVAL:			return minSwapInterval;
53		case EGL_NATIVE_RENDERABLE:			return nativeRenderable;
54		case EGL_NATIVE_VISUAL_ID:			return nativeVisualId;
55		case EGL_NATIVE_VISUAL_TYPE:		return nativeVisualType;
56		case EGL_RENDERABLE_TYPE:			return renderableType;
57		case EGL_SAMPLE_BUFFERS:			return sampleBuffers;
58		case EGL_SAMPLES:					return samples;
59		case EGL_STENCIL_SIZE:				return stencilSize;
60		case EGL_SURFACE_TYPE:				return surfaceType;
61		case EGL_TRANSPARENT_TYPE:			return transparentType;
62		case EGL_TRANSPARENT_RED_VALUE:		return transparentRedValue;
63		case EGL_TRANSPARENT_GREEN_VALUE:	return transparentGreenValue;
64		case EGL_TRANSPARENT_BLUE_VALUE:	return transparentBlueValue;
65		default:							TCU_FAIL("Unknown attribute");
66	}
67}
68
69void queryConfigInfo (EGLDisplay display, EGLConfig config, ConfigInfo* dst)
70{
71	eglGetConfigAttrib(display, config, EGL_BUFFER_SIZE,				&dst->bufferSize);
72	eglGetConfigAttrib(display, config, EGL_RED_SIZE,					&dst->redSize);
73	eglGetConfigAttrib(display, config, EGL_GREEN_SIZE,					&dst->greenSize);
74	eglGetConfigAttrib(display, config, EGL_BLUE_SIZE,					&dst->blueSize);
75	eglGetConfigAttrib(display, config, EGL_LUMINANCE_SIZE,				&dst->luminanceSize);
76	eglGetConfigAttrib(display, config, EGL_ALPHA_SIZE,					&dst->alphaSize);
77	eglGetConfigAttrib(display, config, EGL_ALPHA_MASK_SIZE,			&dst->alphaMaskSize);
78	eglGetConfigAttrib(display, config, EGL_BIND_TO_TEXTURE_RGB,		(EGLint*)&dst->bindToTextureRGB);
79	eglGetConfigAttrib(display, config, EGL_BIND_TO_TEXTURE_RGBA,		(EGLint*)&dst->bindToTextureRGBA);
80	eglGetConfigAttrib(display, config, EGL_COLOR_BUFFER_TYPE,			(EGLint*)&dst->colorBufferType);
81	eglGetConfigAttrib(display, config, EGL_CONFIG_CAVEAT,				(EGLint*)&dst->configCaveat);
82	eglGetConfigAttrib(display, config, EGL_CONFIG_ID,					&dst->configId);
83	eglGetConfigAttrib(display, config, EGL_CONFORMANT,					&dst->conformant);
84	eglGetConfigAttrib(display, config, EGL_DEPTH_SIZE,					&dst->depthSize);
85	eglGetConfigAttrib(display, config, EGL_LEVEL,						&dst->level);
86	eglGetConfigAttrib(display, config, EGL_MAX_PBUFFER_WIDTH,			&dst->maxPbufferWidth);
87	eglGetConfigAttrib(display, config, EGL_MAX_PBUFFER_HEIGHT,			&dst->maxPbufferHeight);
88	eglGetConfigAttrib(display, config, EGL_MAX_SWAP_INTERVAL,			&dst->maxSwapInterval);
89	eglGetConfigAttrib(display, config, EGL_MIN_SWAP_INTERVAL,			&dst->minSwapInterval);
90	eglGetConfigAttrib(display, config, EGL_NATIVE_RENDERABLE,			(EGLint*)&dst->nativeRenderable);
91	eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID,			&dst->nativeVisualId);
92	eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_TYPE,			&dst->nativeVisualType);
93	eglGetConfigAttrib(display, config, EGL_RENDERABLE_TYPE,			&dst->renderableType);
94	eglGetConfigAttrib(display, config, EGL_SAMPLE_BUFFERS,				&dst->sampleBuffers);
95	eglGetConfigAttrib(display, config, EGL_SAMPLES,					&dst->samples);
96	eglGetConfigAttrib(display, config, EGL_STENCIL_SIZE,				&dst->stencilSize);
97	eglGetConfigAttrib(display, config, EGL_SURFACE_TYPE,				&dst->surfaceType);
98	eglGetConfigAttrib(display, config, EGL_TRANSPARENT_TYPE,			(EGLint*)&dst->transparentType);
99	eglGetConfigAttrib(display, config, EGL_TRANSPARENT_RED_VALUE,		&dst->transparentRedValue);
100	eglGetConfigAttrib(display, config, EGL_TRANSPARENT_GREEN_VALUE,	&dst->transparentGreenValue);
101	eglGetConfigAttrib(display, config, EGL_TRANSPARENT_BLUE_VALUE,		&dst->transparentBlueValue);
102	EGLU_CHECK_MSG("Failed to query config info");
103}
104
105} // eglu
106