include(gles3/gles3.cmake OPTIONAL)
include(gles31/gles31.cmake OPTIONAL)
include(egl/egl.cmake OPTIONAL)
+include(vulkan/vulkan.cmake OPTIONAL)
# Misc
include(internal/internal.cmake OPTIONAL)
--- /dev/null
+# dEQP-VK
+
+add_subdirectory(api)
+
+include_directories(
+ api
+ )
+
+set(DEQP_VK_COMMON_SRCS
+ vktTestCase.cpp
+ vktTestCase.hpp
+ vktTestCaseUtil.cpp
+ vktTestCaseUtil.hpp
+ vktTestPackage.cpp
+ vktTestPackage.hpp
+ vktInfo.cpp
+ vktInfo.hpp
+ )
+
+set(DEQP_VK_COMMON_LIBS
+ tcutil
+ vkutil
+ deqp-vk-api
+ )
+
+if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX OR DE_OS_IS_OSX)
+ add_library(deqp-vk-common STATIC ${DEQP_VK_COMMON_SRCS})
+ target_link_libraries(deqp-vk-common ${DEQP_VK_COMMON_LIBS})
+
+ add_executable(vk-build-programs vktBuildPrograms.cpp)
+ target_link_libraries(vk-build-programs deqp-vk-common)
+
+ set(DEQP_VK_SRCS )
+ set(DEQP_VK_LIBS deqp-vk-common)
+
+else ()
+ set(DEQP_VK_SRCS ${DEQP_VK_COMMON_SRCS})
+ set(DEQP_VK_LIBS ${DEQP_VK_COMMON_LIBS})
+
+endif ()
+
+add_deqp_module(deqp-vk "${DEQP_VK_SRCS}" "${DEQP_VK_LIBS}" vktTestPackageEntry.cpp)
--- /dev/null
+# API layer tests
+
+include_directories(..)
+
+set(DEQP_VK_API_SRCS
+ vktApiTests.cpp
+ vktApiTests.hpp
+ )
+
+set(DEQP_VK_API_LIBS
+ tcutil
+ vkutil
+ )
+
+add_library(deqp-vk-api STATIC ${DEQP_VK_API_SRCS})
+target_link_libraries(deqp-vk-api ${DEQP_VK_API_LIBS})
--- /dev/null
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Vulkan Module
+ * --------------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief API Tests
+ *//*--------------------------------------------------------------------*/
+
+#include "vktApiTests.hpp"
+
+#include "vktTestCaseUtil.hpp"
+
+#include "vkDefs.hpp"
+#include "vkPlatform.hpp"
+#include "vkStrUtil.hpp"
+#include "vkRef.hpp"
+
+#include "tcuTestLog.hpp"
+#include "tcuFormatUtil.hpp"
+
+#include "deUniquePtr.hpp"
+
+#include "qpInfo.h"
+
+namespace vkt
+{
+namespace api
+{
+
+// \todo [2015-05-11 pyry] Temporary for testing framework
+
+using namespace vk;
+using std::vector;
+using tcu::TestLog;
+
+tcu::TestStatus createSampler (Context& context)
+{
+ const struct VkApplicationInfo appInfo =
+ {
+ VK_STRUCTURE_TYPE_APPLICATION_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ "deqp", // const char* pAppName;
+ qpGetReleaseId(), // deUint32 appVersion;
+ "deqp", // const char* pEngineName;
+ qpGetReleaseId(), // deUint32 engineVersion;
+ VK_API_VERSION // deUint32 apiVersion;
+ };
+ const struct VkInstanceCreateInfo instanceInfo =
+ {
+ VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ &appInfo, // const VkApplicationInfo* pAppInfo;
+ DE_NULL, // const VkAllocCallbacks* pAllocCb;
+ 0u, // deUint32 extensionCount;
+ DE_NULL // const char*const* ppEnabledExtensionNames;
+ };
+
+ const PlatformInterface& vkPlatform = context.getPlatformInterface();
+ TestLog& log = context.getTestContext().getLog();
+ const Unique<VkInstanceT> instance (createInstance(vkPlatform, &instanceInfo));
+ vector<VkPhysicalDevice> devices;
+ deUint32 numDevices = 0;
+
+ VK_CHECK(vkPlatform.enumeratePhysicalDevices(*instance, &numDevices, DE_NULL));
+
+ if (numDevices > 0)
+ {
+ devices.resize(numDevices);
+ VK_CHECK(vkPlatform.enumeratePhysicalDevices(*instance, &numDevices, &devices[0]));
+
+ for (deUint32 deviceNdx = 0; deviceNdx < numDevices; deviceNdx++)
+ {
+ const struct VkDeviceQueueCreateInfo queueInfo =
+ {
+ 0u, // deUint32 queueNodeIndex;
+ 1u, // deUint32 queueCount;
+ };
+ const struct VkDeviceCreateInfo deviceInfo =
+ {
+ VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 1u, // deUint32 queueRecordCount;
+ &queueInfo, // const VkDeviceQueueCreateInfo* pRequestedQueues;
+ 0u, // deUint32 extensionCount;
+ DE_NULL, // const char*const* ppEnabledExtensionNames;
+ 0u, // VkDeviceCreateFlags flags;
+ };
+
+ const struct VkSamplerCreateInfo samplerInfo =
+ {
+ VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ VK_TEX_FILTER_NEAREST, // VkTexFilter magFilter;
+ VK_TEX_FILTER_NEAREST, // VkTexFilter minFilter;
+ VK_TEX_MIPMAP_MODE_BASE, // VkTexMipmapMode mipMode;
+ VK_TEX_ADDRESS_CLAMP, // VkTexAddress addressU;
+ VK_TEX_ADDRESS_CLAMP, // VkTexAddress addressV;
+ VK_TEX_ADDRESS_CLAMP, // VkTexAddress addressW;
+ 0.0f, // float mipLodBias;
+ 0u, // deUint32 maxAnisotropy;
+ VK_COMPARE_OP_ALWAYS, // VkCompareOp compareOp;
+ 0.0f, // float minLod;
+ 0.0f, // float maxLod;
+ VK_BORDER_COLOR_TRANSPARENT_BLACK, // VkBorderColor borderColor;
+ };
+
+ log << TestLog::Message << deviceNdx << ": " << tcu::toHex(devices[deviceNdx]) << TestLog::EndMessage;
+
+ const DeviceDriver vkDevice (vkPlatform, devices[deviceNdx]);
+ const Unique<VkDeviceT> device (createDevice(vkDevice, devices[deviceNdx], &deviceInfo));
+ Move<VkSamplerT> tmpSampler = createSampler(vkDevice, *device, &samplerInfo);
+ const Unique<VkSamplerT> sampler (tmpSampler);
+ }
+ }
+
+ return tcu::TestStatus::pass("Creating sampler succeeded");
+}
+
+tcu::TestCaseGroup* createTests (tcu::TestContext& testCtx)
+{
+ de::MovePtr<tcu::TestCaseGroup> apiTests (new tcu::TestCaseGroup(testCtx, "api", "API Tests"));
+
+ addFunctionCase(apiTests.get(), "create_sampler", "", createSampler);
+
+ return apiTests.release();
+}
+
+} // api
+} // vkt
--- /dev/null
+#ifndef _VKTAPITESTS_HPP
+#define _VKTAPITESTS_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Vulkan Module
+ * --------------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief API tests
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "tcuTestCase.hpp"
+
+namespace vkt
+{
+namespace api
+{
+
+tcu::TestCaseGroup* createTests (tcu::TestContext& testCtx);
+
+} // api
+} // vkt
+
+#endif // _VKTAPITESTS_HPP
--- /dev/null
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Vulkan Module
+ * --------------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "tcuCommandLine.hpp"
+#include "tcuPlatform.hpp"
+#include "tcuResource.hpp"
+#include "tcuTestLog.hpp"
+#include "tcuTestHierarchyIterator.hpp"
+#include "deUniquePtr.hpp"
+#include "vkPrograms.hpp"
+#include "vktTestCase.hpp"
+#include "vktTestPackage.hpp"
+
+#include <iostream>
+
+namespace vkt
+{
+
+using std::vector;
+using std::string;
+using de::UniquePtr;
+
+tcu::TestPackageRoot* createRoot (tcu::TestContext& testCtx)
+{
+ vector<tcu::TestNode*> children;
+ children.push_back(new TestPackage(testCtx));
+ return new tcu::TestPackageRoot(testCtx, children);
+}
+
+void buildPrograms (tcu::TestContext& testCtx)
+{
+ const UniquePtr<tcu::TestPackageRoot> root (createRoot(testCtx));
+ tcu::DefaultHierarchyInflater inflater (testCtx);
+ tcu::TestHierarchyIterator iterator (*root, inflater, testCtx.getCommandLine());
+
+ while (iterator.getState() != tcu::TestHierarchyIterator::STATE_FINISHED)
+ {
+ if (iterator.getState() == tcu::TestHierarchyIterator::STATE_ENTER_NODE &&
+ tcu::isTestNodeTypeExecutable(iterator.getNode()->getNodeType()))
+ {
+ const TestCase* const testCase = dynamic_cast<TestCase*>(iterator.getNode());
+ const string path = iterator.getNodePath();
+ vk::SourceCollection progs;
+
+ tcu::print("%s\n", path.c_str());
+
+ testCase->initPrograms(progs);
+
+ for (vk::SourceCollection::Iterator progIter = progs.begin(); progIter != progs.end(); ++progIter)
+ {
+ tcu::print(" %s\n", progIter.getName().c_str());
+
+ // \todo [2015-03-20 pyry] This is POC level, next steps:
+ // - actually build programs
+ // - eliminate duplicates
+ // - store as binaries + name -> prog file map
+ }
+ }
+
+ iterator.next();
+ }
+}
+
+} // vkt
+
+int main (int argc, const char* argv[])
+{
+ try
+ {
+ const tcu::CommandLine cmdLine (argc, argv);
+ tcu::DirArchive archive (".");
+ tcu::TestLog log (cmdLine.getLogFileName(), cmdLine.getLogFlags());
+ tcu::Platform platform;
+ tcu::TestContext testCtx (platform, archive, log, cmdLine, DE_NULL);
+
+ vkt::buildPrograms(testCtx);
+ }
+ catch (const std::exception& e)
+ {
+ tcu::die("%s", e.what());
+ }
+
+ return 0;
+}
--- /dev/null
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Vulkan Module
+ * --------------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Platform information tests
+ *//*--------------------------------------------------------------------*/
+
+#include "vktInfo.hpp"
+
+#include "vktTestCaseUtil.hpp"
+
+#include "vkPlatform.hpp"
+#include "vkStrUtil.hpp"
+#include "vkRef.hpp"
+
+#include "tcuTestLog.hpp"
+#include "tcuFormatUtil.hpp"
+
+#include "deUniquePtr.hpp"
+#include "deStringUtil.hpp"
+
+#include "qpInfo.h"
+
+namespace vkt
+{
+
+using namespace vk;
+using std::vector;
+using std::string;
+using tcu::TestLog;
+
+tcu::TestStatus enumeratePhysicalDevices (Context& context)
+{
+ const struct VkApplicationInfo appInfo =
+ {
+ VK_STRUCTURE_TYPE_APPLICATION_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ "deqp", // const char* pAppName;
+ qpGetReleaseId(), // deUint32 appVersion;
+ "deqp", // const char* pEngineName;
+ qpGetReleaseId(), // deUint32 engineVersion;
+ VK_API_VERSION // deUint32 apiVersion;
+ };
+ const struct VkInstanceCreateInfo instanceInfo =
+ {
+ VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ &appInfo, // const VkApplicationInfo* pAppInfo;
+ DE_NULL, // const VkAllocCallbacks* pAllocCb;
+ 0u, // deUint32 extensionCount;
+ DE_NULL // const char*const* ppEnabledExtensionNames;
+ };
+
+ const PlatformInterface& vkPlatform = context.getPlatformInterface();
+ TestLog& log = context.getTestContext().getLog();
+ const Unique<VkInstanceT> instance (createInstance(vkPlatform, &instanceInfo));
+ vector<VkPhysicalDevice> devices;
+ deUint32 numDevices = 0;
+
+ VK_CHECK(vkPlatform.enumeratePhysicalDevices(*instance, &numDevices, DE_NULL));
+
+ log << TestLog::Integer("NumDevices", "Number of devices", "", QP_KEY_TAG_NONE, deInt64(numDevices));
+
+ if (numDevices > 0)
+ {
+ devices.resize(numDevices);
+ VK_CHECK(vkPlatform.enumeratePhysicalDevices(*instance, &numDevices, &devices[0]));
+
+ for (deUint32 ndx = 0; ndx < numDevices; ndx++)
+ log << TestLog::Message << ndx << ": " << tcu::toHex(devices[ndx]) << TestLog::EndMessage;
+ }
+
+ return tcu::TestStatus::pass("Enumerating devices succeeded");
+}
+
+tcu::TestStatus deviceProperties (Context& context)
+{
+ const struct VkApplicationInfo appInfo =
+ {
+ VK_STRUCTURE_TYPE_APPLICATION_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ "deqp", // const char* pAppName;
+ qpGetReleaseId(), // deUint32 appVersion;
+ "deqp", // const char* pEngineName;
+ qpGetReleaseId(), // deUint32 engineVersion;
+ VK_API_VERSION // deUint32 apiVersion;
+ };
+ const struct VkInstanceCreateInfo instanceInfo =
+ {
+ VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ &appInfo, // const VkApplicationInfo* pAppInfo;
+ DE_NULL, // const VkAllocCallbacks* pAllocCb;
+ 0u, // deUint32 extensionCount;
+ DE_NULL // const char*const* ppEnabledExtensionNames;
+ };
+
+ const PlatformInterface& vkPlatform = context.getPlatformInterface();
+ TestLog& log = context.getTestContext().getLog();
+ const Unique<VkInstanceT> instance (createInstance(vkPlatform, &instanceInfo));
+ vector<VkPhysicalDevice> devices;
+ deUint32 numDevices = 0;
+
+ VK_CHECK(vkPlatform.enumeratePhysicalDevices(*instance, &numDevices, DE_NULL));
+
+ if (numDevices > 0)
+ {
+ devices.resize(numDevices);
+ VK_CHECK(vkPlatform.enumeratePhysicalDevices(*instance, &numDevices, &devices[0]));
+
+ for (deUint32 ndx = 0; ndx < numDevices; ndx++)
+ {
+ const VkPhysicalDevice physicalDevice = devices[ndx];
+ const tcu::ScopedLogSection section (log, string("Device") + de::toString(ndx), string("Device ") + de::toString(ndx) + " (" + de::toString(tcu::toHex(physicalDevice)) + ")");
+ const vk::DeviceDriver vkDevice (vkPlatform, physicalDevice);
+ VkPhysicalDeviceProperties properties;
+ deUintptr propertiesSize = sizeof(properties);
+
+ VK_CHECK(vkDevice.getPhysicalDeviceInfo(physicalDevice, VK_PHYSICAL_DEVICE_INFO_TYPE_PROPERTIES, &propertiesSize, &properties));
+
+ log << TestLog::Message << "apiVersion = " << unpackVersion(properties.apiVersion) << "\n"
+ << "driverVersion = " << tcu::toHex(properties.driverVersion) << "\n"
+ << "vendorId = " << tcu::toHex(properties.vendorId) << "\n"
+ << "deviceId = " << tcu::toHex(properties.deviceId) << "\n"
+ << "deviceType = " << properties.deviceType << "\n"
+ << "deviceName = " << properties.deviceName << "\n"
+ << "maxInlineMemoryUpdateSize = " << properties.maxInlineMemoryUpdateSize << "\n"
+ << "maxBoundDescriptorSets = " << properties.maxBoundDescriptorSets << "\n"
+ << "maxThreadGroupSize = " << properties.maxThreadGroupSize << "\n"
+ << "timestampFrequency = " << properties.timestampFrequency << "\n"
+ << "multiColorAttachmentClears = " << properties.multiColorAttachmentClears << "\n"
+ << "maxDescriptorSets = " << properties.maxDescriptorSets << "\n"
+ << "maxViewports = " << properties.maxViewports << "\n"
+ << "maxColorAttachments = " << properties.maxColorAttachments
+ << TestLog::EndMessage;
+ }
+ }
+
+ return tcu::TestStatus::pass("Enumerating devices succeeded");
+}
+
+tcu::TestCaseGroup* createInfoTests (tcu::TestContext& testCtx)
+{
+ de::MovePtr<tcu::TestCaseGroup> infoTests (new tcu::TestCaseGroup(testCtx, "info", "Platform Information Tests"));
+
+ addFunctionCase(infoTests.get(), "physical_devices", "Physical devices", enumeratePhysicalDevices);
+ addFunctionCase(infoTests.get(), "device_properties", "Device properties", deviceProperties);
+
+ return infoTests.release();
+}
+
+} // vkt
--- /dev/null
+#ifndef _VKTINFO_HPP
+#define _VKTINFO_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Vulkan Module
+ * --------------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Platform information tests
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "tcuTestCase.hpp"
+
+namespace vkt
+{
+
+tcu::TestCaseGroup* createInfoTests (tcu::TestContext& testCtx);
+
+} // vkt
+
+#endif // _VKTINFO_HPP
--- /dev/null
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Vulkan Module
+ * --------------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Vulkan test case base classes
+ *//*--------------------------------------------------------------------*/
+
+#include "vktTestCase.hpp"
+
+namespace vkt
+{
+
+void TestCase::initPrograms (vk::ProgramCollection<glu::ProgramSources>&) const
+{
+}
+
+} // vkt
--- /dev/null
+#ifndef _VKTTESTCASE_HPP
+#define _VKTTESTCASE_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Vulkan Module
+ * --------------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Vulkan test case base classes
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "tcuTestCase.hpp"
+
+namespace glu
+{
+struct ProgramSources;
+}
+
+namespace vk
+{
+class PlatformInterface;
+class ProgramBinary;
+template<typename Program> class ProgramCollection;
+}
+
+namespace vkt
+{
+
+class Context
+{
+public:
+ Context (tcu::TestContext& testCtx,
+ const vk::PlatformInterface& platformInterface,
+ vk::ProgramCollection<vk::ProgramBinary>& progCollection)
+ : m_testCtx (testCtx)
+ , m_platformInterface (platformInterface)
+ , m_progCollection (progCollection) {}
+ ~Context (void) {}
+
+ tcu::TestContext& getTestContext (void) const { return m_testCtx; }
+ const vk::PlatformInterface& getPlatformInterface(void) const { return m_platformInterface; }
+ vk::ProgramCollection<vk::ProgramBinary>& getBinaryCollection (void) const { return m_progCollection; }
+
+protected:
+ tcu::TestContext& m_testCtx;
+ const vk::PlatformInterface& m_platformInterface;
+ vk::ProgramCollection<vk::ProgramBinary>& m_progCollection;
+};
+
+class TestInstance;
+
+class TestCase : public tcu::TestCase
+{
+public:
+ TestCase (tcu::TestContext& testCtx, const std::string& name, const std::string& description);
+ TestCase (tcu::TestContext& testCtx, tcu::TestNodeType type, const std::string& name, const std::string& description);
+ virtual ~TestCase (void) {}
+
+ virtual void initPrograms (vk::ProgramCollection<glu::ProgramSources>& programCollection) const;
+ virtual TestInstance* createInstance (Context& context) const = 0;
+
+ IterateResult iterate (void) { DE_ASSERT(false); return STOP; } // Deprecated in this module
+};
+
+class TestInstance
+{
+public:
+ TestInstance (Context& context) : m_context(context) {}
+ virtual ~TestInstance (void) {}
+
+ virtual tcu::TestStatus iterate (void) = 0;
+
+protected:
+ Context& m_context;
+};
+
+inline TestCase::TestCase (tcu::TestContext& testCtx, const std::string& name, const std::string& description)
+ : tcu::TestCase(testCtx, name.c_str(), description.c_str())
+{
+}
+
+inline TestCase::TestCase (tcu::TestContext& testCtx, tcu::TestNodeType type, const std::string& name, const std::string& description)
+ : tcu::TestCase(testCtx, type, name.c_str(), description.c_str())
+{
+}
+
+} // vkt
+
+#endif // _VKTTESTCASE_HPP
--- /dev/null
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Vulkan Module
+ * --------------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief TestCase utilities
+ *//*--------------------------------------------------------------------*/
+
+#include "vktTestCaseUtil.hpp"
+
+DE_EMPTY_CPP_FILE
--- /dev/null
+#ifndef _VKTTESTCASEUTIL_HPP
+#define _VKTTESTCASEUTIL_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Vulkan Module
+ * --------------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief TestCase utilities
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "vktTestCase.hpp"
+
+namespace vkt
+{
+
+template<typename Arg0>
+struct NoPrograms1
+{
+ void init (vk::ProgramCollection<glu::ProgramSources>&, const Arg0&) const {}
+};
+
+template<typename Instance, typename Arg0, typename Programs = NoPrograms1<Arg0> >
+class InstanceFactory1 : public TestCase
+{
+public:
+ InstanceFactory1 (tcu::TestContext& testCtx, tcu::TestNodeType type, const std::string& name, const std::string& desc, const Arg0& arg0)
+ : TestCase (testCtx, type, name, desc)
+ , m_progs ()
+ , m_arg0 (arg0)
+ {}
+
+ InstanceFactory1 (tcu::TestContext& testCtx, tcu::TestNodeType type, const std::string& name, const std::string& desc, const Programs& progs, const Arg0& arg0)
+ : TestCase (testCtx, type, name, desc)
+ , m_progs (progs)
+ , m_arg0 (arg0)
+ {}
+
+ void initPrograms (vk::ProgramCollection<glu::ProgramSources>& dst) const { m_progs.init(dst, m_arg0); }
+ TestInstance* createInstance (Context& context) const { return new Instance(context, m_arg0); }
+
+private:
+ const Programs m_progs;
+ const Arg0 m_arg0;
+};
+
+class FunctionInstance0 : public TestInstance
+{
+public:
+ typedef tcu::TestStatus (*Function) (Context& context);
+
+ FunctionInstance0 (Context& context, Function function)
+ : TestInstance (context)
+ , m_function (function)
+ {}
+
+ tcu::TestStatus iterate (void) { return m_function(m_context); }
+
+private:
+ const Function m_function;
+};
+
+template<typename Arg0>
+class FunctionInstance1 : public TestInstance
+{
+public:
+ typedef tcu::TestStatus (*Function) (Context& context, const Arg0& arg0);
+
+ struct Args
+ {
+ Args (Function func_, Arg0 arg0_) : func(func_), arg0(arg0_) {}
+
+ Function func;
+ Arg0 arg0;
+ };
+
+ FunctionInstance1 (Context& context, const Args& args)
+ : TestInstance (context)
+ , m_args (args)
+ {}
+
+ tcu::TestStatus iterate (void) { return m_args.func(m_context, m_args.arg0); }
+
+private:
+ const Args m_args;
+};
+
+template<typename Arg0>
+class FunctionPrograms1
+{
+public:
+ typedef void (*Function) (vk::ProgramCollection<glu::ProgramSources>& dst, const Arg0& arg0);
+
+ FunctionPrograms1 (Function func)
+ : m_func(func)
+ {}
+
+ void init (vk::ProgramCollection<glu::ProgramSources>& dst, const typename FunctionInstance1<Arg0>::Args& args) const { m_func(dst, args.arg0); }
+
+private:
+ const Function m_func;
+};
+
+inline TestCase* createFunctionCase (tcu::TestContext& testCtx,
+ tcu::TestNodeType type,
+ const std::string& name,
+ const std::string& desc,
+ FunctionInstance0::Function testFunction)
+{
+ return new InstanceFactory1<FunctionInstance0, typename FunctionInstance0::Function>(testCtx, type, name, desc, testFunction);
+}
+
+template<typename Arg0>
+TestCase* createFunctionCase (tcu::TestContext& testCtx,
+ tcu::TestNodeType type,
+ const std::string& name,
+ const std::string& desc,
+ typename FunctionInstance1<Arg0>::Function testFunction,
+ const Arg0& arg0)
+{
+ return new InstanceFactory1<FunctionInstance1<Arg0>, typename FunctionInstance1<Arg0>::Args>(
+ testCtx, type, name, desc, typename FunctionInstance1<Arg0>::Args(testFunction, arg0));
+}
+
+template<typename Arg0>
+TestCase* createFunctionCase (tcu::TestContext& testCtx,
+ tcu::TestNodeType type,
+ const std::string& name,
+ const std::string& desc,
+ typename FunctionPrograms1<Arg0>::Function initPrograms,
+ typename FunctionInstance1<Arg0>::Function testFunction,
+ const Arg0& arg0)
+{
+ return new InstanceFactory1<FunctionInstance1<Arg0>, typename FunctionInstance1<Arg0>::Args, FunctionPrograms1<Arg0> >(
+ testCtx, type, name, desc, FunctionPrograms1<Arg0>(initPrograms), typename FunctionInstance1<Arg0>::Args(testFunction, arg0));
+}
+
+inline void addFunctionCase (tcu::TestCaseGroup* group,
+ const std::string& name,
+ const std::string& desc,
+ FunctionInstance0::Function testFunc)
+{
+ group->addChild(createFunctionCase(group->getTestContext(), tcu::NODETYPE_SELF_VALIDATE, name, desc, testFunc));
+}
+
+template<typename Arg0>
+void addFunctionCase (tcu::TestCaseGroup* group,
+ const std::string& name,
+ const std::string& desc,
+ typename FunctionInstance1<Arg0>::Function testFunc,
+ const Arg0& arg0)
+{
+ group->addChild(createFunctionCase(group->getTestContext(), tcu::NODETYPE_SELF_VALIDATE, name, desc, testFunc, arg0));
+}
+
+template<typename Arg0>
+void addFunctionCase (tcu::TestCaseGroup* group,
+ tcu::TestNodeType type,
+ const std::string& name,
+ const std::string& desc,
+ typename FunctionInstance1<Arg0>::Function testFunc,
+ const Arg0& arg0)
+{
+ group->addChild(createFunctionCase(group->getTestContext(), type, name, desc, testFunc, arg0));
+}
+
+template<typename Arg0>
+void addFunctionCase (tcu::TestCaseGroup* group,
+ const std::string& name,
+ const std::string& desc,
+ typename FunctionPrograms1<Arg0>::Function initPrograms,
+ typename FunctionInstance1<Arg0>::Function testFunc,
+ const Arg0& arg0)
+{
+ group->addChild(createFunctionCase(group->getTestContext(), tcu::NODETYPE_SELF_VALIDATE, name, desc, initPrograms, testFunc, arg0));
+}
+
+template<typename Arg0>
+void addFunctionCase (tcu::TestCaseGroup* group,
+ tcu::TestNodeType type,
+ const std::string& name,
+ const std::string& desc,
+ typename FunctionPrograms1<Arg0>::Function initPrograms,
+ typename FunctionInstance1<Arg0>::Function testFunc,
+ const Arg0& arg0)
+{
+ group->addChild(createFunctionCase(group->getTestContext(), type, name, desc, initPrograms, testFunc, arg0));
+}
+
+} // vkt
+
+#endif // _VKTTESTCASEUTIL_HPP
--- /dev/null
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Vulkan Module
+ * --------------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Vulkan Test Package
+ *//*--------------------------------------------------------------------*/
+
+#include "vktTestPackage.hpp"
+
+#include "tcuPlatform.hpp"
+#include "vkPlatform.hpp"
+#include "vkPrograms.hpp"
+#include "deUniquePtr.hpp"
+
+#include "vktInfo.hpp"
+#include "vktApiTests.hpp"
+
+#include <vector>
+
+namespace vkt
+{
+
+using std::vector;
+using de::UniquePtr;
+using de::MovePtr;
+
+// TestCaseExecutor
+
+class TestCaseExecutor : public tcu::TestCaseExecutor
+{
+public:
+ TestCaseExecutor (tcu::TestContext& testCtx);
+ ~TestCaseExecutor (void);
+
+ virtual void init (tcu::TestCase* testCase, const std::string& path);
+ virtual void deinit (tcu::TestCase* testCase);
+
+ virtual tcu::TestNode::IterateResult iterate (tcu::TestCase* testCase);
+
+private:
+ vk::BinaryCollection m_progCollection;
+ de::UniquePtr<vk::Library> m_library;
+ Context m_context;
+
+ TestInstance* m_instance; //!< Current test case instance
+};
+
+static MovePtr<vk::Library> createLibrary (tcu::TestContext& testCtx)
+{
+ return MovePtr<vk::Library>(testCtx.getPlatform().getVulkanPlatform().createLibrary());
+}
+
+TestCaseExecutor::TestCaseExecutor (tcu::TestContext& testCtx)
+ : m_library (createLibrary(testCtx))
+ , m_context (testCtx, m_library->getPlatformInterface(), m_progCollection)
+ , m_instance (DE_NULL)
+{
+}
+
+TestCaseExecutor::~TestCaseExecutor (void)
+{
+ delete m_instance;
+}
+
+void TestCaseExecutor::init (tcu::TestCase* testCase, const std::string& casePath)
+{
+ const TestCase* vktCase = dynamic_cast<TestCase*>(testCase);
+ vk::SourceCollection sourceProgs;
+
+ DE_UNREF(casePath); // \todo [2015-03-13 pyry] Use this to identify ProgramCollection storage path
+
+ if (!vktCase)
+ TCU_THROW(InternalError, "Test node not an instance of vkt::TestCase");
+
+ m_progCollection.clear();
+ vktCase->initPrograms(sourceProgs);
+
+ // \todo [2015-03-13 pyry] Need abstraction for this - sometimes built on run-time, sometimes loaded from archive
+ for (vk::SourceCollection::Iterator progIter = sourceProgs.begin(); progIter != sourceProgs.end(); ++progIter)
+ {
+ const std::string& name = progIter.getName();
+ const glu::ProgramSources& srcProg = progIter.getProgram();
+ de::MovePtr<vk::ProgramBinary> binProg = de::MovePtr<vk::ProgramBinary>(vk::buildProgram(srcProg, vk::PROGRAM_FORMAT_GLSL));
+
+ m_progCollection.add(name, binProg);
+ }
+
+ DE_ASSERT(!m_instance);
+ m_instance = vktCase->createInstance(m_context);
+}
+
+void TestCaseExecutor::deinit (tcu::TestCase*)
+{
+ delete m_instance;
+ m_instance = DE_NULL;
+}
+
+tcu::TestNode::IterateResult TestCaseExecutor::iterate (tcu::TestCase*)
+{
+ DE_ASSERT(m_instance);
+
+ const tcu::TestStatus result = m_instance->iterate();
+
+ if (result.isComplete())
+ {
+ // Vulkan tests shouldn't set result directly
+ DE_ASSERT(m_context.getTestContext().getTestResult() == QP_TEST_RESULT_LAST);
+ m_context.getTestContext().setTestResult(result.getCode(), result.getDescription().c_str());
+ return tcu::TestNode::STOP;
+ }
+ else
+ return tcu::TestNode::CONTINUE;
+}
+
+// TestPackage
+
+TestPackage::TestPackage (tcu::TestContext& testCtx)
+ : tcu::TestPackage(testCtx, "dEQP-VK", "dEQP Vulkan Tests")
+{
+}
+
+TestPackage::~TestPackage (void)
+{
+}
+
+tcu::TestCaseExecutor* TestPackage::createExecutor (void) const
+{
+ return new TestCaseExecutor(m_testCtx);
+}
+
+void TestPackage::init (void)
+{
+ addChild(createInfoTests (m_testCtx));
+ addChild(api::createTests (m_testCtx));
+}
+
+} // vkt
--- /dev/null
+#ifndef _VKTTESTPACKAGE_HPP
+#define _VKTTESTPACKAGE_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Vulkan Module
+ * --------------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Vulkan Test Package
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "tcuTestPackage.hpp"
+#include "tcuResource.hpp"
+#include "vktTestCase.hpp"
+
+namespace vkt
+{
+
+class TestPackage : public tcu::TestPackage
+{
+public:
+ TestPackage (tcu::TestContext& testCtx);
+ virtual ~TestPackage (void);
+
+ virtual void init (void);
+ tcu::TestCaseExecutor* createExecutor (void) const;
+};
+
+} // vkt
+
+#endif // _VKTTESTPACKAGE_HPP
--- /dev/null
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Vulkan Module
+ * --------------------------------------------
+ *
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Vulkan Test Package Entry Point.
+ *//*--------------------------------------------------------------------*/
+
+#include "vktTestPackage.hpp"
+
+// Register package to test executor.
+
+static tcu::TestPackage* createTestPackage (tcu::TestContext& testCtx)
+{
+ return new vkt::TestPackage(testCtx);
+}
+
+tcu::TestPackageDescriptor g_vktPackageDescriptor("dEQP-VK", createTestPackage);
--- /dev/null
+add_subdirectory(vulkan)