-
-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Built-in methods, variables and structs support #6
Comments
We should probably solve glsl versions first. Probably most intuitive would be to:
Using this philosophy, extensions could be handled as well. However, this will create a lot of redundancy, because most of the functions stay the same between versions. Alternatives would be:
Question also is, how to recognize and account for GLES shaders in this system. |
I've added more files to this in the GLES SL versions are |
(See #40 which is a prerequisite for this.) |
I'd like to keep the ability to recognise the function even if doesn't exist in the current version, but I think that the preprocessor support would have to be very advanced to be able to do that reliably. I don't know, maybe it will be easier then it seems, but so far I'm in favor of annotating somehow. Since these annotations will be supported only in environment files, we can make up our own syntax that is readable and comfortable. Making the tag up isn't trivial though, but if we assume that GLES versions will be always different to GL versions, something like |
C++11 attributes ( Supporting attributes for things other than versions would be hypothetically useful for adding other annotations to the standard library - possibly something like |
It can also be used for error highlighting based on expression analysis, as well as feeding more info back into the analysis: float [[contract(x >= 0 && sqrt(x) >= 0)]] sqrt(float x); |
First, very nice plugin! Does this issue include the missing deduction of return values for build-in functions, or should I create a new one?
It is able to deduce the types of the arguments to |
@Fox32 Thanks! It does, support for methods here means that the plugin will know which methods there are, what arguments do they take and what type they return. More thoughts on the issue: class GLSLFunctionRepository extends FunctionRepository {
//function(name, returnType, argTypes...);
function("sin", GEN_TYPE, GEN_TYPE);
function("cos", GEN_TYPE, GEN_TYPE);
function("doMagic", FLOAT, GEN_TYPE, GEN_TYPE).since(130).sinceES(150);
...
}
FunctionRepository fr;
FunctionType ft = fr.findFunction("doMagic", VEC2, VEC2);
ft.returnType == FLOAT Similar "Repository" for variables and types or it could be integrated into one. I am seriously considering this, because it will be less work, faster, more flexible, predictable, and we will have tools to deal with it (refactoring java is easier than glsl with custom annotations). |
Having had a further look at how function lookups and parameter info is handled, I suspect building the function list in Java would be easier. (Specifically, a |
In my game engine I support importing shaders using The built-in functions are conveniently stored in files as is, so if built-in function loading was implemented by implicitly (without explicit annotations or directives) importing the resource files, it would solve a few problems:
While Java function repository idea would definitely be faster, I think it would also be less flexible. I will maybe look more into the idea later. Also sorry about messy text flow, it's late. |
Hello. Thanks for plugin. What is the status of the issue now? When can we expect this enhancement to be implemented? |
I don't currently have much time to work on my OSS, so don't expect this to be done anytime soon. |
There are already unused files for this in resources/environment.
The text was updated successfully, but these errors were encountered: