share functions/textures/samplers between shaders

  • Posts: 85
2 years 1 month ago #1 by moriz1
i vaguely remember reading somewhere that it is possible to share functions/textures/samplers between shader effects. if this is possible, what's the syntax to get it to work?

reason i'm asking, is because i've written two shaders with the same luma adaptation effects. if i run both shaders, i suspect the two adaptation effects will intefere with each other.

Please Log in or Create an account to join the conversation.

  • Posts: 3725
2 years 1 month ago #2 by crosire
Textures are shared. As long as they have the same name in both effects, they access the same memory. Anything else is not shared, though name clashes are between effects are undefined behavior. How you access a texture (that is, with which sampler or render target) is irrelevant.

Please Log in or Create an account to join the conversation.

  • Posts: 85
2 years 1 month ago #3 by moriz1
is there a way to check if a texture has already been instantiated in another shader?

Please Log in or Create an account to join the conversation.

  • Posts: 3725
2 years 1 month ago #4 by crosire
No.

Please Log in or Create an account to join the conversation.