Skip to content

Commit 22e86a7

Browse files
author
devsh
committed
fix for MSVC 17.12.0 regression in handling partial specs constrained by requires and concepts
1 parent 72f847d commit 22e86a7

File tree

2 files changed

+58
-13
lines changed

2 files changed

+58
-13
lines changed

src/nbl/video/utilities/CAssetConverter.cpp

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,13 +1500,59 @@ class GetDependantVisit<ICPUPipelineLayout> : public GetDependantVisitBase<ICPUP
15001500
return true;
15011501
}
15021502
};
1503-
template<Asset AssetT> requires nbl::is_any_of_v<AssetT,ICPUComputePipeline,ICPUGraphicsPipeline>
1504-
class GetDependantVisit<AssetT> : public GetDependantVisitBase<AssetT>
1503+
template<>
1504+
class GetDependantVisit<ICPUComputePipeline> : public GetDependantVisitBase<ICPUComputePipeline>
15051505
{
1506-
using base_t = GetDependantVisitBase<AssetT>;
1506+
public:
1507+
// using AssetType = ICPUComputePipeline;
1508+
1509+
inline auto& getSpecInfo(const IShader::E_SHADER_STAGE stage)
1510+
{
1511+
assert(hlsl::bitCount(stage)==1);
1512+
return specInfo[hlsl::findLSB(stage)];
1513+
}
1514+
1515+
// ok to do non owning since some cache owns anyway
1516+
IGPUPipelineLayout* layout = nullptr;
1517+
// has to be public to allow for initializer list constructor
1518+
std::array<IGPUShader::SSpecInfo,/*hlsl::mpl::findMSB<ESS_COUNT>::value*/sizeof(IShader::E_SHADER_STAGE)*8> specInfo = {};
15071519

1520+
protected:
1521+
bool descend_impl(
1522+
const instance_t<ICPUComputePipeline>& user, const CAssetConverter::patch_t<ICPUComputePipeline>& userPatch,
1523+
const instance_t<ICPUPipelineLayout>& dep, const CAssetConverter::patch_t<ICPUPipelineLayout>& soloPatch
1524+
)
1525+
{
1526+
auto depObj = getDependant<ICPUPipelineLayout>(dep,soloPatch);
1527+
if (!depObj)
1528+
return false;
1529+
layout = depObj.get();
1530+
return true;
1531+
}
1532+
bool descend_impl(
1533+
const instance_t<ICPUComputePipeline>& user, const CAssetConverter::patch_t<ICPUComputePipeline>& userPatch,
1534+
const instance_t<ICPUShader>& dep, const CAssetConverter::patch_t<ICPUShader>& soloPatch,
1535+
const IShader::E_SHADER_STAGE stage, const IShader::SSpecInfo<const ICPUShader>& inSpecInfo
1536+
)
1537+
{
1538+
auto depObj = getDependant<ICPUShader>(dep,soloPatch);
1539+
if (!depObj)
1540+
return false;
1541+
getSpecInfo(stage) = {
1542+
.entryPoint = inSpecInfo.entryPoint,
1543+
.shader = depObj.get(),
1544+
.entries = inSpecInfo.entries,
1545+
.requiredSubgroupSize = inSpecInfo.requiredSubgroupSize,
1546+
.requireFullSubgroups = inSpecInfo.requireFullSubgroups
1547+
};
1548+
return true;
1549+
}
1550+
};
1551+
template<>
1552+
class GetDependantVisit<ICPUGraphicsPipeline> : public GetDependantVisitBase<ICPUGraphicsPipeline>
1553+
{
15081554
public:
1509-
using AssetType = AssetT;
1555+
// using AssetType = ICPUGraphicsPipeline;
15101556

15111557
inline auto& getSpecInfo(const IShader::E_SHADER_STAGE stage)
15121558
{
@@ -1523,41 +1569,40 @@ class GetDependantVisit<AssetT> : public GetDependantVisitBase<AssetT>
15231569

15241570
protected:
15251571
bool descend_impl(
1526-
const instance_t<AssetType>& user, const CAssetConverter::patch_t<AssetType>& userPatch,
1572+
const instance_t<ICPUGraphicsPipeline>& user, const CAssetConverter::patch_t<ICPUGraphicsPipeline>& userPatch,
15271573
const instance_t<ICPUPipelineLayout>& dep, const CAssetConverter::patch_t<ICPUPipelineLayout>& soloPatch
15281574
)
15291575
{
1530-
auto depObj = base_t::getDependant<ICPUPipelineLayout>(dep,soloPatch);
1576+
auto depObj = getDependant<ICPUPipelineLayout>(dep,soloPatch);
15311577
if (!depObj)
15321578
return false;
15331579
layout = depObj.get();
15341580
return true;
15351581
}
15361582
bool descend_impl(
1537-
const instance_t<AssetType>& user, const CAssetConverter::patch_t<AssetType>& userPatch,
1583+
const instance_t<ICPUGraphicsPipeline>& user, const CAssetConverter::patch_t<ICPUGraphicsPipeline>& userPatch,
15381584
const instance_t<ICPUShader>& dep, const CAssetConverter::patch_t<ICPUShader>& soloPatch,
15391585
const IShader::E_SHADER_STAGE stage, const IShader::SSpecInfo<const ICPUShader>& inSpecInfo
15401586
)
15411587
{
1542-
auto depObj = base_t::getDependant<ICPUShader>(dep,soloPatch);
1588+
auto depObj = getDependant<ICPUShader>(dep,soloPatch);
15431589
if (!depObj)
15441590
return false;
15451591
getSpecInfo(stage) = {
15461592
.entryPoint = inSpecInfo.entryPoint,
15471593
.shader = depObj.get(),
15481594
.entries = inSpecInfo.entries,
15491595
.requiredSubgroupSize = inSpecInfo.requiredSubgroupSize,
1550-
.requireFullSubgroups = stage==IShader::E_SHADER_STAGE::ESS_COMPUTE ? inSpecInfo.requireFullSubgroups:uint8_t(0)
1596+
.requireFullSubgroups = 0
15511597
};
15521598
return true;
15531599
}
1554-
template<Asset T=AssetType> requires (std::is_same_v<T,AssetType>&& std::is_same_v<T,ICPUGraphicsPipeline>)
15551600
bool descend_impl(
1556-
const instance_t<T>& user, const CAssetConverter::patch_t<T>& userPatch,
1601+
const instance_t<ICPUGraphicsPipeline>& user, const CAssetConverter::patch_t<ICPUGraphicsPipeline>& userPatch,
15571602
const instance_t<ICPURenderpass>& dep, const CAssetConverter::patch_t<ICPURenderpass>& soloPatch
15581603
)
15591604
{
1560-
auto depObj = base_t::getDependant<ICPURenderpass>(dep,soloPatch);
1605+
auto depObj = getDependant<ICPURenderpass>(dep,soloPatch);
15611606
if (!depObj)
15621607
return false;
15631608
renderpass = depObj.get();

0 commit comments

Comments
 (0)