Does setStaticUniform upload GPU every frame?

Started by kkl, November 12, 2014, 10:35:42 AM

Previous topic - Next topic

kkl

Hi Egon,

Does setStaticUniform upload its value to GPU every frame? If yes, is it possible if we can make it upload only once and reuse afterwards, like texture?

EgonOlsen

No, it doesn't. That's what it's meant for. However, if you are using it, you have to take care of context changes (pause/resume and similar stuff) and set it again in that case.

kkl

Do you mean we have to use setStaticUniform on context change? Does setStaticUniform upload to GPU directly or it will upload again automatically during rendering after I use the method on context change?

EgonOlsen

It uploads during the first render pass. And yes, you have to re-apply the setters after a context change. That's why i actually don't use it anymore myself.

kkl

Thanks egon. I guess i'll have to set it on every context change

kkl

Hi egon,

How about vertex attributes? Is it doable if we have it static and only upload to GPU once?

EgonOlsen

No, those are different. The only 'upload' here is a pointer to a buffer and each attribute from that buffer will be injected into the vertex shader for the corresponding vertex. That's the basic idea of a vertex shader. You can't prevent it and it wouldn't make any sense, because it would leave the vertex shader without data.