Skip to content

Commit 3b138e9

Browse files
fix a bug in Graphics Pipeline Creation Parameter validation of Shader Spec info
what idiot wrote that? - me!
1 parent e3c404c commit 3b138e9

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

include/nbl/asset/IGraphicsPipeline.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,30 +100,29 @@ class IGraphicsPipeline : public IPipeline<PipelineLayoutType>
100100
// TODO: check rasterization samples, etc.
101101
//rp->getCreationParameters().subpasses[i]
102102

103-
std::bitset<GRAPHICS_SHADER_STAGE_COUNT> stagePresence = {};
103+
core::bitflag<ICPUShader::E_SHADER_STAGE> stagePresence = {};
104104
for (const auto info : shaders)
105105
if (info.shader)
106106
{
107107
if (!extra(info))
108108
return false;
109109
const auto stage = info.shader->getStage();
110-
if (stage>=GRAPHICS_SHADER_STAGE_COUNT)
110+
if (stage>ICPUShader::ESS_FRAGMENT)
111111
return false;
112-
const auto stageIx = hlsl::findLSB(stage);
113-
if (stagePresence.test(stageIx))
112+
if (stagePresence.hasFlags(stage))
114113
return false;
115-
stagePresence.set(stageIx);
114+
stagePresence |= stage;
116115
}
117116
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkGraphicsPipelineCreateInfo.html#VUID-VkGraphicsPipelineCreateInfo-stage-02096
118-
if (!stagePresence.test(ICPUShader::ESS_VERTEX))
117+
if (!stagePresence.hasFlags(ICPUShader::ESS_VERTEX))
119118
return false;
120119
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkGraphicsPipelineCreateInfo.html#VUID-VkGraphicsPipelineCreateInfo-pStages-00729
121120
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkGraphicsPipelineCreateInfo.html#VUID-VkGraphicsPipelineCreateInfo-pStages-00730
122-
if (stagePresence.test(ICPUShader::ESS_TESSELLATION_CONTROL)!=stagePresence.test(ICPUShader::ESS_TESSELLATION_EVALUATION))
121+
if (stagePresence.hasFlags(ICPUShader::ESS_TESSELLATION_CONTROL)!=stagePresence.hasFlags(ICPUShader::ESS_TESSELLATION_EVALUATION))
123122
return false;
124123
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkGraphicsPipelineCreateInfo.html#VUID-VkGraphicsPipelineCreateInfo-pStages-08888
125124
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkGraphicsPipelineCreateInfo.html#VUID-VkGraphicsPipelineCreateInfo-topology-08889
126-
if (stagePresence.test(ICPUShader::ESS_TESSELLATION_EVALUATION)!=(cached.primitiveAssembly.primitiveType==EPT_PATCH_LIST))
125+
if (stagePresence.hasFlags(ICPUShader::ESS_TESSELLATION_EVALUATION)!=(cached.primitiveAssembly.primitiveType==EPT_PATCH_LIST))
127126
return false;
128127

129128
return true;

include/nbl/video/IGPUGraphicsPipeline.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ class IGPUGraphicsPipeline : public IBackendObject, public asset::IGraphicsPipel
4646
const auto dataSize = info.valid();
4747
if (dataSize<0)
4848
return false;
49+
else if (dataSize==0)
50+
return true;
51+
4952
const size_t count = info.entries ? info.entries->size():0x80000000ull;
5053
if (count>0x7fffffff)
5154
return {};

0 commit comments

Comments
 (0)