diff options
author | Alexander Galazin <alexander.galazin@arm.com> | 2018-12-07 13:42:23 +0100 |
---|---|---|
committer | Alexander Galazin <alexander.galazin@arm.com> | 2018-12-07 13:42:23 +0100 |
commit | 94ce227fbce90ed84bffba740bfbaf4d8a7369bb (patch) | |
tree | c9a57633f70797c44a181563a66c2779792f6e5e | |
parent | ad0797e0a1ddf28a0a53ad5143a277eaae629bcd (diff) | |
parent | 12aa347f43c85df3a0daf930739551d3f53d3d48 (diff) | |
download | VK-GL-CTS-94ce227fbce90ed84bffba740bfbaf4d8a7369bb.tar.gz VK-GL-CTS-94ce227fbce90ed84bffba740bfbaf4d8a7369bb.tar.bz2 VK-GL-CTS-94ce227fbce90ed84bffba740bfbaf4d8a7369bb.zip |
Merge vk-gl-cts/master into vk-gl-cts/vulkan-cts-next-dev
Change-Id: I6b9a7542624d1899ed00f694e7f87c1a40252280
-rw-r--r-- | AndroidGen.mk | 1 | ||||
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rwxr-xr-x | external/fetch_sources.py | 57 | ||||
-rw-r--r-- | external/renderdoc/.gitignore | 1 | ||||
-rw-r--r-- | external/vulkancts/README.md | 15 | ||||
-rw-r--r-- | external/vulkancts/framework/vulkan/CMakeLists.txt | 2 | ||||
-rw-r--r-- | external/vulkancts/framework/vulkan/vkRenderDocUtil.cpp | 108 | ||||
-rw-r--r-- | external/vulkancts/framework/vulkan/vkRenderDocUtil.hpp | 51 | ||||
-rw-r--r-- | external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp | 2 | ||||
-rw-r--r-- | external/vulkancts/modules/vulkan/vktTestCase.cpp | 1 | ||||
-rw-r--r-- | external/vulkancts/modules/vulkan/vktTestPackage.cpp | 9 | ||||
-rw-r--r-- | framework/common/tcuCommandLine.cpp | 5 | ||||
-rw-r--r-- | framework/common/tcuCommandLine.hpp | 3 |
13 files changed, 257 insertions, 1 deletions
diff --git a/AndroidGen.mk b/AndroidGen.mk index 1be93fcd5..1d55d3d26 100644 --- a/AndroidGen.mk +++ b/AndroidGen.mk @@ -45,6 +45,7 @@ LOCAL_SRC_FILES := \ external/vulkancts/framework/vulkan/vkQueryUtil.cpp \ external/vulkancts/framework/vulkan/vkRef.cpp \ external/vulkancts/framework/vulkan/vkRefUtil.cpp \ + external/vulkancts/framework/vulkan/vkRenderDocUtil.cpp \ external/vulkancts/framework/vulkan/vkShaderProgram.cpp \ external/vulkancts/framework/vulkan/vkShaderToSpirV.cpp \ external/vulkancts/framework/vulkan/vkSpirVAsm.cpp \ diff --git a/CMakeLists.txt b/CMakeLists.txt index e1b24496c..791a2f500 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,9 @@ if (NOT EXISTS ${SPIRV_INCLUDE_PATH}) endif() include_directories(${SPIRV_INCLUDE_PATH}) +# RenderDoc API +include_directories(external/renderdoc/src) + include_directories(${PNG_INCLUDE_PATH}) message(STATUS "DEQP_TARGET_NAME = ${DEQP_TARGET_NAME}") diff --git a/external/fetch_sources.py b/external/fetch_sources.py index 98fdbce14..bdef9938d 100755 --- a/external/fetch_sources.py +++ b/external/fetch_sources.py @@ -175,6 +175,58 @@ class SourcePackage (Source): if self.postExtract != None: self.postExtract(dstPath) +class SourceFile (Source): + def __init__(self, url, filename, checksum, baseDir, extractDir = "src"): + Source.__init__(self, baseDir, extractDir) + self.url = url + self.filename = filename + self.checksum = checksum + + def update (self, cmdProtocol = None): + if not self.isFileUpToDate(): + Source.clean(self) + self.fetchAndVerifyFile() + + def isFileUpToDate (self): + file = os.path.join(EXTERNAL_DIR, pkg.baseDir, pkg.extractDir, pkg.filename) + if os.path.exists(file): + return computeChecksum(readFile(file)) == self.checksum + else: + return False + + def connectToUrl (self, url): + result = None + + if sys.version_info < (3, 0): + from urllib2 import urlopen + else: + from urllib.request import urlopen + + if args.insecure: + print("Ignoring certificate checks") + ssl_context = ssl._create_unverified_context() + result = urlopen(url, context=ssl_context) + else: + result = urlopen(url) + + return result + + def fetchAndVerifyFile (self): + print("Fetching %s" % self.url) + + req = self.connectToUrl(self.url) + data = req.read() + checksum = computeChecksum(data) + dstPath = os.path.join(EXTERNAL_DIR, self.baseDir, self.extractDir, self.filename) + + if checksum != self.checksum: + raise Exception("Checksum mismatch for %s, expected %s, got %s" % (self.filename, self.checksum, checksum)) + + if not os.path.exists(os.path.dirname(dstPath)): + os.mkdir(os.path.dirname(dstPath)) + + writeFile(dstPath, data) + class GitRepo (Source): def __init__(self, httpsUrl, sshUrl, revision, baseDir, extractDir = "src", removeTags = []): Source.__init__(self, baseDir, extractDir) @@ -255,6 +307,11 @@ PACKAGES = [ "c9d164ec247f426a525a7b89936694aefbc91fb7a50182b198898b8fc91174b4", "libpng", postExtract = postExtractLibpng), + SourceFile( + "https://raw.githubusercontent.com/baldurk/renderdoc/v1.1/renderdoc/api/app/renderdoc_app.h", + "renderdoc_app.h", + "e7b5f0aa5b1b0eadc63a1c624c0ca7f5af133aa857d6a4271b0ef3d0bdb6868e", + "renderdoc"), GitRepo( "https://github.com/KhronosGroup/SPIRV-Tools.git", None, diff --git a/external/renderdoc/.gitignore b/external/renderdoc/.gitignore new file mode 100644 index 000000000..85de9cf93 --- /dev/null +++ b/external/renderdoc/.gitignore @@ -0,0 +1 @@ +src diff --git a/external/vulkancts/README.md b/external/vulkancts/README.md index eae0e748e..224aeeb5b 100644 --- a/external/vulkancts/README.md +++ b/external/vulkancts/README.md @@ -467,3 +467,18 @@ targets. Do not truncate the shader cache file at startup. No shader compilation will occur on repeated runs of the CTS. + + +RenderDoc +--------- +The RenderDoc (https://renderdoc.org/) graphics debugger may be used to debug +Vulkan tests. + +Following command line option should be used when launching tests from +RenderDoc UI: + + --deqp-renderdoc=enable + +This causes the framework to interface with the debugger and mark each dEQP +test case as a separate 'frame', just for the purpose of capturing. The frames +are added using RenderDoc 'In-Application API', instead of swapchain operations. diff --git a/external/vulkancts/framework/vulkan/CMakeLists.txt b/external/vulkancts/framework/vulkan/CMakeLists.txt index 66ba8d7cb..3fc871cb8 100644 --- a/external/vulkancts/framework/vulkan/CMakeLists.txt +++ b/external/vulkancts/framework/vulkan/CMakeLists.txt @@ -56,6 +56,8 @@ set(VKUTILNOSHADER_SRCS vkYCbCrImageWithMemory.hpp vkObjUtil.cpp vkObjUtil.hpp + vkRenderDocUtil.hpp + vkRenderDocUtil.cpp ) set(VKUTIL_SRCS diff --git a/external/vulkancts/framework/vulkan/vkRenderDocUtil.cpp b/external/vulkancts/framework/vulkan/vkRenderDocUtil.cpp new file mode 100644 index 000000000..ca5d1ee51 --- /dev/null +++ b/external/vulkancts/framework/vulkan/vkRenderDocUtil.cpp @@ -0,0 +1,108 @@ +/*------------------------------------------------------------------------- + * Vulkan CTS Framework + * -------------------- + * + * Copyright (c) 2018 Google Inc. + * + * 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 RenderDoc utility + *//*--------------------------------------------------------------------*/ + +#include "vkRenderDocUtil.hpp" + +#include "deDynamicLibrary.hpp" +#include "deUniquePtr.hpp" +#include "tcuDefs.hpp" + +#include "renderdoc_app.h" +#include <stdexcept> + +#if (DE_OS == DE_OS_WIN32) +# define RENDERDOC_LIBRARY_NAME "renderdoc.dll" +#else +# define RENDERDOC_LIBRARY_NAME "librenderdoc.so" +#endif + +namespace vk +{ + +struct RenderDocPrivate +{ + RenderDocPrivate (void) : m_api(DE_NULL), m_valid(false) {} + + de::MovePtr<de::DynamicLibrary> m_library; + ::RENDERDOC_API_1_1_2* m_api; + bool m_valid; +}; + +RenderDocUtil::RenderDocUtil (void) + : m_priv (new RenderDocPrivate) +{ + try + { + m_priv->m_library = de::MovePtr<de::DynamicLibrary>(new de::DynamicLibrary(RENDERDOC_LIBRARY_NAME)); + } + catch (const std::runtime_error& e) + { + tcu::print("Library %s not loaded: %s, RenderDoc API not available", e.what(), RENDERDOC_LIBRARY_NAME); + } + + if (m_priv->m_library) + { + ::pRENDERDOC_GetAPI pGetApi = (::pRENDERDOC_GetAPI)m_priv->m_library->getFunction("RENDERDOC_GetAPI"); + const int ret = pGetApi(eRENDERDOC_API_Version_1_1_2, (void **)&m_priv->m_api); + + if (ret == 1) + { + m_priv->m_api->TriggerCapture(); + + m_priv->m_valid = true; + } + else + { + tcu::print("RENDERDOC_GetAPI returned %d status, RenderDoc API not available", ret); + } + } +} + +RenderDocUtil::~RenderDocUtil (void) +{ + if (m_priv) + { + delete m_priv; + } +} + +bool RenderDocUtil::isValid (void) +{ + return m_priv != DE_NULL && m_priv->m_valid; +} + +void RenderDocUtil::startFrame (vk::VkInstance instance) +{ + if (!isValid()) return; + + m_priv->m_api->StartFrameCapture(RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(instance), DE_NULL); +} + +void RenderDocUtil::endFrame (vk::VkInstance instance) +{ + if (!isValid()) return; + + m_priv->m_api->EndFrameCapture(RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(instance), DE_NULL); +} + +} // vk diff --git a/external/vulkancts/framework/vulkan/vkRenderDocUtil.hpp b/external/vulkancts/framework/vulkan/vkRenderDocUtil.hpp new file mode 100644 index 000000000..1ae8cca69 --- /dev/null +++ b/external/vulkancts/framework/vulkan/vkRenderDocUtil.hpp @@ -0,0 +1,51 @@ +#ifndef _VKRENDERDOCUTIL_HPP +#define _VKRENDERDOCUTIL_HPP +/*------------------------------------------------------------------------- + * Vulkan CTS Framework + * -------------------- + * + * Copyright (c) 2018 The Khronos Group Inc. + * Copyright (c) 2018 Intel Corporation + * + * 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 VK_EXT_debug_report utilities + *//*--------------------------------------------------------------------*/ + +#include <vkDefs.hpp> + +namespace vk +{ + +struct RenderDocPrivate; + +class RenderDocUtil +{ +public: + RenderDocUtil (void); + ~RenderDocUtil (void); + + bool isValid (void); + + void startFrame (vk::VkInstance); + void endFrame (vk::VkInstance); + +private: + RenderDocPrivate * m_priv; +}; + +} // vk + +#endif // _VKRENDERDOCUTIL_HPP diff --git a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp index 1caf945cd..7e9588e94 100644 --- a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp +++ b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp @@ -2792,6 +2792,8 @@ tcu::TestCaseGroup* createSpecConstantGroup (tcu::TestContext& testCtx) // Special SPIR-V code for FConvert-case for 16-bit floats if (strcmp(cases[caseNdx].caseName, "fconvert16") == 0) { + spec.extensions.push_back("VK_KHR_shader_float16_int8"); + spec.requestedVulkanFeatures.extFloat16Int8 = EXTFLOAT16INT8FEATURES_FLOAT16; specializations["CAPABILITIES"] = "OpCapability Float16\n"; // Adds 16-bit float capability specializations["OPTYPE_DEFINITIONS"] = "%f16 = OpTypeFloat 16\n"; // Adds 16-bit float type specializations["TYPE_CONVERT"] = "%sc_final32 = OpConvertFToS %i32 %sc_final\n"; // Converts 16-bit float to 32-bit integer diff --git a/external/vulkancts/modules/vulkan/vktTestCase.cpp b/external/vulkancts/modules/vulkan/vktTestCase.cpp index c158c6b06..f307e75e7 100644 --- a/external/vulkancts/modules/vulkan/vktTestCase.cpp +++ b/external/vulkancts/modules/vulkan/vktTestCase.cpp @@ -158,6 +158,7 @@ vector<string> addCoreDeviceExtensions(const vector<string>& extensions, deUint3 deUint32 getTargetInstanceVersion (const PlatformInterface& vkp) { deUint32 version = pack(ApiVersion(1, 0, 0)); + if (vkp.enumerateInstanceVersion(&version) != VK_SUCCESS) TCU_THROW(InternalError, "Enumerate instance version error"); return version; diff --git a/external/vulkancts/modules/vulkan/vktTestPackage.cpp b/external/vulkancts/modules/vulkan/vktTestPackage.cpp index 03dd141fc..f03dbecb1 100644 --- a/external/vulkancts/modules/vulkan/vktTestPackage.cpp +++ b/external/vulkancts/modules/vulkan/vktTestPackage.cpp @@ -35,6 +35,7 @@ #include "vkDebugReportUtil.hpp" #include "vkQueryUtil.hpp" #include "vkApiVersion.hpp" +#include "vkRenderDocUtil.hpp" #include "deUniquePtr.hpp" @@ -198,6 +199,7 @@ private: Context m_context; const UniquePtr<vk::DebugReportRecorder> m_debugReportRecorder; + const UniquePtr<vk::RenderDocUtil> m_renderDoc; TestInstance* m_instance; //!< Current test case instance }; @@ -216,6 +218,9 @@ TestCaseExecutor::TestCaseExecutor (tcu::TestContext& testCtx) m_context.getInstanceInterface(), m_context.getInstance()) : MovePtr<vk::DebugReportRecorder>(DE_NULL)) + , m_renderDoc (testCtx.getCommandLine().isRenderDocEnabled() + ? MovePtr<vk::RenderDocUtil>(new vk::RenderDocUtil()) + : MovePtr<vk::RenderDocUtil>(DE_NULL)) , m_instance (DE_NULL) { } @@ -304,6 +309,8 @@ void TestCaseExecutor::init (tcu::TestCase* testCase, const std::string& casePat buildProgram<vk::SpirVProgramInfo, vk::SpirVAsmCollection::Iterator>(casePath, asmIterator, m_prebuiltBinRegistry, log, &m_progCollection, commandLine); } + if (m_renderDoc) m_renderDoc->startFrame(m_context.getInstance()); + DE_ASSERT(!m_instance); m_instance = vktCase->createInstance(m_context); } @@ -313,6 +320,8 @@ void TestCaseExecutor::deinit (tcu::TestCase*) delete m_instance; m_instance = DE_NULL; + if (m_renderDoc) m_renderDoc->endFrame(m_context.getInstance()); + // Collect and report any debug messages if (m_debugReportRecorder) { diff --git a/framework/common/tcuCommandLine.cpp b/framework/common/tcuCommandLine.cpp index 20241599f..0dd6613fc 100644 --- a/framework/common/tcuCommandLine.cpp +++ b/framework/common/tcuCommandLine.cpp @@ -94,6 +94,7 @@ DE_DECLARE_COMMAND_LINE_OPT(ShaderCacheFilename, std::string); DE_DECLARE_COMMAND_LINE_OPT(Optimization, int); DE_DECLARE_COMMAND_LINE_OPT(OptimizeSpirv, bool); DE_DECLARE_COMMAND_LINE_OPT(ShaderCacheTruncate, bool); +DE_DECLARE_COMMAND_LINE_OPT(RenderDoc, bool); static void parseIntList (const char* src, std::vector<int>* dst) { @@ -187,7 +188,8 @@ void registerOptions (de::cmdline::Parser& parser) << Option<OptimizeSpirv> (DE_NULL, "deqp-optimize-spirv", "Apply optimization to spir-v shaders as well", s_enableNames, "disable") << Option<ShaderCache> (DE_NULL, "deqp-shadercache", "Enable or disable shader cache", s_enableNames, "enable") << Option<ShaderCacheFilename> (DE_NULL, "deqp-shadercache-filename", "Write shader cache to given file", "shadercache.bin") - << Option<ShaderCacheTruncate> (DE_NULL, "deqp-shadercache-truncate", "Truncate shader cache before running tests", s_enableNames, "enable"); + << Option<ShaderCacheTruncate> (DE_NULL, "deqp-shadercache-truncate", "Truncate shader cache before running tests", s_enableNames, "enable") + << Option<RenderDoc> (DE_NULL, "deqp-renderdoc", "Enable RenderDoc frame markers and workarounds", s_enableNames, "disable"); } void registerLegacyOptions (de::cmdline::Parser& parser) @@ -806,6 +808,7 @@ const char* CommandLine::getShaderCacheFilename (void) const { return m_cmd bool CommandLine::isShaderCacheTruncateEnabled (void) const { return m_cmdLine.getOption<opt::ShaderCacheTruncate>(); } int CommandLine::getOptimizationRecipe (void) const { return m_cmdLine.getOption<opt::Optimization>(); } bool CommandLine::isSpirvOptimizationEnabled (void) const { return m_cmdLine.getOption<opt::OptimizeSpirv>(); } +bool CommandLine::isRenderDocEnabled (void) const { return m_cmdLine.getOption<opt::RenderDoc>(); } const char* CommandLine::getGLContextType (void) const { diff --git a/framework/common/tcuCommandLine.hpp b/framework/common/tcuCommandLine.hpp index 85b24f506..04255370c 100644 --- a/framework/common/tcuCommandLine.hpp +++ b/framework/common/tcuCommandLine.hpp @@ -226,6 +226,9 @@ public: //! Enable optimizing of spir-v (--deqp-optimize-spirv) bool isSpirvOptimizationEnabled (void) const; + //! Should we mark frames and enable WAs for RenderDoc (--deqp-renderdoc) + bool isRenderDocEnabled (void) const; + /*--------------------------------------------------------------------*//*! * \brief Creates case list filter * \param archive Resources |