Open source 3D rendering solution adhering to the RenderMan standard

output variable

Posted by: mosari

Hi

 How could I find that a parameter in a shader is output.

 In other renderers there is a member in SLO_STORAGE enum that specify

 a parameter as output but in SLX library a didn't see anything like this.

 Best

 Mostafa

c42f's picture

Posted by: c42f

Seems not to be possible currently

Hi Mostafa,

I checked the code, but I'm afraid this seem impossible in aqsis-1.6 and below.  From the code:

    typedef enum {
        SLO_STOR_UNKNOWN,
        SLO_STOR_CONSTANT,
        SLO_STOR_VARIABLE,
        SLO_STOR_TEMPORARY,
        SLO_STOR_PARAMETER,
        SLO_STOR_GSTATE
    } SLO_STORAGE;

So the SLO_STORAGE enum has a bunch of different possible values, but I have no idea what most of them do.  In fact, inspecting the code history more closely, it looks like the SLX library has never set the storage parameter to anything other than SLO_STOR_UNKNOWN, so there's no real clues about what these were originally intended to do.

Can you tell me what storage classes you expect to be avaliable?  From searching the web, it seems like we should have something like

typedef enum {
    SLO_STOR_PARAMETER,
    SLO_STOR_OUTPUTPARAMETER
} SLO_STORAGE;

Would that satisfy your needs?

By the way, we provide the slo.h header (rather than slx.h) for compatibility with other renderers.  The aim of slo.h is to provide an interface which is fully binary compatible, so let us know if you find any other anomalies.

Cheers,

~Chris.

c42f's picture

Posted by: c42f

simple workaround

I've just realized that there's a simple workaround to obtain the information you're after:  you can just look in the compiled shader file itself.  The compiled aqsis shaders are basically just text files containing simple stack code, so some simple things can be gleaned from them without much effort.  For example, suppose you have the shader

surface test(output float foo = 0)
{
  foo = 1;
}

and you compile this into a file test.slx.  You can extract information about the parameter foo quite easily using the (unix) command:

grep -a 'param.*foo' test.slx

This will return something like the following line of information:

output param uniform  float foo

Of course, it's not a permanent solution, but it might help you before we fix the SLO_STORAGE enum properly.

~Chris.

Posted by: mosari

  Hi Chris and thank you for

 

Hi Chris and thank you for your reply

regarding pixar's slo library there is a member in storage enum like you say (SLO_STOR_OUTPUTPARAMETER)

that specifies a parameter as an output. unfortunately I didn't refer to other members of this enum to find out are they

works but in my program I need to find out is a parameter output or not. I use pixar's slo as my reference but these problems

are natural when I want to compile my program on another complaints. For example in Pixie the sdr library uses "writable" member

of storage enum to show it as an output.

thank you for your work around to solve the problem but I prefer to wait for the compatible solution.

Cheers

Mostafa

 

  

c42f's picture

Posted by: c42f

Fixed in git

Ok, I've now fixed this problem in the latest git revision.

I've added an enum member SLO_STOR_OUTPUTPARAMETER to the SLO_STORAGE enum, so you can check the svd_storage member as expected to determine whether a parameter is an output parameter or not.

I also updated aqsltell so that it correctly reads and reports the storage type, and fixed a bug which caused a crash when SLX_SetDSOPath() was neglected.

Cheers,

~Chris

Posted by: mosari

good work

Dear Chris

Thank you for your effort.

Cheers

Mostafa