Skip to content

Commit 2d65b85

Browse files
Improve inline constants resource description validation (#672)
1 parent d8ddfb7 commit 2d65b85

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

Graphics/GraphicsEngine/src/PipelineResourceSignatureBase.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,24 @@ void ValidatePipelineResourceSignatureDesc(const PipelineResourceSignatureDesc&
111111
": ", GetPipelineResourceFlagsString(AllowedResourceFlags, false, ", "), ".");
112112
}
113113

114-
if ((Res.Flags & PIPELINE_RESOURCE_FLAG_INLINE_CONSTANTS) != 0 && Res.Flags != PIPELINE_RESOURCE_FLAG_INLINE_CONSTANTS)
114+
if ((Res.Flags & PIPELINE_RESOURCE_FLAG_INLINE_CONSTANTS) != 0)
115115
{
116-
LOG_PRS_ERROR_AND_THROW("Incorrect Desc.Resources[", i, "].Flags (", GetPipelineResourceFlagsString(Res.Flags),
117-
"). INLINE_CONSTANTS flag cannot be combined with other flags.");
116+
if (Res.Flags != PIPELINE_RESOURCE_FLAG_INLINE_CONSTANTS)
117+
{
118+
LOG_PRS_ERROR_AND_THROW("Incorrect Desc.Resources[", i, "].Flags (", GetPipelineResourceFlagsString(Res.Flags),
119+
"). INLINE_CONSTANTS flag cannot be combined with other flags.");
120+
}
121+
122+
if (Res.ArraySize == 0)
123+
{
124+
LOG_PRS_ERROR_AND_THROW("Desc.Resources[", i, "].ArraySize must be greater than 0 for inline constants.");
125+
}
126+
127+
if (Res.ArraySize > 64)
128+
{
129+
LOG_PRS_ERROR_AND_THROW("Desc.Resources[", i, "].ArraySize (", Res.ArraySize,
130+
") exceeds the maximum allowed value (64) for inline constants.");
131+
}
118132
}
119133

120134
if ((Res.Flags & PIPELINE_RESOURCE_FLAG_FORMATTED_BUFFER) != 0 && Features.FormattedBuffers == DEVICE_FEATURE_STATE_DISABLED)

0 commit comments

Comments
 (0)