Reduce texture sampler state changes in Metal (#3236)
This commit is contained in:
@@ -21,6 +21,11 @@ Texture2D::~Texture2D() {
|
||||
}
|
||||
|
||||
gfx::Texture2D& Texture2D::setSamplerConfiguration(const SamplerState& samplerState_) noexcept {
|
||||
if (samplerState.filter == samplerState_.filter && samplerState.wrapU == samplerState_.wrapU &&
|
||||
samplerState.wrapV == samplerState_.wrapV) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
samplerState = samplerState_;
|
||||
samplerStateDirty = true;
|
||||
return *this;
|
||||
@@ -216,6 +221,8 @@ void Texture2D::updateSamplerConfiguration() noexcept {
|
||||
? MTL::SamplerAddressModeClampToEdge
|
||||
: MTL::SamplerAddressModeRepeat);
|
||||
metalSamplerState = context.createMetalSamplerState(samplerDescriptor);
|
||||
|
||||
samplerStateDirty = false;
|
||||
}
|
||||
|
||||
void Texture2D::bind(RenderPass& renderPass, int32_t location) noexcept {
|
||||
|
||||
Reference in New Issue
Block a user