godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.07k stars 69 forks source link

Add a method to get the error message obtained when setting incorrect shader code #697

Open RodZill4 opened 4 years ago

RodZill4 commented 4 years ago

Describe the project you are working on: My project is Material Maker, a PBR material authoring tool that relies on generated shaders to output textures. Shaders are generated from interconnected nodes, and new (shader-based) nodes can be created.

Describe the problem or limitation you are having in your project: I didn't find how to get a shader error message from GDScript (it is only visible in the log window), so Material Maker does not give much information when a user-defined node does not generate correct shader code. It is even not easy to detect which node causes the error because nodes are combined to generate shaders.

Describe the feature / enhancement and how it helps to overcome the problem or limitation: I'd just need a way of getting the error message (with line number) obtained when compiling the shader.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams: That feature could either be accessed through the Shader object or hidden in the VisualServer. The function would return either the error message, or an empty string if the shader was compiled successfully. var my_error = material.shader.get_error() or var my_error = VisualServer.shader_get_error(getmaterial.shader.get_rid())

If this enhancement will not be used often, can it be worked around with a few lines of script?: I'm pretty sure it will not be used often, but I don't think it can be worked around. If there is a way of getting that error message, I'd happily use it.

Is there a reason why this should be core and not an add-on in the asset library?: Unless it is possible to get the error without modifying the core, it should be in the core.

Manonox commented 1 year ago

2 Years have passed, and, again, someone needs this... I am planning to make a cool online first person shader editor, so you can share stuff with friends, but it'd be difficult to code without shader errors. This proposal will probably still be lost in the vast sea of things, but it's worth a try. (this feature should be super easy to implement though, because the messages are already kind of processed in the shader editor)

Zamir7 commented 1 year ago

I join the request, a very necessary feature, without which it is impossible to create your own shader editor, and additional shader editors, in turn, would popularize the engine. Please accept the problem and take some time to implement

Calinou commented 1 year ago

@Zamir7 Please don't bump issues without contributing significant new information. Use the :+1: reaction button on the first post instead.