11#include <Metal/Metal.hpp>
33 void clearCached(MTL::RenderCommandEncoder* encoder,
int slot);
36 void bindSamplerCached(MTL::RenderCommandEncoder* encoder, MTL::SamplerState* sampler);
41 const std::vector<TextureSlot>& textureSlots);
54 const std::array<Texture*, 8>& quadBindings);
71 std::array<Texture*, kMaxTextureSlots> _boundTextures{};
73 MTL::SamplerState* _boundSampler =
nullptr;
void bindSamplerCached(MTL::RenderCommandEncoder *encoder, MTL::SamplerState *sampler)
Bind a sampler at slot 0, skipping if already bound.
void bindSceneTextures(MTL::RenderCommandEncoder *encoder, Texture *envAtlas, Texture *shadow, Texture *sceneDepth, Texture *skyboxCubeMap, Texture *reflection=nullptr, Texture *reflectionDepth=nullptr, Texture *ssao=nullptr)
Bind scene-global textures (envAtlas, shadow, sceneDepth, skybox cubemap, reflection,...
void resetPassState()
Reset all cached state. Must be called at the start of each render pass.
void clearCached(MTL::RenderCommandEncoder *encoder, int slot)
Clear (unbind) a texture slot, skipping if already nullptr.
void bindCached(MTL::RenderCommandEncoder *encoder, int slot, Texture *texture)
Bind a texture at the given fragment slot, skipping if already bound.
void clearAllMaterialSlots(MTL::RenderCommandEncoder *encoder)
Clear all 8 texture slots (used when no material is bound).
void markClean()
Mark the cache as clean after the first draw in a pass.
void bindOmniShadowTextures(MTL::RenderCommandEncoder *encoder, Texture *cube0, Texture *cube1)
Bind omni shadow cubemap depth textures at slots 15 and 16 (point lights, cube).
void bindLocalShadowTextures(MTL::RenderCommandEncoder *encoder, Texture *shadow0, Texture *shadow1)
Bind local shadow depth textures at slots 11 and 12 (spot lights, 2D).
void bindMaterialTextures(MTL::RenderCommandEncoder *encoder, const std::vector< TextureSlot > &textureSlots)
void bindQuadTextures(MTL::RenderCommandEncoder *encoder, const std::array< Texture *, 8 > &quadBindings)
Bind quad render textures for all 8 slots.
static constexpr int kMaxTextureSlots
GPU texture resource supporting 2D, cubemap, volume, and array formats with mipmap management.