From 04bf87e855fa735100b8885cdd739b96dfc5d373 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 17 Jun 2017 11:03:48 -0300 Subject: [PATCH] -Fixed shader lang to not be able to get scalar from matrix (ie mat.x), to make it more GLSL compatible -Fixed referencing of world_transform in fragment shader not working -Fixed unsycn bug related to getting shader param list from the server -Fixed getting all textures from shader properly, fixes #8353 --- drivers/gles3/rasterizer_storage_gles3.cpp | 6 +++++- drivers/gles3/shaders/scene.glsl | 2 ++ scene/resources/material.cpp | 2 -- servers/visual/shader_language.cpp | 6 ++++-- servers/visual/visual_server_wrap_mt.h | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index c697672bd8c9..85331342e92d 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -1556,7 +1556,11 @@ void RasterizerStorageGLES3::shader_get_param_list(RID p_shader, List::Element *E = shader->uniforms.front(); E; E = E->next()) { - order[E->get().order] = E->key(); + if (E->get().texture_order >= 0) { + order[E->get().texture_order + 100000] = E->key(); + } else { + order[E->get().order] = E->key(); + } } for (Map::Element *E = order.front(); E; E = E->next()) { diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index fc38346baacc..a047e693cb47 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -368,6 +368,8 @@ VERTEX_SHADER_CODE */ +uniform highp mat4 world_transform; + #define M_PI 3.14159265359 /* Varyings */ diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index a6927f13b9e7..ce88325539b7 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -1370,8 +1370,6 @@ void SpatialMaterial::_bind_methods() { BIND_CONSTANT(BILLBOARD_ENABLED); BIND_CONSTANT(BILLBOARD_FIXED_Y); BIND_CONSTANT(BILLBOARD_PARTICLES); - - } SpatialMaterial::SpatialMaterial() diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 319351f8ec35..96d56dfc56f4 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -2549,12 +2549,14 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons } break; - default: {} + default: { + ok = false; + } } if (!ok) { - _set_error("Invalid member for expression: ." + ident); + _set_error("Invalid member for " + get_datatype_name(dt) + " expression: ." + ident); return NULL; } diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index 7df9c39eb29b..d691156b5db8 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -113,7 +113,7 @@ class VisualServerWrapMT : public VisualServer { FUNC2(shader_set_code, RID, const String &) FUNC1RC(String, shader_get_code, RID) - FUNC2C(shader_get_param_list, RID, List *) + FUNC2SC(shader_get_param_list, RID, List *) FUNC3(shader_set_default_texture_param, RID, const StringName &, RID) FUNC2RC(RID, shader_get_default_texture_param, RID, const StringName &)