But still have no idea how to pass samplers to shader
var albedo = new AttachmentDescriptor(RenderTextureFormat.ARGB32);
var depth = new AttachmentDescriptor(RenderTextureFormat.Depth);
var attachments = new NativeArray<AttachmentDescriptor>(6, Allocator.Temp);
const int depthIndex = 0, albedoIndex = 1;
attachments[depthIndex] = depth;
attachments[albedoIndex] = albedo;
context.BeginRenderPass(camera.pixelWidth, camera.pixelHeight, 1, attachments, depthIndex);
...
var lightingInputs = new NativeArray<int>(1, Allocator.Temp);
lightingInputs[0] = albedoIndex;
context.BeginSubPass(cameraOut, lightingInputs, true);
// shader have no data
How to pass albedo AttachmentDescriptor into shader? Should i resolve it into other RT, or is there another way?
albedo.loadStoreTarget is supposed for that use like
buffer.SetGlobalTexture(“GBuffer0”, albedo.loadStoreTarget);
?
If you use mobile tile-based GPU with Vulkan or Metal API, you can sample from cbuffer hlslcc_SubpassInput_f_##idx { float4 hlslcc_fbinput_##idx; }. Otherwise, you must fall back to load from TEXTURE2D_FLOAT(_UnityFBInput##idx). Latast SRP may have the LOAD_FRAMEBUFFER_INPUT macro for that.
The way to output to the on-tile buffer is same as regular MRT.
SAMPLER(sampler_UnityFBInput0);
TEXTURE2D_FLOAT(_UnityFBInput1);
SAMPLER(sampler_UnityFBInput1);
TEXTURE2D_FLOAT(_UnityFBInput2);
SAMPLER(sampler_UnityFBInput2);
TEXTURE2D_FLOAT(_UnityFBInput3);
SAMPLER(sampler_UnityFBInput3);```
But shader decompiler shows that bindings start from 4
```-- Vertex shader for "vulkan":
Set 2D Texture "_UnityFBInput0" to set: 0, binding: 4, used in: Fragment using sampler in set: 0, binding: 0, used in: Fragment
Set 2D Texture "_UnityFBInput1" to set: 0, binding: 5, used in: Fragment using sampler in set: 0, binding: 1, used in: Fragment
Set 2D Texture "_UnityFBInput2" to set: 0, binding: 6, used in: Fragment using sampler in set: 0, binding: 2, used in: Fragment
Set 2D Texture "_UnityFBInput3" to set: 0, binding: 7, used in: Fragment using sampler in set: 0, binding: 3, used in: Fragment```