Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit e58ebef

Browse files
authored
[Impeller] Add validation forbidding SamplerAddressMode::kDecal on the OpenGLES backend (#43094)
Fixes uncontrolled crash when kDecal is used (as seen on #43087).
1 parent 7f311ef commit e58ebef

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

impeller/renderer/backend/gles/context_gles.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ ContextGLES::ContextGLES(std::unique_ptr<ProcTableGLES> gl,
7575
.SetSupportsComputeSubgroups(false)
7676
.SetSupportsReadFromResolve(false)
7777
.SetSupportsReadFromOnscreenTexture(false)
78+
.SetSupportsDecalTileMode(false)
7879
.Build();
7980
}
8081

impeller/renderer/backend/gles/sampler_library_gles.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include "impeller/renderer/backend/gles/sampler_library_gles.h"
66

77
#include "impeller/base/config.h"
8+
#include "impeller/base/validation.h"
9+
#include "impeller/core/formats.h"
810
#include "impeller/renderer/backend/gles/sampler_gles.h"
911

1012
namespace impeller {
@@ -17,6 +19,17 @@ SamplerLibraryGLES::~SamplerLibraryGLES() = default;
1719
// |SamplerLibrary|
1820
std::shared_ptr<const Sampler> SamplerLibraryGLES::GetSampler(
1921
SamplerDescriptor descriptor) {
22+
// TODO(bdero): Change this validation once optional support for kDecal is
23+
// added to the OpenGLES backend:
24+
// https://github.com/flutter/flutter/issues/129358
25+
if (descriptor.width_address_mode == SamplerAddressMode::kDecal ||
26+
descriptor.height_address_mode == SamplerAddressMode::kDecal ||
27+
descriptor.depth_address_mode == SamplerAddressMode::kDecal) {
28+
VALIDATION_LOG << "SamplerAddressMode::kDecal is not supported by the "
29+
"OpenGLES backend.";
30+
return nullptr;
31+
}
32+
2033
auto found = samplers_.find(descriptor);
2134
if (found != samplers_.end()) {
2235
return found->second;

0 commit comments

Comments
 (0)