diff options
author | reduz <reduzio@gmail.com> | 2021-04-13 17:01:43 -0300 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2021-04-14 11:37:52 -0300 |
commit | d3b49c416ab0f2009bb41a035f8171726f892cce (patch) | |
tree | 12b9832f1840a72c886680cadd55a7b6bcf74cd3 /servers/rendering/renderer_rd/shader_compiler_rd.h | |
parent | 8ce0fb0a946455ed6a7bc8a54fcf90a9d5a9ae4d (diff) |
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().
Diffstat (limited to 'servers/rendering/renderer_rd/shader_compiler_rd.h')
-rw-r--r-- | servers/rendering/renderer_rd/shader_compiler_rd.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/servers/rendering/renderer_rd/shader_compiler_rd.h b/servers/rendering/renderer_rd/shader_compiler_rd.h index 6575829e73..2da127ffa3 100644 --- a/servers/rendering/renderer_rd/shader_compiler_rd.h +++ b/servers/rendering/renderer_rd/shader_compiler_rd.h @@ -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; |