1/*------------------------------------------------------------------------- 2 * drawElements Quality Program OpenGL ES 3.1 Module 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 Platform Information and Capability Tests. 22 *//*--------------------------------------------------------------------*/ 23 24#include "tes31InfoTests.hpp" 25#include "tcuTestLog.hpp" 26#include "gluDefs.hpp" 27#include "gluContextInfo.hpp" 28#include "gluRenderContext.hpp" 29#include "tcuRenderTarget.hpp" 30 31#include "glwFunctions.hpp" 32#include "glwEnums.hpp" 33 34#include <string> 35#include <vector> 36 37using std::string; 38using std::vector; 39 40namespace deqp 41{ 42namespace gles31 43{ 44 45class QueryStringCase : public TestCase 46{ 47public: 48 QueryStringCase (Context& context, const char* name, const char* description, deUint32 query) 49 : TestCase (context, name, description) 50 , m_query (query) 51 { 52 } 53 54 IterateResult iterate (void) 55 { 56 const glw::Functions& gl = m_context.getRenderContext().getFunctions(); 57 const char* result = (const char*)gl.getString(m_query); 58 59 GLU_EXPECT_NO_ERROR(gl.getError(), "glGetString() failed"); 60 61 m_testCtx.getLog() << tcu::TestLog::Message << result << tcu::TestLog::EndMessage; 62 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); 63 64 return STOP; 65 } 66 67private: 68 deUint32 m_query; 69}; 70 71class QueryExtensionsCase : public TestCase 72{ 73public: 74 QueryExtensionsCase (Context& context) 75 : TestCase (context, "extensions", "Supported Extensions") 76 { 77 } 78 79 IterateResult iterate (void) 80 { 81 const vector<string> extensions = m_context.getContextInfo().getExtensions(); 82 83 for (vector<string>::const_iterator i = extensions.begin(); i != extensions.end(); i++) 84 m_testCtx.getLog() << tcu::TestLog::Message << *i << tcu::TestLog::EndMessage; 85 86 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); 87 88 return STOP; 89 } 90}; 91 92class RenderTargetInfoCase : public TestCase 93{ 94public: 95 RenderTargetInfoCase (Context& context) 96 : TestCase (context, "render_target", "Render Target Info") 97 { 98 } 99 100 IterateResult iterate (void) 101 { 102 const tcu::RenderTarget& rt = m_context.getRenderTarget(); 103 const tcu::PixelFormat& pf = rt.getPixelFormat(); 104 105 m_testCtx.getLog() 106 << tcu::TestLog::Integer("RedBits", "Red channel bits", "", QP_KEY_TAG_NONE, pf.redBits) 107 << tcu::TestLog::Integer("GreenBits", "Green channel bits", "", QP_KEY_TAG_NONE, pf.greenBits) 108 << tcu::TestLog::Integer("BlueBits", "Blue channel bits", "", QP_KEY_TAG_NONE, pf.blueBits) 109 << tcu::TestLog::Integer("AlphaBits", "Alpha channel bits", "", QP_KEY_TAG_NONE, pf.alphaBits) 110 << tcu::TestLog::Integer("DepthBits", "Depth bits", "", QP_KEY_TAG_NONE, rt.getDepthBits()) 111 << tcu::TestLog::Integer("StencilBits", "Stencil bits", "", QP_KEY_TAG_NONE, rt.getStencilBits()) 112 << tcu::TestLog::Integer("NumSamples", "Number of samples", "", QP_KEY_TAG_NONE, rt.getNumSamples()) 113 << tcu::TestLog::Integer("Width", "Width", "", QP_KEY_TAG_NONE, rt.getWidth()) 114 << tcu::TestLog::Integer("Height", "Height", "", QP_KEY_TAG_NONE, rt.getHeight()); 115 116 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); 117 return STOP; 118 } 119}; 120 121InfoTests::InfoTests (Context& context) 122 : TestCaseGroup(context, "info", "Platform information queries") 123{ 124} 125 126InfoTests::~InfoTests (void) 127{ 128} 129 130void InfoTests::init (void) 131{ 132 addChild(new QueryStringCase(m_context, "vendor", "Vendor String", GL_VENDOR)); 133 addChild(new QueryStringCase(m_context, "renderer", "Renderer String", GL_RENDERER)); 134 addChild(new QueryStringCase(m_context, "version", "Version String", GL_VERSION)); 135 addChild(new QueryStringCase(m_context, "shading_language_version", "Shading Language Version String", GL_SHADING_LANGUAGE_VERSION)); 136 addChild(new QueryExtensionsCase(m_context)); 137 addChild(new RenderTargetInfoCase(m_context)); 138} 139 140} // gles31 141} // deqp 142