TextureBuffer.setActive still renders when set to False?

I have two passes, set up with FilterManager and TextureBuffers.

I have a manual mainloop calling taskMgr.step().
In this loop, I have a variable increasing every frame.

That variable I use to set the texture buffer to False in the first loop, to stop the first pass shader from shading.
I get a performance increase as expected, but!

When I deactivate BOTH passes the image STILL renders. It renders faster, but it shouldn’t render at all?

When I change the vec3 Camera in python and pass it to the shaders, the Camera moves as if the shaders were still running. I would expect that, when I deactivate the shaders, the viewport can’t change due to the shaders not drawing anymore.

What’s going on?

After some more testing I believe this isn’t actually working at all.

When I put all calculations into the first shader and then deactivate it using setActive, then having the second shader outputting the texture shouldn’t take any more time at all. Yet, while there’s some gain, it seems the first shader is actually still running.

And as mentioned above, even if I setActive(False) to BOTH shaders, while there is some performance gain, both shaders definitely are still active.

How do I fix this mess?
How do I learn how to do it right?

Thank you.

I think some code would be helpful, else it’s hard to say what’s going on.
Setting the config variable ‘show-buffers true’ will show you the content of the buffers on screen, maybe that will help debugging?

Thank you.

I’ve made a test-case. Please tell me if there’s anything missing.

I’m using 1.10.? downloaded several days ago.

dropbox.com/s/cchue1jwml7il … r.gz?dl=07

When you run the script you see the millisec at the top right.
The first pass should only run once, but keeps running.

At the bottom of test.py you can see the main loop, where you can comment out both setActive easily.

The script turns off BOTH passes but it just keeps running.

There’s also no difference in performance.

I’m doing something fundamentally wrong, ain’t it so?

Thank you for your help!

I don’t have a module named ‘FSMP’ and google only point me to “Food for Special Medical Purpose” and somehow I don’t think that’s it. I suppose the functions makeBuffer, makeTexture, makeNewQuad and makeFinalQuad are in there.
I’ve never used a setup where you run taskMgr.step() manually, but at a glance I don’t see anything obviously wrong with your code :blush:

Yes, that was my module to outsource (heh) some code. I did cp test* and forgot the other module. :smiley:

Updated the link. dropbox.com/s/cchue1jwml7il … ar.gz?dl=0

youtube.com/watch?v=o9pEzgHorH0

Stop writing Classes!

Fun Fact: The current mainloop drives the CPU to 90 degree! :smiley:

Is there no solution to this?

All I want is to be able to turn off shaders at will, while keeping the texture…

Can it be that you’re turning off the buffers you get the textures from (?) and the buffers created by the FilterManager when you call renderSceneInto is still working and rendering?
I don’t think there’s a convenient way to to get the right buffer from the FilterManager so after calling
quad = ShaderManager.renderQuadInto(colortex=texture) get the buffer like this buffer=ShaderManager.buffers[-1]

i’m not sure i follow your thought.

You’re saying that “setActive” is touching the wrong thing?
Could you modify and post my code to point out what you mean?

You mean I should dig for the actual buffer in ShaderManager?

You were right!

ShaderManager.buffers[1].setActive(False)

THIS worked! I’m so dumb for not looking into the source of FilterManager, WOW!

Thank you!