vrend: apply format swizzling during GLSL generation
If the guest is creating texture and the memory comes from buffer object by creating GL_TEXTURE_BUFFER, then host creates GL_TEXTURE_BUFFER too. No texture parameters can be set for GL_TEXTURE_BUFFER.
If there is mismatch between the guest texture format and the host texture format, for example GL_ALPHA8(guest) and GL_R8(host), then we can't apply swizzling for such textures, because no texture parameters can be set for GL_TEXTURE_BUFFER.
In such case, add manually swizzling in GLSL shader generation step.
The logic of this patch:
- Add additional fields in shader key struct
- During draw_vbo call check if "manual swizzling" is needed
- If yes, then add fields in key struct and generate shader again
- During generation of, for example, texelFetch instruction in GLSL put additional instruction for swizzling