0
\$\begingroup\$
interface vs_out 
{
  vec3 get_color();  
};

struct vs_out_impl : vs_out 
{
  vec3 get_color()
  {

    return vec3(1,0,0);
  }
}

Where is this behavior defined? None of the specifications uses the keyword interface. It is generally reserved in version 460. I myself accidentally, at Visual Studio, discovered that this keyword is recognized, thought about it and remembered the Nvidia language C for graphics. It has the ability to create interfaces. I tried it and it worked! This code does not crash with compilation errors. It compiles fine. To check, instead of the diffuse color, I used the method vs_out_impl::get_color(), and the objects were painted red.

Where to see the specification of this functionality? On the Internet, a bunch of words interface and GLSL leads to articles on interface blocks, which is not the same.

\$\endgroup\$
  • \$\begingroup\$ See terrain: a shader that uses interface link original shader link \$\endgroup\$ – Денис Ковешников Sep 18 '19 at 12:38
  • \$\begingroup\$ NVIDIA are often more permissive than other vendors about what they accept, so are you certain that this isn't an NVIDIA-only thing? \$\endgroup\$ – Maximus Minimus Sep 18 '19 at 12:41
  • \$\begingroup\$ I only have a card from ddd, I did not check on others. But what interests me most is the description of this feature, where can I find the specification for this behavior :? \$\endgroup\$ – Денис Ковешников Sep 18 '19 at 13:03
  • \$\begingroup\$ It's not going to be something you can rely on in the future after the shader compiler changes in a driver update \$\endgroup\$ – ratchet freak Sep 18 '19 at 15:20
  • \$\begingroup\$ If the analyzer understands this syntax, it can even indicate, in the context of this, that, for example, the "virtual" interface method is not implemented in the heir class, then I would not say that this is not official. I just want a person who is familiar with this opportunity to give links to sources in which this functionality would be described. It is possible that this analyzer plugin in the background tries to compile a shader, parse errors and then indicate the line where the error occurred \$\endgroup\$ – Денис Ковешников Sep 18 '19 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.