Skip to content

Commit

Permalink
igl | metal | Fix null pointer dereference in `RenderCommandEncoder::…
Browse files Browse the repository at this point in the history
…bindSamplerState()` (facebook#203)

Summary: Pull Request resolved: facebook#203

Reviewed By: dmannemela, syeh1

Differential Revision: D65838643

Pulled By: corporateshark

fbshipit-source-id: 95871d6fa0916533158455bf2ebb4aacabb2142d
  • Loading branch information
vinsentli authored and facebook-github-bot committed Nov 13, 2024
1 parent 958b362 commit 2e0077e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/igl/metal/RenderCommandEncoder.mm
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,14 @@
"Bind target is not valid: %d",
bindTarget);

auto* metalSamplerState = static_cast<SamplerState*>(samplerState);
auto* iglSamplerState = static_cast<SamplerState*>(samplerState);
auto metalSamplerState = iglSamplerState ? iglSamplerState->get() : nil;

if ((bindTarget & BindTarget::kVertex) != 0) {
[encoder_ setVertexSamplerState:metalSamplerState->get() atIndex:index];
[encoder_ setVertexSamplerState:metalSamplerState atIndex:index];
}
if ((bindTarget & BindTarget::kFragment) != 0) {
[encoder_ setFragmentSamplerState:metalSamplerState->get() atIndex:index];
[encoder_ setFragmentSamplerState:metalSamplerState atIndex:index];
}
}

Expand Down

0 comments on commit 2e0077e

Please sign in to comment.