summaryrefslogtreecommitdiffstats
path: root/tools/gfx/vulkan/render-vk.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-08-17 09:39:02 -0700
committerGitHub <noreply@github.com>2021-08-17 09:39:02 -0700
commit858c7c57b125afed9b5b2329d6b02477284e4803 (patch)
tree49f67b342448dcfb19913d8ccc089d956de14462 /tools/gfx/vulkan/render-vk.cpp
parent6406523511037987d8b8ab881aea41389afd57eb (diff)
Add GLSL450 intrinsics to SPIRV direct emit. (#1921)
* Add GLSL450 intrinsics to SPIRV direct emit. * Fix. * Fix compiler error. * Fix. * Fix compiler error. * Make direct-spirv tests actually run.
Diffstat (limited to 'tools/gfx/vulkan/render-vk.cpp')
-rw-r--r--tools/gfx/vulkan/render-vk.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/gfx/vulkan/render-vk.cpp b/tools/gfx/vulkan/render-vk.cpp
index 88770dbb9..f56a21d20 100644
--- a/tools/gfx/vulkan/render-vk.cpp
+++ b/tools/gfx/vulkan/render-vk.cpp
@@ -4944,6 +4944,7 @@ public:
/// Note that the outShaderModule value should be cleaned up when no longer needed by caller
/// via vkShaderModuleDestroy()
VkPipelineShaderStageCreateInfo compileEntryPoint(
+ const char* entryPointName,
ISlangBlob* code,
VkShaderStageFlagBits stage,
VkShaderModule& outShaderModule);
@@ -5188,6 +5189,7 @@ VkBool32 VKDevice::handleDebugMessage(VkDebugReportFlagsEXT flags, VkDebugReport
}
VkPipelineShaderStageCreateInfo VKDevice::compileEntryPoint(
+ const char* entryPointName,
ISlangBlob* code,
VkShaderStageFlagBits stage,
VkShaderModule& outShaderModule)
@@ -5210,7 +5212,7 @@ VkPipelineShaderStageCreateInfo VKDevice::compileEntryPoint(
shaderStageCreateInfo.stage = stage;
shaderStageCreateInfo.module = module;
- shaderStageCreateInfo.pName = "main";
+ shaderStageCreateInfo.pName = entryPointName;
return shaderStageCreateInfo;
}
@@ -6861,7 +6863,16 @@ Result VKDevice::createProgram(const IShaderProgram::Desc& desc, IShaderProgram*
SLANG_RETURN_ON_FAIL(compileResult);
shaderProgram->m_codeBlobs.add(kernelCode);
VkShaderModule shaderModule;
+ // HACK: our direct-spirv-emit path generates SPIRV that respects
+ // the original entry point name, while the glslang path always
+ // uses "main" as the name. We should introduce a compiler parameter
+ // to control the entry point naming behavior in SPIRV-direct path
+ // so we can remove the ad-hoc logic here.
+ const char* entryPointName = "main";
+ if (m_desc.slang.targetFlags & SLANG_TARGET_FLAG_GENERATE_SPIRV_DIRECTLY)
+ entryPointName = entryPointInfo->getName();
shaderProgram->m_stageCreateInfos.add(compileEntryPoint(
+ entryPointName,
kernelCode,
(VkShaderStageFlagBits)VulkanUtil::getShaderStage(stage),
shaderModule));
@@ -7075,7 +7086,7 @@ Result VKDevice::createComputePipelineState(const ComputePipelineStateDesc& inDe
returnComPtr(outState, pipelineStateImpl);
return SLANG_OK;
}
-
+
VkPipelineCache pipelineCache = VK_NULL_HANDLE;
VkPipeline pipeline = VK_NULL_HANDLE;