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