Skip to content

anv: Patch constant data pointers into shaders with using softpin

When we have softpin, we know the address of the shader constant data at shader upload time because it's sitting at the end of the shader. This commit changes ANV to use patch constants to embed the address in the shader patch the right address in at upload time. This allows us to avoid having to set up a UBO binding on-the-fly for shader constants.

In order to do this patching, I added a mechanism for "patch constants" into the back-end compiler. I really don't like the current implementation as it seems extremely dirty to me. A cleaner implementation would probably be to simply allow arbitrarily many load_patch_constant intrinsics and produce a list of patches that goes along with the shader binary. If the back-end is producing a list, it'd be pretty easy to handle it all within the fs_generator and not have to touch every single place it's invoked. The reason why I don't like this is because lists of things are annoying to cache in the pipeline cache. It can be done but it's painful. That said, I'm not sure the extra pain I caused by my little bitset trick is any better.

+@mattst88 @kwg @llandwerlin @cmarcelo

Edited by Faith Ekstrand

Merge request reports