www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: kkl on November 12, 2014, 10:35:42 am

Title: Does setStaticUniform upload GPU every frame?
Post by: kkl on November 12, 2014, 10:35:42 am
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?
Title: Re: Does setStaticUniform upload GPU every frame?
Post by: EgonOlsen on November 12, 2014, 10:47:44 am
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.
Title: Re: Does setStaticUniform upload GPU every frame?
Post by: kkl on November 13, 2014, 02:23:43 am
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?
Title: Re: Does setStaticUniform upload GPU every frame?
Post by: EgonOlsen on November 13, 2014, 08:54:40 am
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.
Title: Re: Does setStaticUniform upload GPU every frame?
Post by: kkl on November 13, 2014, 11:27:18 am
Thanks egon. I guess i'll have to set it on every context change
Title: Re: Does setStaticUniform upload GPU every frame?
Post by: kkl on November 13, 2014, 03:32:03 pm
Hi egon,

How about vertex attributes? Is it doable if we have it static and only upload to GPU once?
Title: Re: Does setStaticUniform upload GPU every frame?
Post by: EgonOlsen on November 13, 2014, 03:38:28 pm
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.