Merge pull request #9109 from RandomShaper/optimize-2d-lighting
Add AT_LIGHT_PASS builtin to canvas shaders
This commit is contained in:
commit
f8bd488457
|
@ -448,6 +448,7 @@ public:
|
|||
: dirty_list(this) {
|
||||
|
||||
shader = NULL;
|
||||
ubo_size = 0;
|
||||
valid = false;
|
||||
custom_code_id = 0;
|
||||
version = 1;
|
||||
|
|
|
@ -668,6 +668,7 @@ ShaderCompilerGLES3::ShaderCompilerGLES3() {
|
|||
actions[VS::SHADER_CANVAS_ITEM].renames["PROJECTION_MATRIX"] = "projection_matrix";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["EXTRA_MATRIX"] == "extra_matrix";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["TIME"] = "time";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["AT_LIGHT_PASS"] = "at_light_pass";
|
||||
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["COLOR"] = "color";
|
||||
actions[VS::SHADER_CANVAS_ITEM].renames["NORMAL"] = "normal";
|
||||
|
|
|
@ -59,6 +59,9 @@ out vec4 local_rot;
|
|||
out highp vec2 pos;
|
||||
#endif
|
||||
|
||||
const bool at_light_pass = true;
|
||||
#else
|
||||
const bool at_light_pass = false;
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -191,6 +194,9 @@ in highp vec2 pos;
|
|||
|
||||
#endif
|
||||
|
||||
const bool at_light_pass = true;
|
||||
#else
|
||||
const bool at_light_pass = false;
|
||||
#endif
|
||||
|
||||
uniform mediump vec4 final_modulate;
|
||||
|
|
|
@ -153,6 +153,7 @@ ShaderTypes::ShaderTypes() {
|
|||
shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"]["EXTRA_MATRIX"] = ShaderLanguage::TYPE_MAT4;
|
||||
shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"]["TIME"] = ShaderLanguage::TYPE_FLOAT;
|
||||
shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"]["PARTICLE_CUSTOM"] = ShaderLanguage::TYPE_VEC4;
|
||||
shader_modes[VS::SHADER_CANVAS_ITEM].functions["vertex"]["AT_LIGHT_PASS"] = ShaderLanguage::TYPE_BOOL;
|
||||
|
||||
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["SRC_COLOR"] = ShaderLanguage::TYPE_VEC4;
|
||||
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["POSITION"] = ShaderLanguage::TYPE_VEC2;
|
||||
|
@ -166,6 +167,7 @@ ShaderTypes::ShaderTypes() {
|
|||
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["SCREEN_UV"] = ShaderLanguage::TYPE_VEC2;
|
||||
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["POINT_COORD"] = ShaderLanguage::TYPE_VEC2;
|
||||
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["TIME"] = ShaderLanguage::TYPE_FLOAT;
|
||||
shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"]["AT_LIGHT_PASS"] = ShaderLanguage::TYPE_BOOL;
|
||||
|
||||
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["POSITION"] = ShaderLanguage::TYPE_VEC2;
|
||||
shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"]["NORMAL"] = ShaderLanguage::TYPE_VEC3;
|
||||
|
|
Loading…
Reference in New Issue