Fix crash when a user pass declares no color attachment
A top-level RenderPass without ColorAttachment commands is supposed to
get a default color attachment, but the render target build loop
indexed the command list for every attachment it created,
asserting in debug builds and reading out of bounds in release builds.
The compatibility check had the same problem, it compared the render
target's attachment count against the command count, forcing a full
render target rebuild every frame, and would then have indexed the
empty command list when validating the attachment formats.
Amends 7d64f0b942f4535abc4d4302ed3dc7a58041563d.
Pick-to: 6.12 6.11
Change-Id: I614750dbbca9fc839038e832ee39b1599a29d0a0
Reviewed-by: Andy Nichols <andy.nichols@qt.io>