Skip to content

gpu: dispatch: shaders: add specialization constants

Niklas Haas requested to merge specialization into master

We hard-code a lot of constants. Rather than going through the full shader compilation pipeline for every single update, we can leverage the vulkan specialization constants feature to make shader recompilation cheaper when we only care about updating constants.

In addition to this benefit, moving all constants into the same sh_const API will give us an easy way to silently replace them by pl_var in situations where the user expects these values to change frequently. (e.g. plplay)

This commit only adds the infrastructure and APIs. None of the shaders nor GPUs actually use this functionality yet. That will come in a separate series of commits.

Fixes #158 (closed)

TODO:

  • shaders/colorspace.c
  • shaders/av1.c
  • shaders/custom.c
  • shaders/icc.c
  • shaders/lut.c
  • shaders.c
  • renderer.c
  • allow specifying initial values (avoid redundant recompilation)
  • allow using pl_var instead of pl_const for dynamic constants
Edited by Niklas Haas

Merge request reports

Loading