Skip to content

Commit 6523392

Browse files
committed
make populateExecutableInfo virtual, move validation to ILogicalDevice
1 parent 5b783e3 commit 6523392

7 files changed

Lines changed: 29 additions & 26 deletions

File tree

include/nbl/video/CVulkanRayTracingPipeline.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CVulkanRayTracingPipeline final : public IGPURayTracingPipeline
2525

2626
inline VkPipeline getInternalObject() const { return m_vkPipeline; }
2727

28-
void populateExecutableInfo(bool includeInternalRepresentations);
28+
void populateExecutableInfo(bool includeInternalRepresentations) override;
2929

3030
virtual const SShaderGroupHandle& getRaygen() const override;
3131
virtual std::span<const SShaderGroupHandle> getMissHandles() const override;

include/nbl/video/IGPUPipeline.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ class IGPUPipeline : public IBackendObject, public PipelineNonBackendObjectBase,
158158
{}
159159
virtual ~IGPUPipeline() = default;
160160

161+
virtual void populateExecutableInfo(bool includeInternalRepresentations) = 0;
162+
161163
};
162164

163165
}

src/nbl/video/CVulkanComputePipeline.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ class CVulkanComputePipeline final : public IGPUComputePipeline
1717
CVulkanComputePipeline(
1818
const SCreationParams& params,
1919
const VkPipeline pipeline
20-
) : IGPUComputePipeline(params), m_pipeline(pipeline) {}
20+
) : IGPUComputePipeline(params), m_pipeline(pipeline)
21+
{
22+
if (params.flags.hasFlags(SCreationParams::FLAGS::CAPTURE_STATISTICS))
23+
populateExecutableInfo(params.flags.hasFlags(SCreationParams::FLAGS::CAPTURE_INTERNAL_REPRESENTATIONS));
24+
}
2125

2226
inline const void* getNativeHandle() const override { return &m_pipeline; }
2327

2428
inline VkPipeline getInternalObject() const { return m_pipeline; }
2529

26-
void populateExecutableInfo(bool includeInternalRepresentations);
30+
void populateExecutableInfo(bool includeInternalRepresentations) override;
2731

2832
void setObjectDebugName(const char* label) const override;
2933

src/nbl/video/CVulkanGraphicsPipeline.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ class CVulkanGraphicsPipeline final : public IGPUGraphicsPipeline
1212
{
1313
public:
1414
CVulkanGraphicsPipeline(const SCreationParams& params, const VkPipeline vk_pipeline) :
15-
IGPUGraphicsPipeline(params), m_vkPipeline(vk_pipeline) {}
15+
IGPUGraphicsPipeline(params), m_vkPipeline(vk_pipeline)
16+
{
17+
if (params.flags.hasFlags(SCreationParams::FLAGS::CAPTURE_STATISTICS))
18+
populateExecutableInfo(params.flags.hasFlags(SCreationParams::FLAGS::CAPTURE_INTERNAL_REPRESENTATIONS));
19+
}
1620

1721
inline const void* getNativeHandle() const override {return &m_vkPipeline;}
1822

1923
inline VkPipeline getInternalObject() const {return m_vkPipeline;}
2024

21-
void populateExecutableInfo(bool includeInternalRepresentations);
25+
void populateExecutableInfo(bool includeInternalRepresentations) override;
2226

2327
private:
2428
~CVulkanGraphicsPipeline();

src/nbl/video/CVulkanLogicalDevice.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,12 +1193,6 @@ void CVulkanLogicalDevice::createComputePipelines_impl(
11931193
auto pipeline = core::make_smart_refctd_ptr<CVulkanComputePipeline>(
11941194
info,vk_pipeline
11951195
);
1196-
if (info.flags.hasFlags(IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_STATISTICS))
1197-
{
1198-
pipeline->populateExecutableInfo(info.flags.hasFlags(IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_INTERNAL_REPRESENTATIONS));
1199-
if (pipeline->getExecutableInfo().empty())
1200-
m_logger.log("Driver returned 0 executables for pipeline created with CAPTURE_STATISTICS flag. This pipeline type may not be supported by the driver's VK_KHR_pipeline_executable_properties implementation.", system::ILogger::ELL_WARNING);
1201-
}
12021196
output[i] = std::move(pipeline);
12031197
debugNameBuilder.str("");
12041198
const auto& specInfo = createInfos[i].shader;
@@ -1454,12 +1448,6 @@ void CVulkanLogicalDevice::createGraphicsPipelines_impl(
14541448
// break the lifetime cause of the aliasing
14551449
std::uninitialized_default_construct_n(output+i,1);
14561450
auto pipeline = core::make_smart_refctd_ptr<CVulkanGraphicsPipeline>(createInfos[i],vk_pipeline);
1457-
if (createInfo.flags.hasFlags(IGPUGraphicsPipeline::SCreationParams::FLAGS::CAPTURE_STATISTICS))
1458-
{
1459-
pipeline->populateExecutableInfo(createInfo.flags.hasFlags(IGPUGraphicsPipeline::SCreationParams::FLAGS::CAPTURE_INTERNAL_REPRESENTATIONS));
1460-
if (pipeline->getExecutableInfo().empty())
1461-
m_logger.log("Driver returned 0 executables for pipeline created with CAPTURE_STATISTICS flag. This pipeline type may not be supported by the driver's VK_KHR_pipeline_executable_properties implementation.", system::ILogger::ELL_WARNING);
1462-
}
14631451
output[i] = std::move(pipeline);
14641452
debugNameBuilder.str("");
14651453
auto buildDebugName = [&](const IGPUPipelineBase::SShaderSpecInfo& spec, hlsl::ShaderStage stage)
@@ -1671,12 +1659,6 @@ void CVulkanLogicalDevice::createRayTracingPipelines_impl(
16711659
std::move(shaderGroupHandles)
16721660
);
16731661

1674-
if (info.cached.flags.hasFlags(IGPURayTracingPipeline::SCreationParams::FLAGS::CAPTURE_STATISTICS))
1675-
{
1676-
pipeline->populateExecutableInfo(info.cached.flags.hasFlags(IGPURayTracingPipeline::SCreationParams::FLAGS::CAPTURE_INTERNAL_REPRESENTATIONS));
1677-
if (pipeline->getExecutableInfo().empty())
1678-
m_logger.log("Driver returned 0 executables for pipeline created with CAPTURE_STATISTICS flag. This pipeline type may not be supported by the driver's VK_KHR_pipeline_executable_properties implementation.", system::ILogger::ELL_WARNING);
1679-
}
16801662
output[i] = std::move(pipeline);
16811663
}
16821664
}

src/nbl/video/CVulkanRayTracingPipeline.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,14 @@ namespace nbl::video
6565
for (size_t shaderGroupIx = 0; shaderGroupIx < params.shaderGroups.callables.size(); shaderGroupIx++)
6666
{
6767
m_callableStackSizes->operator[](shaderGroupIx) = getVkShaderGroupStackSize(
68-
getCallableBaseIndex(),
69-
shaderGroupIx,
68+
getCallableBaseIndex(),
69+
shaderGroupIx,
7070
params.shaderGroups.callables[shaderGroupIx].shader,
7171
VK_SHADER_GROUP_SHADER_GENERAL_KHR);
7272
}
73+
74+
if (params.cached.flags.hasFlags(SCreationParams::FLAGS::CAPTURE_STATISTICS))
75+
populateExecutableInfo(params.cached.flags.hasFlags(SCreationParams::FLAGS::CAPTURE_INTERNAL_REPRESENTATIONS));
7376
}
7477

