23 auto seed = fml::HashCombine();
24 fml::HashCombineSeed(seed, label_);
25 fml::HashCombineSeed(seed, sample_count_);
26 for (
const auto& entry : entrypoints_) {
27 fml::HashCombineSeed(seed, entry.first);
28 if (
auto second = entry.second) {
29 fml::HashCombineSeed(seed, second->GetHash());
32 for (
const auto& des : color_attachment_descriptors_) {
33 fml::HashCombineSeed(seed, des.first);
34 fml::HashCombineSeed(seed, des.second.Hash());
36 if (vertex_descriptor_) {
37 fml::HashCombineSeed(seed, vertex_descriptor_->GetHash());
39 fml::HashCombineSeed(seed, depth_pixel_format_);
40 fml::HashCombineSeed(seed, stencil_pixel_format_);
41 fml::HashCombineSeed(seed, depth_attachment_descriptor_);
42 fml::HashCombineSeed(seed, front_stencil_attachment_descriptor_);
43 fml::HashCombineSeed(seed, back_stencil_attachment_descriptor_);
44 fml::HashCombineSeed(seed, winding_order_);
45 fml::HashCombineSeed(seed, cull_mode_);
46 fml::HashCombineSeed(seed, primitive_type_);
47 fml::HashCombineSeed(seed, polygon_mode_);
48 fml::HashCombineSeed(seed, use_subpass_input_);
54 return label_ == other.label_ && sample_count_ == other.sample_count_ &&
56 color_attachment_descriptors_ == other.color_attachment_descriptors_ &&
58 stencil_pixel_format_ == other.stencil_pixel_format_ &&
59 depth_pixel_format_ == other.depth_pixel_format_ &&
60 depth_attachment_descriptor_ == other.depth_attachment_descriptor_ &&
61 front_stencil_attachment_descriptor_ ==
62 other.front_stencil_attachment_descriptor_ &&
63 back_stencil_attachment_descriptor_ ==
64 other.back_stencil_attachment_descriptor_ &&
65 winding_order_ == other.winding_order_ &&
66 cull_mode_ == other.cull_mode_ &&
67 primitive_type_ == other.primitive_type_ &&
68 polygon_mode_ == other.polygon_mode_ &&
69 specialization_constants_ == other.specialization_constants_ &&
70 use_subpass_input_ == other.use_subpass_input_;
74 label_ = std::move(label);
79 sample_count_ = samples;
84 std::shared_ptr<const ShaderFunction>
function) {
93 entrypoints_[
function->GetStage()] = std::move(
function);
99 std::shared_ptr<VertexDescriptor> vertex_descriptor) {
100 vertex_descriptor_ = std::move(vertex_descriptor);
106 for (
const auto& color : color_attachment_descriptors_) {
107 max = std::max(color.first, max);
115 color_attachment_descriptors_[index] = desc;
120 std::map<size_t /* index */, ColorAttachmentDescriptor> descriptors) {
121 color_attachment_descriptors_ = std::move(descriptors);
127 auto found = color_attachment_descriptors_.find(index);
128 return found == color_attachment_descriptors_.end() ? nullptr
135 if (color_attachment_descriptors_.size() != 1u) {
143 depth_pixel_format_ = format;
149 stencil_pixel_format_ = format;
154 std::optional<DepthAttachmentDescriptor> desc) {
155 depth_attachment_descriptor_ = desc;
160 std::optional<StencilAttachmentDescriptor> front_and_back) {
165 std::optional<StencilAttachmentDescriptor> front,
166 std::optional<StencilAttachmentDescriptor> back) {
167 front_stencil_attachment_descriptor_ = front;
168 back_stencil_attachment_descriptor_ = back;
173 back_stencil_attachment_descriptor_.reset();
174 front_stencil_attachment_descriptor_.reset();
179 depth_attachment_descriptor_.reset();
184 if (color_attachment_descriptors_.find(index) ==
185 color_attachment_descriptors_.end()) {
189 color_attachment_descriptors_.erase(index);
193 color_attachment_descriptors_.clear();
194 depth_attachment_descriptor_.reset();
195 front_stencil_attachment_descriptor_.reset();
196 back_stencil_attachment_descriptor_.reset();
200 return stencil_pixel_format_;
203 std::optional<StencilAttachmentDescriptor>
205 return front_stencil_attachment_descriptor_;
208 std::optional<DepthAttachmentDescriptor>
210 return depth_attachment_descriptor_;
215 return color_attachment_descriptors_;
218 const std::shared_ptr<VertexDescriptor>&
220 return vertex_descriptor_;
223 const std::map<ShaderStage, std::shared_ptr<const ShaderFunction>>&
230 if (
auto found = entrypoints_.find(stage); found != entrypoints_.end()) {
231 return found->second;
241 return depth_pixel_format_;
244 std::optional<StencilAttachmentDescriptor>
246 return back_stencil_attachment_descriptor_;
250 return front_stencil_attachment_descriptor_.has_value() ||
251 back_stencil_attachment_descriptor_.has_value();
263 winding_order_ = order;
267 return winding_order_;
271 primitive_type_ = type;
275 return primitive_type_;
279 polygon_mode_ = mode;
283 return polygon_mode_;
287 std::vector<Scalar> values) {
288 specialization_constants_ = std::move(values);
293 return specialization_constants_;