13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*-------------------------------------------------------------------------
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program Tester Core
33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ----------------------------------------
43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project
63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License");
83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License.
93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at
103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *      http://www.apache.org/licenses/LICENSE-2.0
123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software
143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS,
153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and
173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License.
183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*!
203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file
213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief EGL config dst->
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluConfigInfo.hpp"
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluDefs.hpp"
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace eglu
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
303c827367444ee418f129b2c238299f49d3264554Jarkko PoyrydeInt32 ConfigInfo::getAttribute (deUint32 attribute) const
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	switch (attribute)
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_BUFFER_SIZE:				return bufferSize;
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_RED_SIZE:					return redSize;
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_GREEN_SIZE:				return greenSize;
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_BLUE_SIZE:					return blueSize;
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_LUMINANCE_SIZE:			return luminanceSize;
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_ALPHA_SIZE:				return alphaSize;
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_ALPHA_MASK_SIZE:			return alphaMaskSize;
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_BIND_TO_TEXTURE_RGB:		return bindToTextureRGB;
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_BIND_TO_TEXTURE_RGBA:		return bindToTextureRGBA;
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_COLOR_BUFFER_TYPE:			return colorBufferType;
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_CONFIG_CAVEAT:				return configCaveat;
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_CONFIG_ID:					return configId;
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_CONFORMANT:				return conformant;
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_DEPTH_SIZE:				return depthSize;
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_LEVEL:						return level;
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_MAX_PBUFFER_WIDTH:			return maxPbufferWidth;
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_MAX_PBUFFER_HEIGHT:		return maxPbufferHeight;
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_MAX_SWAP_INTERVAL:			return maxSwapInterval;
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_MIN_SWAP_INTERVAL:			return minSwapInterval;
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_NATIVE_RENDERABLE:			return nativeRenderable;
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_NATIVE_VISUAL_ID:			return nativeVisualId;
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_NATIVE_VISUAL_TYPE:		return nativeVisualType;
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_RENDERABLE_TYPE:			return renderableType;
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_SAMPLE_BUFFERS:			return sampleBuffers;
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_SAMPLES:					return samples;
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_STENCIL_SIZE:				return stencilSize;
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_SURFACE_TYPE:				return surfaceType;
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_TRANSPARENT_TYPE:			return transparentType;
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_TRANSPARENT_RED_VALUE:		return transparentRedValue;
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_TRANSPARENT_GREEN_VALUE:	return transparentGreenValue;
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case EGL_TRANSPARENT_BLUE_VALUE:	return transparentBlueValue;
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		default:							TCU_FAIL("Unknown attribute");
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid queryConfigInfo (EGLDisplay display, EGLConfig config, ConfigInfo* dst)
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_BUFFER_SIZE,				&dst->bufferSize);
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_RED_SIZE,					&dst->redSize);
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_GREEN_SIZE,					&dst->greenSize);
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_BLUE_SIZE,					&dst->blueSize);
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_LUMINANCE_SIZE,				&dst->luminanceSize);
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_ALPHA_SIZE,					&dst->alphaSize);
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_ALPHA_MASK_SIZE,			&dst->alphaMaskSize);
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_BIND_TO_TEXTURE_RGB,		(EGLint*)&dst->bindToTextureRGB);
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_BIND_TO_TEXTURE_RGBA,		(EGLint*)&dst->bindToTextureRGBA);
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_COLOR_BUFFER_TYPE,			(EGLint*)&dst->colorBufferType);
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_CONFIG_CAVEAT,				(EGLint*)&dst->configCaveat);
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_CONFIG_ID,					&dst->configId);
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_CONFORMANT,					&dst->conformant);
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_DEPTH_SIZE,					&dst->depthSize);
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_LEVEL,						&dst->level);
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_MAX_PBUFFER_WIDTH,			&dst->maxPbufferWidth);
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_MAX_PBUFFER_HEIGHT,			&dst->maxPbufferHeight);
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_MAX_SWAP_INTERVAL,			&dst->maxSwapInterval);
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_MIN_SWAP_INTERVAL,			&dst->minSwapInterval);
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_NATIVE_RENDERABLE,			(EGLint*)&dst->nativeRenderable);
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID,			&dst->nativeVisualId);
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_TYPE,			&dst->nativeVisualType);
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_RENDERABLE_TYPE,			&dst->renderableType);
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_SAMPLE_BUFFERS,				&dst->sampleBuffers);
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_SAMPLES,					&dst->samples);
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_STENCIL_SIZE,				&dst->stencilSize);
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_SURFACE_TYPE,				&dst->surfaceType);
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_TRANSPARENT_TYPE,			(EGLint*)&dst->transparentType);
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_TRANSPARENT_RED_VALUE,		&dst->transparentRedValue);
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_TRANSPARENT_GREEN_VALUE,	&dst->transparentGreenValue);
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglGetConfigAttrib(display, config, EGL_TRANSPARENT_BLUE_VALUE,		&dst->transparentBlueValue);
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	EGLU_CHECK_MSG("Failed to query config info");
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // eglu
106