Jump to content

Triggering Shader Compilation


royibernthal
 Share

Recommended Posts

I could argue: Please take a minute to read the code which is available on GitHub but I won't go down this easy road

Anyway, my response still applies, only file links change=>

 

You can see that the effect if created here:

https://github.com/BabylonJS/Babylon.js/blob/master/src/Particles/babylon.gpuParticleSystem.ts#L512

so calling isReady should be enough (until it returns true):

https://github.com/BabylonJS/Babylon.js/blob/master/src/Particles/babylon.gpuParticleSystem.ts#L292

 

 

Link to comment
Share on other sites

On 6/6/2018 at 7:35 AM, Deltakosh said:

I could argue: Please take a minute to read the code which is available on GitHub but I won't go down this easy road

Sorry if I sounded rude in my last reply. I did by the way read the code on GitHub, hence my previous questions about how things work internally.

On 6/6/2018 at 7:35 AM, Deltakosh said:

Anyway, my response still applies, only file links change=>

 

You can see that the effect if created here:

https://github.com/BabylonJS/Babylon.js/blob/master/src/Particles/babylon.gpuParticleSystem.ts#L512

so calling isReady should be enough (until it returns true):

https://github.com/BabylonJS/Babylon.js/blob/master/src/Particles/babylon.gpuParticleSystem.ts#L292

I still don't understand why we need to emulate emitter and texture instead of directly calling the internal functions that trigger compilation, an explanation would be nice if/when you have time.

Anyway, let's just do that, I guess it doesn't make much of a difference.

Here's an updated PG, I don't think the effect is being compiled. What am I missing?

http://www.babylonjs-playground.com/#7UJDBL#7

Link to comment
Share on other sites

On 6/11/2018 at 7:53 PM, Deltakosh said:

And your code was wrong it is particleTexture and not texture:

http://www.babylonjs-playground.com/#7UJDBL#8

My bad, thanks.

 

On 6/11/2018 at 7:53 PM, Deltakosh said:

Looking back at my replies I wasn't clear, so I'll try to rephrase. My question was:

In this case where I only need to precompile, why emulate texture and emitter and call particleSystem.isReady() rather than call

this._recreateUpdateEffect();

this._recreateRenderEffect();

and wait for this._updateEffect.isReady() && this._renderEffect.isReady()

so that I don't need to emulate texture and emitter? In practicality this doesn't make a difference but I'm just curious.

http://www.babylonjs-playground.com/#7UJDBL#11

 

Assuming the latter is also viable, I noticed I simply don't see anything for it in compiledEffects even though isReady() returns true, same as when emulating texture and emitter:

http://www.babylonjs-playground.com/#7UJDBL#8

 

I recall you told me something about it at some point, I can't remember what.

1) Does the compilation of GPU particle system effect use a different function than all other effects? I tried to log name in Engine/createEffect() and I don't see any hint of a GPUParticleSystem related effect.

2) Is it possible to create a completely empty texture for temporary purposes like in this case? If so, how do I do that?

Link to comment
Share on other sites

Well you are right regarding _recreateUpdateEffect and _recreateRenderEffect: you can call then and then wait for each effect to be ready. it is perhaps a little bit more hacky

The problem is that onBeforeShaderCompilationObservable is called before the shader gets compiled and thus before it is added to the _compiledEffect

 

Regarding a temp texture, you can create a 1x1 RawTexture I guess

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...