From b4f4044b4b18d5c5d76019c9414e1a0f7433c56e Mon Sep 17 00:00:00 2001 From: Dejan Mircevski Date: Tue, 17 Nov 2015 23:38:23 -0500 Subject: [PATCH] Update the spirv-tools revision to just before 1.0. Change-Id: Icdaae5360781a863d86f3567554fe9cba6024df0 --- external/fetch_sources.py | 2 +- external/vulkancts/framework/vulkan/vkSpirVAsm.cpp | 22 +++++++++------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/external/fetch_sources.py b/external/fetch_sources.py index f810b17..d3e8773 100644 --- a/external/fetch_sources.py +++ b/external/fetch_sources.py @@ -170,7 +170,7 @@ PACKAGES = [ postExtract = postExtractLibpng), GitRepo( "git@gitlab.khronos.org:spirv/spirv-tools.git", - "6e5fc02aef16d8cdc65d39c20166cd2775d2af35", + "spirv-0.99-rev32", "spirv-tools"), GitRepo( "git@gitlab.khronos.org:GLSL/glslang.git", diff --git a/external/vulkancts/framework/vulkan/vkSpirVAsm.cpp b/external/vulkancts/framework/vulkan/vkSpirVAsm.cpp index 4b592ce..c0860c4 100644 --- a/external/vulkancts/framework/vulkan/vkSpirVAsm.cpp +++ b/external/vulkancts/framework/vulkan/vkSpirVAsm.cpp @@ -55,21 +55,17 @@ using std::vector; namespace { +// Once spirv-tools upgrades past 972788bf239daff45ed0d2bb878e608c4106939c, we +// won't need this singleton, as spvContextCreate() is thread-safe. static volatile deSingletonState s_spirvInitState = DE_SINGLETON_STATE_NOT_INITIALIZED; -static spv_opcode_table s_spirvOpcodeTable; -static spv_operand_table s_spirvOperandTable; -static spv_ext_inst_table s_spirvExtInstTable; - void initSpirVTools (void*) { - if (spvOpcodeTableGet(&s_spirvOpcodeTable) != SPV_SUCCESS) - TCU_THROW(InternalError, "Cannot get opcode table for assembly"); - - if (spvOperandTableGet(&s_spirvOperandTable) != SPV_SUCCESS) - TCU_THROW(InternalError, "Cannot get operand table for assembly"); - - if (spvExtInstTableGet(&s_spirvExtInstTable) != SPV_SUCCESS) - TCU_THROW(InternalError, "Cannot get external instruction table for assembly"); + spv_binary binary = DE_NULL; + spv_diagnostic diagnostic = DE_NULL; + // This dummy compilation initializes opcode tables for all the subsequent + // ones. It should be the first spv call in the current process, and it + // isn't thread-safe. + spvTextToBinary("", 0, &binary, &diagnostic); } void prepareSpirvTools (void) @@ -87,7 +83,7 @@ void assembleSpirV (const SpirVAsmSource* program, std::vector* dst, Sp spv_binary binary = DE_NULL; spv_diagnostic diagnostic = DE_NULL; const deUint64 compileStartTime = deGetMicroseconds(); - const spv_result_t compileOk = spvTextToBinary(spvSource.c_str(), spvSource.size(), s_spirvOpcodeTable, s_spirvOperandTable, s_spirvExtInstTable, &binary, &diagnostic); + const spv_result_t compileOk = spvTextToBinary(spvSource.c_str(), spvSource.size(), &binary, &diagnostic); { buildInfo->source = program; -- 2.7.4