1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Refactor GLSL shader compilation

-Used a more consistent set of keywords for the shader
-Remove all harcoded entry points
-Re-wrote the GLSL shader parser, new system is more flexible. Allows any entry point organization.
-Entry point for sky shaders is now sky().
-Entry point for particle shaders is now process().
This commit is contained in:
reduz
2021-04-13 17:01:43 -03:00
parent 8ce0fb0a94
commit d3b49c416a
64 changed files with 415 additions and 804 deletions

View File

@@ -38,7 +38,16 @@
class ShaderCompilerRD {
public:
enum Stage {
STAGE_VERTEX,
STAGE_FRAGMENT,
STAGE_COMPUTE,
STAGE_MAX
};
struct IdentifierActions {
Map<StringName, Stage> entry_point_stages;
Map<StringName, Pair<int *, int>> render_mode_values;
Map<StringName, bool *> render_mode_flags;
Map<StringName, bool *> usage_flag_pointers;
@@ -63,13 +72,9 @@ public:
Vector<uint32_t> uniform_offsets;
uint32_t uniform_total_size;
String uniforms;
String vertex_global;
String vertex;
String fragment_global;
String fragment;
String light;
String compute_global;
String compute;
String stage_globals[STAGE_MAX];
Map<String, String> code;
bool uses_global_textures;
bool uses_fragment_time;
@@ -103,10 +108,6 @@ private:
const ShaderLanguage::ShaderNode *shader;
const ShaderLanguage::FunctionNode *function;
StringName current_func_name;
StringName vertex_name;
StringName fragment_name;
StringName light_name;
StringName compute_name;
StringName time_name;
Set<StringName> texture_functions;