7578
CVulkanRayTracingPipeline::~CVulkanRayTracingPipeline()

src/nbl/video/ILogicalDevice.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,11 @@ bool ILogicalDevice::createComputePipelines(IGPUPipelineCache* const pipelineCac
826826
retval = false;
827827
}
828828
else
829+
{
829830
output[i]->setObjectDebugName(params[i].shader.shader->getFilepathHint().c_str());
831+
if (params[i].flags.hasFlags(IGPUComputePipeline::SCreationParams::FLAGS::CAPTURE_STATISTICS) && output[i]->getExecutableInfo().empty())
832+
NBL_LOG(system::ILogger::ELL_WARNING, "Driver returned 0 executables for pipeline created with CAPTURE_STATISTICS flag. This pipeline type may not be supported by the driver's VK_KHR_pipeline_executable_properties implementation. (params[%u])", i);
833+
}
830834
}
831835
return retval;
832836
}
@@ -994,7 +998,9 @@ bool ILogicalDevice::createGraphicsPipelines(
994998
}
995999
else
9961000
{
997-
// TODO: set pipeline debug name thats a concatenation of all active stages' shader file path hints
1001+
// TODO: set pipeline debug name thats a concatenation of all active stages' shader file path hints
1002+
if (params[i].flags.hasFlags(IGPUGraphicsPipeline::SCreationParams::FLAGS::CAPTURE_STATISTICS) && output[i]->getExecutableInfo().empty())
1003+
NBL_LOG(system::ILogger::ELL_WARNING, "Driver returned 0 executables for pipeline created with CAPTURE_STATISTICS flag. This pipeline type may not be supported by the driver's VK_KHR_pipeline_executable_properties implementation. (params[%u])", i);
9981004
}
9991005
}
10001006
return true;
@@ -1144,6 +1150,8 @@ bool ILogicalDevice::createRayTracingPipelines(IGPUPipelineCache* const pipeline
11441150
NBL_LOG_ERROR("RayTracingPipeline was not created (params[%u])", i);
11451151
return false;
11461152
}
1153+
else if (params[i].getFlags().hasFlags(IGPURayTracingPipeline::SCreationParams::FLAGS::CAPTURE_STATISTICS) && output[i]->getExecutableInfo().empty())
1154+
NBL_LOG(system::ILogger::ELL_WARNING, "Driver returned 0 executables for pipeline created with CAPTURE_STATISTICS flag. This pipeline type may not be supported by the driver's VK_KHR_pipeline_executable_properties implementation. (params[%u])", i);
11471155
}
11481156
return retval;
11491157
}

0 commit comments

Comments
 (0)