[Impeller] Include the new primitive type in the pipeline hash (flutter/engine#37546)
* Include the new primitive type in the pipeline hash * Add test
This commit is contained in:
@@ -1526,6 +1526,7 @@ FILE: ../../../flutter/impeller/renderer/pipeline_builder.cc
|
||||
FILE: ../../../flutter/impeller/renderer/pipeline_builder.h
|
||||
FILE: ../../../flutter/impeller/renderer/pipeline_descriptor.cc
|
||||
FILE: ../../../flutter/impeller/renderer/pipeline_descriptor.h
|
||||
FILE: ../../../flutter/impeller/renderer/pipeline_descriptor_unittests.cc
|
||||
FILE: ../../../flutter/impeller/renderer/pipeline_library.cc
|
||||
FILE: ../../../flutter/impeller/renderer/pipeline_library.h
|
||||
FILE: ../../../flutter/impeller/renderer/platform.cc
|
||||
|
||||
@@ -106,6 +106,7 @@ impeller_component("renderer_unittests") {
|
||||
sources = [
|
||||
"device_buffer_unittests.cc",
|
||||
"host_buffer_unittests.cc",
|
||||
"pipeline_descriptor_unittests.cc",
|
||||
"renderer_unittests.cc",
|
||||
]
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ std::size_t PipelineDescriptor::GetHash() const {
|
||||
fml::HashCombineSeed(seed, back_stencil_attachment_descriptor_);
|
||||
fml::HashCombineSeed(seed, winding_order_);
|
||||
fml::HashCombineSeed(seed, cull_mode_);
|
||||
fml::HashCombineSeed(seed, primitive_type_);
|
||||
return seed;
|
||||
}
|
||||
|
||||
@@ -57,7 +58,8 @@ bool PipelineDescriptor::IsEqual(const PipelineDescriptor& other) const {
|
||||
back_stencil_attachment_descriptor_ ==
|
||||
other.back_stencil_attachment_descriptor_ &&
|
||||
winding_order_ == other.winding_order_ &&
|
||||
cull_mode_ == other.cull_mode_;
|
||||
cull_mode_ == other.cull_mode_ &&
|
||||
primitive_type_ == other.primitive_type_;
|
||||
}
|
||||
|
||||
PipelineDescriptor& PipelineDescriptor::SetLabel(std::string label) {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
#include "flutter/testing/testing.h"
|
||||
#include "impeller/renderer/pipeline_descriptor.h"
|
||||
|
||||
namespace impeller {
|
||||
namespace testing {
|
||||
|
||||
TEST(PipelineDescriptorTest, PrimitiveTypeHashEquality) {
|
||||
PipelineDescriptor descA;
|
||||
PipelineDescriptor descB;
|
||||
|
||||
ASSERT_TRUE(descA.IsEqual(descB));
|
||||
ASSERT_EQ(descA.GetHash(), descB.GetHash());
|
||||
|
||||
descA.SetPrimitiveType(PrimitiveType::kTriangleStrip);
|
||||
|
||||
ASSERT_FALSE(descA.IsEqual(descB));
|
||||
ASSERT_NE(descA.GetHash(), descB.GetHash());
|
||||
}
|
||||
|
||||
} // namespace testing
|
||||
} // namespace impeller
|
||||
Reference in New Issue
Block a user