• Dear Cerberus X User!

    As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.

    Important: If you accept the amended Terms and Rules, you agree to the transfer of your user data to the future forum owner!

    Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.

    Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!

    Accepting ensures:

    - Continued access to your account with a short break for the actual transfer.

    - Retention of your data under the same terms.

    Without consent:

    - You don't have further access to your forum user account.

    - Your account and personal data will be deleted after April 5, 2024.

    - Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.

    We hope to keep you in our community and see you on the forum soon!

    All the best

    Your Cerberus X Team

Light on shaders

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,414
Toying around with shaders and Mojo2 graphics to see if I can learn something and I found something interesting and would like to ask about some details. I basically changed the shader example a bit and then mojo2 graphics, to look if I could understand anything.

I'basically come up with the shortest "flush" code that could restore the graphics for a managed image.

You only need to see one line for this, it's line 2935

_active = Self

What does that do? When executed, shaders can read managed images without any problem of updating them with flush.
If you also add line 2936 then graphics is updated everywhere as a normal flush (not only readable for shaders).

If this is interesting then I might post more content if I find useful solutions.



Screenshot 2021-01-03 at 12.40.30.png
 
First I was not even gonna try to explain the test as it's not finished, it's a mess so sorry about that.
Im basically connecting shaders & managed images while generating graphics continously invisibly of course as it does not flush.

You update using a "new managed flush" using a mouseclick and the up and down cursors change what kind of circular connection the shaders has.

That main thing here to take away is, I try and I think I succeeded, to read managed image without flushing them. Using shader.I also turn it upside down just to see that i can do it, but what i didn't expect was that it would flip horisontal too. I don't know why but that's not the focus here.

:active is a global variable of type canvas, I came that far.
 

Attachments

  • example.zip
    104 KB · Views: 111
I'm also positive now that managed images are performing well already in a way.

Just look it like this. The standard flush becomes expansive, so avoid it whenever you can. BUT it's still all there, under the surface, everything you draw IS updated quickly and it's really nice. So what you could do is,
draw twice. becuase drawing is cheap. Once to the canvas, and once to the managed image. Both are quick.

And when disaster hits, you have your graphics safe in the managed one. You can flush once a second no problem, and you can draw everything you can fill in the next coming second on top of that. Then you do the same over and over.

But still, I wanted to see if there's a way to get extreme performance, it would be nice, it could make Android games stand out on the marketplace a bit extra. So, in this thread I'm toying around with that idea.
 
Why this is good is, you get overal high performance and you get creative freedom of graphics as you can mix both

retained And immediate graphics

in the same display without any cost.
 
I run into a problem, is it possible to apply shader to the window canvas? As I understand it and the window canvas is tied to nul,l so there's no image to bind a shader to or am I missing something?

Also, is it possible to have a shader to read from TWO images/textures as input instead of just one?
 
Edit: There is no way to apply a shader to the window framebuffer. What you have to do is to render everything to image canvas, apply a shader to it and then render that to the main canvas.

This page shows it well, using OpenGL directly. But the same methology can be used with an image canvas and an applied shader.
 
Okay I'm doing that and it works perfectly but I just wanted to make sure I understood everything, thanks for clearifying
 
Back
Top Bottom