Skip intermediate shader in pass_read_image() when possible?
This should be doable when the following conditions are met:
- The source contains only one plane
- The decoding matrix is equal to an identity matrix
- There's no debanding, AV1 grain or user hooks (for this texture)
- Early HDR peak detection is not required
- The source texture has all of the properties we need for scaling
In practice I think it'd be easiest to implement this by carring some extra metadata in pass->cur_img
which carries the original texture alongside the sh
, invalidated whenever one of the operations above introduces non-trivial operations into sh
. In finalize_img
, we can check for this nontriviality property, and if false, directly re-use the existing texture. This could possibly even allow some optimizations for cases other than the intermediate FBO case described above.