1e5c31af7Sopenharmony_ci#ifndef _VKTDRAWTESTCASEUTIL_HPP 2e5c31af7Sopenharmony_ci#define _VKTDRAWTESTCASEUTIL_HPP 3e5c31af7Sopenharmony_ci/*------------------------------------------------------------------------ 4e5c31af7Sopenharmony_ci * Vulkan Conformance Tests 5e5c31af7Sopenharmony_ci * ------------------------ 6e5c31af7Sopenharmony_ci * 7e5c31af7Sopenharmony_ci * Copyright (c) 2015 The Khronos Group Inc. 8e5c31af7Sopenharmony_ci * Copyright (c) 2015 Intel Corporation 9e5c31af7Sopenharmony_ci * 10e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 11e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License. 12e5c31af7Sopenharmony_ci * You may obtain a copy of the License at 13e5c31af7Sopenharmony_ci * 14e5c31af7Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 15e5c31af7Sopenharmony_ci * 16e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 17e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 18e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and 20e5c31af7Sopenharmony_ci * limitations under the License. 21e5c31af7Sopenharmony_ci * 22e5c31af7Sopenharmony_ci *//*! 23e5c31af7Sopenharmony_ci * \file 24e5c31af7Sopenharmony_ci * \brief Draw Test Case Utils 25e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/ 26e5c31af7Sopenharmony_ci 27e5c31af7Sopenharmony_ci 28e5c31af7Sopenharmony_ci#include "tcuDefs.hpp" 29e5c31af7Sopenharmony_ci 30e5c31af7Sopenharmony_ci#include "vktTestCase.hpp" 31e5c31af7Sopenharmony_ci#include "vktTestCaseUtil.hpp" 32e5c31af7Sopenharmony_ci#include "vktDrawGroupParams.hpp" 33e5c31af7Sopenharmony_ci 34e5c31af7Sopenharmony_ci#include "gluShaderUtil.hpp" 35e5c31af7Sopenharmony_ci#include "vkPrograms.hpp" 36e5c31af7Sopenharmony_ci 37e5c31af7Sopenharmony_ci#include "deUniquePtr.hpp" 38e5c31af7Sopenharmony_ci 39e5c31af7Sopenharmony_ci#include <map> 40e5c31af7Sopenharmony_ci 41e5c31af7Sopenharmony_cinamespace vkt 42e5c31af7Sopenharmony_ci{ 43e5c31af7Sopenharmony_cinamespace Draw 44e5c31af7Sopenharmony_ci{ 45e5c31af7Sopenharmony_ci 46e5c31af7Sopenharmony_citypedef std::map<glu::ShaderType, const char*> ShaderMap; 47e5c31af7Sopenharmony_ci 48e5c31af7Sopenharmony_cistruct TestSpecBase 49e5c31af7Sopenharmony_ci{ 50e5c31af7Sopenharmony_ci ShaderMap shaders; 51e5c31af7Sopenharmony_ci vk::VkPrimitiveTopology topology; 52e5c31af7Sopenharmony_ci const SharedGroupParams groupParams; 53e5c31af7Sopenharmony_ci}; 54e5c31af7Sopenharmony_ci 55e5c31af7Sopenharmony_citemplate<typename Instance, typename Support = NoSupport0> 56e5c31af7Sopenharmony_ciclass InstanceFactory : public TestCase 57e5c31af7Sopenharmony_ci{ 58e5c31af7Sopenharmony_cipublic: 59e5c31af7Sopenharmony_ci InstanceFactory (tcu::TestContext& testCtx, const std::string& name, typename Instance::TestSpec testSpec) 60e5c31af7Sopenharmony_ci : TestCase (testCtx, name) 61e5c31af7Sopenharmony_ci , m_testSpec (testSpec) 62e5c31af7Sopenharmony_ci , m_support () 63e5c31af7Sopenharmony_ci { 64e5c31af7Sopenharmony_ci } 65e5c31af7Sopenharmony_ci 66e5c31af7Sopenharmony_ci InstanceFactory (tcu::TestContext& testCtx, const std::string& name, typename Instance::TestSpec testSpec, const Support& support) 67e5c31af7Sopenharmony_ci : TestCase (testCtx, name) 68e5c31af7Sopenharmony_ci , m_testSpec (testSpec) 69e5c31af7Sopenharmony_ci , m_support (support) 70e5c31af7Sopenharmony_ci { 71e5c31af7Sopenharmony_ci } 72e5c31af7Sopenharmony_ci 73e5c31af7Sopenharmony_ci TestInstance* createInstance (Context& context) const 74e5c31af7Sopenharmony_ci { 75e5c31af7Sopenharmony_ci return new Instance(context, m_testSpec); 76e5c31af7Sopenharmony_ci } 77e5c31af7Sopenharmony_ci 78e5c31af7Sopenharmony_ci virtual void initPrograms (vk::SourceCollections& programCollection) const 79e5c31af7Sopenharmony_ci { 80e5c31af7Sopenharmony_ci for (ShaderMap::const_iterator i = m_testSpec.shaders.begin(); i != m_testSpec.shaders.end(); ++i) 81e5c31af7Sopenharmony_ci { 82e5c31af7Sopenharmony_ci programCollection.glslSources.add(i->second) << 83e5c31af7Sopenharmony_ci glu::ShaderSource(i->first, ShaderSourceProvider::getSource(m_testCtx.getArchive(), i->second)); 84e5c31af7Sopenharmony_ci } 85e5c31af7Sopenharmony_ci } 86e5c31af7Sopenharmony_ci 87e5c31af7Sopenharmony_ci virtual void checkSupport (Context& context) const 88e5c31af7Sopenharmony_ci { 89e5c31af7Sopenharmony_ci m_support.checkSupport(context); 90e5c31af7Sopenharmony_ci } 91e5c31af7Sopenharmony_ci 92e5c31af7Sopenharmony_ciprivate: 93e5c31af7Sopenharmony_ci const typename Instance::TestSpec m_testSpec; 94e5c31af7Sopenharmony_ci const Support m_support; 95e5c31af7Sopenharmony_ci}; 96e5c31af7Sopenharmony_ci 97e5c31af7Sopenharmony_ci} // Draw 98e5c31af7Sopenharmony_ci} // vkt 99e5c31af7Sopenharmony_ci 100e5c31af7Sopenharmony_ci#endif // _VKTDRAWTESTCASEUTIL_HPP 101