Input Attachments - reading random location? Read/Write in same pass?

Hey!

Sooo, basically I have two related questions:

I was wondering how I can read from a random position on an input attachment inside the fragment shader?

I have following Input Attachment:

layout (input_attachment_index = 1, set = 0, binding = 1) uniform subpassInput colAttachment;

And I can read the current position perfectly fine with:

someColor = subpassLoad(colAttachment);

Everything works fine.

But is there a way I can read a random location from the attachment? I tried texelFetch, but it is only giving me errors on compile.

My other question is, is it possible to use a single color attachment as both an input (as above) and as an output?
Specifically I’m trying to do some post-processing that requires me to sample a small area around a pixel (blurring).

I was wondering how I can read from a random position on an input attachment inside the fragment shader?

No. That’s why subpassLoad doesn’t take a texture coordinate.

My other question is, is it possible to use a single color attachment as both an input (as above) and as an output?

Yes, but:

1: Only with the above limitation in mind.

2: Only once per fragment. That is, for each fragment you use input attachments with, you can only perform a single read/modify/write operation. If you want to perform a second, then you must use a pipeline barrier between the two rendering calls, and that subpass must have a self-subpass dependency.

Thanks for that!
How sad… now I must rethink my entire pipeline structure