panvk: Scrape noperspective varyings out of the FS first
We want to flip the order in which we compile shaders and go in pipeline stage order. In order to do that and continue to bake in noperspective varyings, we need to scrape them out of the FS as a separate step. Fortunately, that's now easy and safe to do. Reviewed-by: Lorenzo Rossi <lorenzo.rossi@collabora.com> Acked-by: Eric R. Smith <eric.smith@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38681>
This commit is contained in:
parent
78da1e4249
commit
6f11a4028f
1 changed files with 11 additions and 13 deletions
|
|
@ -1508,11 +1508,21 @@ compile_shaders(struct vk_device *vk_dev, uint32_t shader_count,
|
|||
VkResult result;
|
||||
int32_t i;
|
||||
|
||||
/* If we are linking VS and FS, we can use the static interpolation
|
||||
* qualifiers from the FS in the VS. Vulkan runtime passes us shaders in
|
||||
* stage order, so the FS will always be last if it exists.
|
||||
*/
|
||||
if (infos[shader_count - 1].nir->info.stage == MESA_SHADER_FRAGMENT) {
|
||||
nir_shader *nir = infos[shader_count - 1].nir;
|
||||
noperspective_varyings = pan_nir_collect_noperspective_varyings_fs(nir);
|
||||
use_static_noperspective = true;
|
||||
}
|
||||
|
||||
/* Vulkan runtime passes us shaders in stage order, so the FS will always
|
||||
* be last if it exists. Iterate shaders in reverse order to ensure FS is
|
||||
* processed before VS. */
|
||||
for (i = shader_count - 1; i >= 0; i--) {
|
||||
uint32_t *noperspective_varyings_ptr =
|
||||
const uint32_t *noperspective_varyings_ptr =
|
||||
use_static_noperspective ? &noperspective_varyings : NULL;
|
||||
result =
|
||||
panvk_compile_shader(dev, &infos[i], state, noperspective_varyings_ptr,
|
||||
|
|
@ -1521,18 +1531,6 @@ compile_shaders(struct vk_device *vk_dev, uint32_t shader_count,
|
|||
if (result != VK_SUCCESS)
|
||||
goto err_cleanup;
|
||||
|
||||
/* If we are linking VS and FS, we can use the static interpolation
|
||||
* qualifiers from the FS in the VS. */
|
||||
if (infos[i].nir->info.stage == MESA_SHADER_FRAGMENT) {
|
||||
struct panvk_shader *shader =
|
||||
container_of(shaders_out[i], struct panvk_shader, vk);
|
||||
const struct panvk_shader_variant *variant =
|
||||
panvk_shader_only_variant(shader);
|
||||
|
||||
use_static_noperspective = true;
|
||||
noperspective_varyings = variant->info.varyings.noperspective;
|
||||
}
|
||||
|
||||
/* Clean up NIR for the current shader */
|
||||
ralloc_free(infos[i].nir);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue