Skip to content

Commit

Permalink
igl | metal | Add debug name for SamplerState & DepthStencilState (#209)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: #209

Reviewed By: syeh1, tgoulart, KyleFung, mmaurer

Differential Revision: D66250301

Pulled By: corporateshark

fbshipit-source-id: 4350dc0c4f584620b332633f75a0261d0e50413e
  • Loading branch information
vinsentli authored and facebook-github-bot committed Nov 20, 2024
1 parent f3f2141 commit a4da488
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/igl/DepthStencilState.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ struct StencilStateDesc {
* the front and back face of polygons.
*/
struct DepthStencilStateDesc {
/**
* @brief Identifier used for debugging
*/
std::string debugName;

/**
* @brief The comparison operation to use for depth testing.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/igl/metal/Device.mm
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
const DepthStencilStateDesc& desc,
Result* outResult) const {
MTLDepthStencilDescriptor* metalDesc = [MTLDepthStencilDescriptor new];

metalDesc.label = [NSString stringWithUTF8String:desc.debugName.c_str()];
metalDesc.depthCompareFunction = DepthStencilState::convertCompareFunction(desc.compareFunction);
metalDesc.depthWriteEnabled = desc.isDepthWriteEnabled;
metalDesc.frontFaceStencil = DepthStencilState::convertStencilDescriptor(desc.frontFaceStencil);
Expand Down
1 change: 1 addition & 0 deletions src/igl/metal/PlatformDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
std::shared_ptr<SamplerState> PlatformDevice::createSamplerState(const SamplerStateDesc& desc,
Result* outResult) const {
MTLSamplerDescriptor* metalDesc = [MTLSamplerDescriptor new];
metalDesc.label = [NSString stringWithUTF8String:desc.debugName.c_str()];
metalDesc.minFilter = SamplerState::convertMinMagFilter(desc.minFilter);
metalDesc.magFilter = SamplerState::convertMinMagFilter(desc.magFilter);
metalDesc.mipFilter = SamplerState::convertMipFilter(desc.mipFilter);
Expand Down

0 comments on commit a4da488

Please sign in to comment.