CommandBuffer.Blit(source, dest, material) Source Texture is incorrect

I have a shader that I use through a command buffer to perform a screen-space operation on a Render Texture.

Previously, I was lazy and had a source render texture assigned to a global shader property. Now I’m cleaning up my code and instead of referencing the global property in the shader, I’m trying to read it through _MainTex directly. However, what I’m getting in _MainTex is not the same as the global shader property:

//////C Sharp Code Snippit
string globalSrcTexPropertyAsString = "_GlobalSrcTexture";
string globalDstTexPropertyAsString = "_GlobalDstTexture";

RenderTexture globalSrcTexture = new RenderTexture(Screen.height, Screen.height, 0, RenderTextureFormat.ARGBFloat);
RenderTexture globalDstTexture = new RenderTexture(Screen.height, Screen.height, 0, RenderTextureFormat.ARGBFloat);

globalSrcTexture.SetGlobalShaderProperty(globalSrcTexPropertyAsString);
globalDstTexture.SetGlobalShaderProperty(globalDstTexPropertyAsString);

CommandBuffer cmdBuffer = new CommandBuffer();

//Some things happen here that write to globalSrcTexture

cmdBuffer.SetRenderTarget(globalDstTexture);
effect.ClearRenderTarget(false, true, new Color(0, 0, 0, 1));
effect.Blit((Texture)globalSrcTexture, globalDstTexture, blitMaterial);


//////Shader code snippit

sampler2D_float _MainTex;

//The output of these two methods should be identical, but they're not
return tex2D(_GlobalSrcTexture, i.uv);
return tex2D(_MainTex, i.uv);

Why are the two fragment outputs in the shader not identical?

I ran into that same issue before. _MainTex doesn’t seem to get set correctly when using Blit in a CommandBuffer. Using a global does work. I think I just added:

cmdBuffer.SetGlobalTexture("_MainTex", sourceIdentifier);

Not the greatest way, but it does the trick.

Similar issue also reported here: