Skip to content

Commit f88e3f3

Browse files
committed
Add serializer for SpecializationConstant.
1 parent 12c9176 commit f88e3f3

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

Graphics/GraphicsEngine/src/PSOSerializer.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2025 Diligent Graphics LLC
2+
* Copyright 2019-2026 Diligent Graphics LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -135,8 +135,24 @@ bool PSOSerializer<Mode>::SerializeCreateInfo(
135135
return false;
136136
}
137137

138+
// Serialize specialization constants
139+
if (!Ser.SerializeArray(Allocator, CreateInfo.pSpecializationConstants, CreateInfo.NumSpecializationConstants,
140+
[](Serializer<Mode>& Ser,
141+
ConstQual<SpecializationConstant>& SpecConst) //
142+
{
143+
if (!Ser(SpecConst.Name,
144+
SpecConst.ShaderStages,
145+
SpecConst.Size))
146+
return false;
147+
148+
size_t DataSize = SpecConst.Size;
149+
return Ser.SerializeBytes(SpecConst.pData, DataSize);
150+
}))
151+
return false;
152+
138153
ASSERT_SIZEOF64(ShaderResourceVariableDesc, 16, "Did you add a new member to ShaderResourceVariableDesc? Please add serialization here.");
139-
ASSERT_SIZEOF64(PipelineStateCreateInfo, 96, "Did you add a new member to PipelineStateCreateInfo? Please add serialization here.");
154+
ASSERT_SIZEOF64(SpecializationConstant, 24, "Did you add a new member to SpecializationConstant? Please add serialization here.");
155+
ASSERT_SIZEOF64(PipelineStateCreateInfo, 112, "Did you add a new member to PipelineStateCreateInfo? Please add serialization here.");
140156

141157
return true;
142158
}

0 commit comments

Comments
 (0)