MaterialPropertyBlock Redundant Resource Binds

Hey everyone,

Currently I’m optimizing ResourceBinds for our game. However, I am baffled that apparently the MaterialPropertyBlock does redundant resource binds?

Let’s say we have this situation:
Unity 2021, DirectX 11, Legacy RP
10 Draw Calls
1 Material
1 MaterialPropertyBlock each with 1 Texture property override

Now I would expect that we have 1 ResourceBind for these textures per draw call. However, it turns out that Unity does 2 for each texture! First it binds the default UnityWhite texture to the uniform and then it binds the actual texture to the uniform. I guess it is because it doesn’t check if the texture will be overridden again beforehand but this just feels unnecessary. Yes, it is a small thing but when using this a lot it stacks.

I previously found out that if using Textures with shared samplers in shaders Unity will actually rebind this texture for every draw call with this Material. It only doesn’t do it if the texture has a unique sampler. It even does this if the sampler is a hard coded one like e.g. “sampler_linear_clamp”.
It also does this when the texture is used with .Load(uint3) instead of sampling it.

In general there are many resource binds that Unity shouldn’t call/need and I wonder why that is and if it is a bug or if there is a deeper reasoning behind it.

Would be very grateful for any answer because this is bugging me for a while now.