1*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
2*35238bceSAndroid Build Coastguard Worker * drawElements Quality Program OpenGL (ES) Module
3*35238bceSAndroid Build Coastguard Worker * -----------------------------------------------
4*35238bceSAndroid Build Coastguard Worker *
5*35238bceSAndroid Build Coastguard Worker * Copyright 2014 The Android Open Source Project
6*35238bceSAndroid Build Coastguard Worker *
7*35238bceSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
8*35238bceSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
9*35238bceSAndroid Build Coastguard Worker * You may obtain a copy of the License at
10*35238bceSAndroid Build Coastguard Worker *
11*35238bceSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0
12*35238bceSAndroid Build Coastguard Worker *
13*35238bceSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
14*35238bceSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
15*35238bceSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16*35238bceSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
17*35238bceSAndroid Build Coastguard Worker * limitations under the License.
18*35238bceSAndroid Build Coastguard Worker *
19*35238bceSAndroid Build Coastguard Worker *//*!
20*35238bceSAndroid Build Coastguard Worker * \file
21*35238bceSAndroid Build Coastguard Worker * \brief Compiler test case.
22*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker
24*35238bceSAndroid Build Coastguard Worker #include "glsShaderLibrary.hpp"
25*35238bceSAndroid Build Coastguard Worker #include "glsShaderLibraryCase.hpp"
26*35238bceSAndroid Build Coastguard Worker
27*35238bceSAndroid Build Coastguard Worker namespace deqp
28*35238bceSAndroid Build Coastguard Worker {
29*35238bceSAndroid Build Coastguard Worker namespace gls
30*35238bceSAndroid Build Coastguard Worker {
31*35238bceSAndroid Build Coastguard Worker
32*35238bceSAndroid Build Coastguard Worker namespace
33*35238bceSAndroid Build Coastguard Worker {
34*35238bceSAndroid Build Coastguard Worker
35*35238bceSAndroid Build Coastguard Worker class CaseFactory : public glu::sl::ShaderCaseFactory
36*35238bceSAndroid Build Coastguard Worker {
37*35238bceSAndroid Build Coastguard Worker public:
CaseFactory(tcu::TestContext & testCtx,glu::RenderContext & renderCtx,const glu::ContextInfo & contextInfo)38*35238bceSAndroid Build Coastguard Worker CaseFactory(tcu::TestContext &testCtx, glu::RenderContext &renderCtx, const glu::ContextInfo &contextInfo)
39*35238bceSAndroid Build Coastguard Worker : m_testCtx(testCtx)
40*35238bceSAndroid Build Coastguard Worker , m_renderCtx(renderCtx)
41*35238bceSAndroid Build Coastguard Worker , m_contextInfo(contextInfo)
42*35238bceSAndroid Build Coastguard Worker {
43*35238bceSAndroid Build Coastguard Worker }
44*35238bceSAndroid Build Coastguard Worker
createGroup(const std::string & name,const std::string & description,const std::vector<tcu::TestNode * > & children)45*35238bceSAndroid Build Coastguard Worker tcu::TestCaseGroup *createGroup(const std::string &name, const std::string &description,
46*35238bceSAndroid Build Coastguard Worker const std::vector<tcu::TestNode *> &children)
47*35238bceSAndroid Build Coastguard Worker {
48*35238bceSAndroid Build Coastguard Worker return new tcu::TestCaseGroup(m_testCtx, name.c_str(), description.c_str(), children);
49*35238bceSAndroid Build Coastguard Worker }
50*35238bceSAndroid Build Coastguard Worker
createCase(const std::string & name,const std::string & description,const glu::sl::ShaderCaseSpecification & spec)51*35238bceSAndroid Build Coastguard Worker tcu::TestCase *createCase(const std::string &name, const std::string &description,
52*35238bceSAndroid Build Coastguard Worker const glu::sl::ShaderCaseSpecification &spec)
53*35238bceSAndroid Build Coastguard Worker {
54*35238bceSAndroid Build Coastguard Worker return new ShaderLibraryCase(m_testCtx, m_renderCtx, m_contextInfo, name.c_str(), description.c_str(), spec);
55*35238bceSAndroid Build Coastguard Worker }
56*35238bceSAndroid Build Coastguard Worker
57*35238bceSAndroid Build Coastguard Worker private:
58*35238bceSAndroid Build Coastguard Worker tcu::TestContext &m_testCtx;
59*35238bceSAndroid Build Coastguard Worker glu::RenderContext &m_renderCtx;
60*35238bceSAndroid Build Coastguard Worker const glu::ContextInfo &m_contextInfo;
61*35238bceSAndroid Build Coastguard Worker };
62*35238bceSAndroid Build Coastguard Worker
63*35238bceSAndroid Build Coastguard Worker } // namespace
64*35238bceSAndroid Build Coastguard Worker
ShaderLibrary(tcu::TestContext & testCtx,glu::RenderContext & renderCtx,const glu::ContextInfo & contextInfo)65*35238bceSAndroid Build Coastguard Worker ShaderLibrary::ShaderLibrary(tcu::TestContext &testCtx, glu::RenderContext &renderCtx,
66*35238bceSAndroid Build Coastguard Worker const glu::ContextInfo &contextInfo)
67*35238bceSAndroid Build Coastguard Worker : m_testCtx(testCtx)
68*35238bceSAndroid Build Coastguard Worker , m_renderCtx(renderCtx)
69*35238bceSAndroid Build Coastguard Worker , m_contextInfo(contextInfo)
70*35238bceSAndroid Build Coastguard Worker {
71*35238bceSAndroid Build Coastguard Worker }
72*35238bceSAndroid Build Coastguard Worker
~ShaderLibrary(void)73*35238bceSAndroid Build Coastguard Worker ShaderLibrary::~ShaderLibrary(void)
74*35238bceSAndroid Build Coastguard Worker {
75*35238bceSAndroid Build Coastguard Worker }
76*35238bceSAndroid Build Coastguard Worker
loadShaderFile(const char * fileName)77*35238bceSAndroid Build Coastguard Worker std::vector<tcu::TestNode *> ShaderLibrary::loadShaderFile(const char *fileName)
78*35238bceSAndroid Build Coastguard Worker {
79*35238bceSAndroid Build Coastguard Worker CaseFactory caseFactory(m_testCtx, m_renderCtx, m_contextInfo);
80*35238bceSAndroid Build Coastguard Worker
81*35238bceSAndroid Build Coastguard Worker return glu::sl::parseFile(m_testCtx.getArchive(), fileName, &caseFactory);
82*35238bceSAndroid Build Coastguard Worker }
83*35238bceSAndroid Build Coastguard Worker
84*35238bceSAndroid Build Coastguard Worker } // namespace gls
85*35238bceSAndroid Build Coastguard Worker } // namespace deqp
86