texture (string filename, float s, float t, ...params...)
--
You received this message because you are subscribed to the Google Groups "OSL Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osl-dev+u...@googlegroups.com.
To post to this group, send email to osl...@googlegroups.com.
Visit this group at https://groups.google.com/group/osl-dev.
For more options, visit https://groups.google.com/d/optout.
Sorry for the delay, your first message arrived shortly before the end of the work day on Friday, and you had found your own answer before I got in to the office on Monday.Your analysis is correct. The reliance on "strings" should have no performance impact on the execution of shaders in the vast majority of cases.-- lg
On Apr 7, 2019, at 11:46 PM, caojia...@gmail.com wrote:
Answering it by myself in case someone else has the same question.OSL will cache the texture handler ( a pointer where the system knows how to interpret how to retrieve pixel information ) during compilation.It will call 'get_texture_handle' to expose a chance for an external system to load the texture from file and create the texture_handle.There is no hash table accessing if texture handle is available, which means the texture fetching overhead is not gonna be very high because of hash table access.
On Saturday, 6 April 2019 08:09:16 UTC+8, caojia...@gmail.com wrote:Hi,I'm not quite familiar with OSL implementation. I got a question when I read the interface to sample texture, it seems that instead of acquiring a handle ( like a GPU shader ), OSL uses string to identify the textures.texture (string filename, float s, float t, ...params...)
Above is an interface to sample a texture in OSL. My concern is that do we need to process the string to acquire the handle every time we access a texture? I also saw some cache stuff in TextureSystem, does it help to mitigate the problem.And the other very important question that I have is that, do we have an example demonstrating how to support texture?ThanksJiayin--
You received this message because you are subscribed to the Google Groups "OSL Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osl...@googlegroups.com.
To post to this group, send email to osl...@googlegroups.com.
Visit this group at https://groups.google.com/group/osl-dev.
For more options, visit https://groups.google.com/d/optout.
My two cents w.r.t the texture sampling. Could it be better to introduce a new concept, like texture object. in OSL so that there is a way to change texture right before shader execution? I think the gain is as following:
- Imagine I have a shader group with 10 shader layers loading textures, each shader layer has two possible textures to load. I will have to build 1024 shader group to fully support it. ( I could be wrong about this one though )
- The current implementation kind of binds the image loading process with the shader compilation together because TextureSystem receives a notification during shader compilation and the compilation process requires a pointer to be returned before it ends to fully optimize the texture sampling method to avoid parsing strings. There are two limitations that I see
- Texture loading can only be from a file. Other streaming methods may not work directly with the current implementation.