Skip to content

Commit

Permalink
Fix Metal crash when >16 samplers are bound (google#2873)
Browse files Browse the repository at this point in the history
  • Loading branch information
bejado authored Jul 27, 2020
1 parent b0d4934 commit 2113c9a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions filament/backend/src/metal/MetalDriver.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,11 @@
enumerateSamplerGroups(program, [this, &texturesToBind, &samplersToBind](
const SamplerGroup::Sampler* sampler,
uint8_t binding) {
// We currently only support a max of SAMPLER_BINDING_COUNT samplers. Ignore any additional
// samplers that may be bound.
if (binding >= SAMPLER_BINDING_COUNT) {
return;
}
const auto metalTexture = handle_const_cast<MetalTexture>(mHandleMap, sampler->t);
texturesToBind[binding] = metalTexture->texture;

Expand Down

0 comments on commit 2113c9a

Please sign in to comment.