0

The MVP structure in my case takes 192 bytes as blow:

struct MVP {
    model: Mat4,
    view: Mat4,
    proj: Mat4,
}

And according to enter link description here, nearly 78% of Android devices only support 128 bytes of push constants. Since there's Only one push_constant block is allowed per stage, is there any way I can still use push constant on these devices? And if so, is it worth (for example use a compress algorithm somehow) compared with using a uniform buffer?

psionic12
  • 185
  • 1
  • 11
  • "*there's Only one push_constant block is allowed per stage*" Per *pipeline*, not stage. You have 128 bytes to share among *all* shader stages. – Nicol Bolas Oct 21 '22 at 04:45
  • @NicolBolas thanks for pointing out, it is the error log reported by glslc, although I know all stages shared the same 128 bytes, I just copy and paste it in the question. – psionic12 Oct 21 '22 at 04:59
  • 2
    Premultiply model and view matrices into a modelview matrix, and you are there. – krOoze Oct 21 '22 at 08:57
  • @krOoze Is this solution practicable? It is indeed that I don't need to use model or view singly, but I think there might be some cases that a shader program will need a model. – psionic12 Oct 21 '22 at 09:18
  • 2
    Practiceable and encouraged. You don't want to multiply the same matrices over and over 100000x with each shader invocation. Sometimes separate modelview matrix is useful (you don't want to project certain kind of quantities). – krOoze Oct 21 '22 at 14:03

0 Answers0