[Impeller] Disable compute for Vulkan. (flutter/engine#49463)
This code is missing correct barriers which cannot be specified at the HAL level, see https://github.com/flutter/flutter/issues/140798
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include "impeller/geometry/color.h"
|
||||
#include "impeller/geometry/geometry_asserts.h"
|
||||
#include "impeller/geometry/path_builder.h"
|
||||
#include "impeller/geometry/point.h"
|
||||
#include "impeller/geometry/sigma.h"
|
||||
#include "impeller/geometry/vector.h"
|
||||
#include "impeller/playground/playground.h"
|
||||
@@ -2426,6 +2427,11 @@ TEST_P(EntityTest, PointFieldGeometryCoverage) {
|
||||
Rect::MakeLTRB(35, 15, 135, 205));
|
||||
}
|
||||
|
||||
TEST_P(EntityTest, PointFieldCanUseCompute) {
|
||||
EXPECT_EQ(PointFieldGeometry::CanUseCompute(*GetContentContext()),
|
||||
GetContext()->GetBackendType() == Context::BackendType::kMetal);
|
||||
}
|
||||
|
||||
TEST_P(EntityTest, ColorFilterContentsWithLargeGeometry) {
|
||||
Entity entity;
|
||||
entity.SetTransform(Matrix::MakeScale(GetContentScale()));
|
||||
|
||||
@@ -18,7 +18,7 @@ GeometryResult PointFieldGeometry::GetPositionBuffer(
|
||||
const ContentContext& renderer,
|
||||
const Entity& entity,
|
||||
RenderPass& pass) const {
|
||||
if (renderer.GetDeviceCapabilities().SupportsCompute()) {
|
||||
if (CanUseCompute(renderer)) {
|
||||
return GetPositionBufferGPU(renderer, entity, pass);
|
||||
}
|
||||
auto vtx_builder = GetPositionBufferCPU(renderer, entity, pass);
|
||||
@@ -42,7 +42,7 @@ GeometryResult PointFieldGeometry::GetPositionUVBuffer(
|
||||
const ContentContext& renderer,
|
||||
const Entity& entity,
|
||||
RenderPass& pass) const {
|
||||
if (renderer.GetDeviceCapabilities().SupportsCompute()) {
|
||||
if (CanUseCompute(renderer)) {
|
||||
return GetPositionBufferGPU(renderer, entity, pass, texture_coverage,
|
||||
effect_transform);
|
||||
}
|
||||
@@ -275,6 +275,14 @@ GeometryVertexType PointFieldGeometry::GetVertexType() const {
|
||||
return GeometryVertexType::kPosition;
|
||||
}
|
||||
|
||||
// Compute is disabled for Vulkan because the barriers are incorrect, see
|
||||
// also: https://github.com/flutter/flutter/issues/140798 .
|
||||
bool PointFieldGeometry::CanUseCompute(const ContentContext& renderer) {
|
||||
return renderer.GetDeviceCapabilities().SupportsCompute() &&
|
||||
renderer.GetContext()->GetBackendType() ==
|
||||
Context::BackendType::kMetal;
|
||||
}
|
||||
|
||||
// |Geometry|
|
||||
std::optional<Rect> PointFieldGeometry::GetCoverage(
|
||||
const Matrix& transform) const {
|
||||
|
||||
@@ -17,6 +17,9 @@ class PointFieldGeometry final : public Geometry {
|
||||
|
||||
static size_t ComputeCircleDivisions(Scalar scaled_radius, bool round);
|
||||
|
||||
/// If the platform can use compute safely.
|
||||
static bool CanUseCompute(const ContentContext& renderer);
|
||||
|
||||
private:
|
||||
// |Geometry|
|
||||
GeometryResult GetPositionBuffer(const ContentContext& renderer,
|
||||
|
||||
Reference in New Issue
Block a user