add functionality to metal render pass to cache winding order and cull mode (#3566)

This commit is contained in:
yousifd
2025-06-24 16:38:27 +03:00
committed by GitHub
parent 282735772b
commit 3e62496d80
4 changed files with 28 additions and 11 deletions

View File

@@ -5,6 +5,7 @@
#include <Foundation/NSSharedPtr.hpp>
#include <Metal/MTLCommandEncoder.hpp>
#include <Metal/Metal.hpp>
#include <memory>
#include <optional>
@@ -56,6 +57,9 @@ public:
void bindFragment(const BufferResource&, std::size_t offset, std::size_t index, std::size_t size = 0);
void unbindFragment(std::size_t index);
void setCullMode(const MTL::CullMode);
void setFrontFacingWinding(const MTL::Winding);
private:
void pushDebugGroup(const char* name) override;
void popDebugGroup() override;
@@ -80,6 +84,9 @@ private:
std::array<MTLTexturePtr, maxBinds> fragmentTextureBindings;
std::array<MTLSamplerStatePtr, maxBinds> fragmentSamplerStates;
MTL::CullMode currentCullMode = MTL::CullModeNone;
MTL::Winding currentWinding = MTL::WindingClockwise;
};
} // namespace mtl