summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp28
-rw-r--r--drivers/gles2/shader_compiler_gles2.cpp2
2 files changed, 26 insertions, 4 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index 5617f5bd0b..2d60f0e928 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -4440,6 +4440,13 @@ void RasterizerGLES2::_update_shader( Shader* p_shader) const {
if (err) {
return; //invalid
}
+ } else if (p_shader->mode==VS::SHADER_CANVAS_ITEM) {
+
+ Error err = shader_precompiler.compile(p_shader->vertex_code,ShaderLanguage::SHADER_CANVAS_ITEM_VERTEX,vertex_code,vertex_globals,vertex_flags,&p_shader->uniforms);
+ if (err) {
+ return; //invalid
+ }
+
}
//print_line("compiled vertex: "+vertex_code);
@@ -4449,9 +4456,16 @@ void RasterizerGLES2::_update_shader( Shader* p_shader) const {
String fragment_code;
String fragment_globals;
- Error err = shader_precompiler.compile(p_shader->fragment_code,(p_shader->mode==VS::SHADER_MATERIAL?ShaderLanguage::SHADER_MATERIAL_FRAGMENT:ShaderLanguage::SHADER_POST_PROCESS),fragment_code,fragment_globals,fragment_flags,&p_shader->uniforms);
- if (err) {
- return; //invalid
+ if (p_shader->mode==VS::SHADER_MATERIAL) {
+ Error err = shader_precompiler.compile(p_shader->fragment_code,ShaderLanguage::SHADER_MATERIAL_FRAGMENT,fragment_code,fragment_globals,fragment_flags,&p_shader->uniforms);
+ if (err) {
+ return; //invalid
+ }
+ } else if (p_shader->mode==VS::SHADER_CANVAS_ITEM) {
+ Error err = shader_precompiler.compile(p_shader->fragment_code,ShaderLanguage::SHADER_CANVAS_ITEM_FRAGMENT,fragment_code,fragment_globals,fragment_flags,&p_shader->uniforms);
+ if (err) {
+ return; //invalid
+ }
}
@@ -4464,6 +4478,11 @@ void RasterizerGLES2::_update_shader( Shader* p_shader) const {
if (err) {
return; //invalid
}
+ } else if (p_shader->mode==VS::SHADER_CANVAS_ITEM) {
+ Error err = shader_precompiler.compile(p_shader->light_code,(ShaderLanguage::SHADER_CANVAS_ITEM_LIGHT),light_code,light_globals,light_flags,&p_shader->uniforms);
+ if (err) {
+ return; //invalid
+ }
}
fragment_globals+=light_globals; //both fragment anyway
@@ -8366,9 +8385,12 @@ void RasterizerGLES2::canvas_render_items(CanvasItem *p_item_list) {
} else {
canvas_shader.set_custom_shader(0);
+ canvas_shader.bind();
+
}
canvas_shader.set_uniform(CanvasShaderGLES2::PROJECTION_MATRIX,canvas_transform);
+ last_shader=ci->shader;
}
canvas_shader.set_uniform(CanvasShaderGLES2::MODELVIEW_MATRIX,ci->final_transform);
diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp
index 204a81d193..163d146009 100644
--- a/drivers/gles2/shader_compiler_gles2.cpp
+++ b/drivers/gles2/shader_compiler_gles2.cpp
@@ -742,7 +742,7 @@ ShaderCompilerGLES2::ShaderCompilerGLES2() {
mode_replace_table[4]["POSITION"]="gl_Position";
mode_replace_table[4]["NORMAL"]="normal";
mode_replace_table[4]["UV"]="uv_interp";
- mode_replace_table[4]["COLOR"]="color_interp";
+ mode_replace_table[4]["COLOR"]="color";
mode_replace_table[4]["TEXTURE"]="texture";
mode_replace_table[4]["VAR1"]="var1_interp";
mode_replace_table[4]["VAR2"]="var2_interp";