summaryrefslogtreecommitdiff
path: root/servers/visual
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2019-09-15 01:01:52 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-02-11 12:01:24 +0100
commitdd3682e5feb433117fbf62c363c7ba6ff214f8fa (patch)
treeebe83f2fb472140c4ae267fd5f4a7db7525acbc1 /servers/visual
parent6deffa62fbd1e91873afa663630b788b9ffabee3 (diff)
Modernized default 3D material, fixes material bugs.
Diffstat (limited to 'servers/visual')
-rw-r--r--servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp1
-rw-r--r--servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp8
-rw-r--r--servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp4
-rw-r--r--servers/visual/rasterizer_rd/shader_compiler_rd.cpp9
-rw-r--r--servers/visual/rasterizer_rd/shader_compiler_rd.h5
-rw-r--r--servers/visual/rasterizer_rd/shaders/scene_forward.glsl21
-rw-r--r--servers/visual/shader_language.cpp216
7 files changed, 142 insertions, 122 deletions
diff --git a/servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp
index 1a94f11334..0da86f23a7 100644
--- a/servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp
+++ b/servers/visual/rasterizer_rd/rasterizer_canvas_rd.cpp
@@ -2356,6 +2356,7 @@ RasterizerCanvasRD::RasterizerCanvasRD(RasterizerStorageRD *p_storage) {
actions.base_uniform_string = "material.";
actions.default_filter = ShaderLanguage::FILTER_LINEAR;
actions.default_repeat = ShaderLanguage::REPEAT_DISABLE;
+ actions.base_varying_index = 4;
shader.compiler.initialize(actions);
}
diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp
index bf4d7e4fc8..7164624c9f 100644
--- a/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp
+++ b/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp
@@ -273,13 +273,13 @@ void RasterizerSceneForwardRD::ShaderData::set_code(const String &p_code) {
for (int i = 0; i < CULL_VARIANT_MAX; i++) {
- RD::PolygonCullMode cull_mode_rd_table[3][CULL_VARIANT_MAX] = {
+ RD::PolygonCullMode cull_mode_rd_table[CULL_VARIANT_MAX][3] = {
{ RD::POLYGON_CULL_DISABLED, RD::POLYGON_CULL_FRONT, RD::POLYGON_CULL_BACK },
{ RD::POLYGON_CULL_DISABLED, RD::POLYGON_CULL_BACK, RD::POLYGON_CULL_FRONT },
{ RD::POLYGON_CULL_DISABLED, RD::POLYGON_CULL_DISABLED, RD::POLYGON_CULL_DISABLED }
};
- RD::PolygonCullMode cull_mode_rd = cull_mode_rd_table[cull][i];
+ RD::PolygonCullMode cull_mode_rd = cull_mode_rd_table[i][cull];
for (int j = 0; j < VS::PRIMITIVE_MAX; j++) {
@@ -309,7 +309,7 @@ void RasterizerSceneForwardRD::ShaderData::set_code(const String &p_code) {
depth_stencil.enable_depth_write = false; //alpha does not draw depth
}
} else if (uses_depth_pre_pass && (k == SHADER_VERSION_DEPTH_PASS || k == SHADER_VERSION_DEPTH_PASS_DP || k == SHADER_VERSION_DEPTH_PASS_WITH_NORMAL || k == SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS)) {
- if (k == SHADER_VERSION_DEPTH_PASS || k == k == SHADER_VERSION_DEPTH_PASS_DP) {
+ if (k == SHADER_VERSION_DEPTH_PASS || k == SHADER_VERSION_DEPTH_PASS_DP) {
//none, blend state contains nothing
} else {
blend_state = blend_state_opaque; //writes to normal and roughness in opaque way
@@ -2703,11 +2703,13 @@ RasterizerSceneForwardRD::RasterizerSceneForwardRD(RasterizerStorageRD *p_storag
actions.render_mode_defines["shadows_disabled"] = "#define SHADOWS_DISABLED\n";
actions.render_mode_defines["ambient_light_disabled"] = "#define AMBIENT_LIGHT_DISABLED\n";
actions.render_mode_defines["shadow_to_opacity"] = "#define USE_SHADOW_TO_OPACITY\n";
+ actions.render_mode_defines["unshaded"] = "#define MODE_UNSHADED\n";
actions.sampler_array_name = "material_samplers";
actions.base_texture_binding_index = 1;
actions.texture_layout_set = 2;
actions.base_uniform_string = "material.";
+ actions.base_varying_index = 10;
actions.default_filter = ShaderLanguage::FILTER_LINEAR_MIPMAP;
actions.default_repeat = ShaderLanguage::REPEAT_ENABLE;
diff --git a/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp
index 7cf93a82e0..e73efa1e12 100644
--- a/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp
+++ b/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp
@@ -1649,6 +1649,7 @@ void RasterizerStorageRD::MaterialData::update_textures(const Map<StringName, Va
if (!texture.is_valid()) {
const Map<StringName, RID>::Element *W = p_default_textures.find(uniform_name);
if (W) {
+
texture = W->get();
}
}
@@ -1673,11 +1674,12 @@ void RasterizerStorageRD::MaterialData::update_textures(const Map<StringName, Va
} break;
}
} else {
- bool srgb = p_use_linear_color && p_texture_uniforms[i].hint == ShaderLanguage::ShaderNode::Uniform::HINT_ALBEDO || p_texture_uniforms[i].hint == ShaderLanguage::ShaderNode::Uniform::HINT_BLACK_ALBEDO;
+ bool srgb = p_use_linear_color && (p_texture_uniforms[i].hint == ShaderLanguage::ShaderNode::Uniform::HINT_ALBEDO || p_texture_uniforms[i].hint == ShaderLanguage::ShaderNode::Uniform::HINT_BLACK_ALBEDO);
Texture *tex = singleton->texture_owner.getornull(texture);
if (tex) {
+
rd_texture = (srgb && tex->rd_texture_srgb.is_valid()) ? tex->rd_texture_srgb : tex->rd_texture;
#ifdef TOOLS_ENABLED
if (tex->detect_3d_callback && p_use_linear_color) {
diff --git a/servers/visual/rasterizer_rd/shader_compiler_rd.cpp b/servers/visual/rasterizer_rd/shader_compiler_rd.cpp
index 1aa48a82fc..4572345334 100644
--- a/servers/visual/rasterizer_rd/shader_compiler_rd.cpp
+++ b/servers/visual/rasterizer_rd/shader_compiler_rd.cpp
@@ -366,7 +366,7 @@ String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, Ge
r_gen_code.fragment_global += ucode;
GeneratedCode::Texture texture;
- texture.name = _mkid(E->key());
+ texture.name = E->key();
texture.hint = E->get().hint;
texture.type = E->get().type;
texture.filter = E->get().filter;
@@ -452,6 +452,8 @@ String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, Ge
}
#endif
+ uint32_t index = p_default_actions.base_varying_index;
+
for (Map<StringName, SL::ShaderNode::Varying>::Element *E = pnode->varyings.front(); E; E = E->next()) {
String vcode;
@@ -460,8 +462,9 @@ String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, Ge
vcode += _typestr(E->get().type);
vcode += " " + _mkid(E->key());
vcode += ";\n";
- r_gen_code.vertex_global += interp_mode + "out " + vcode;
- r_gen_code.fragment_global += interp_mode + "in " + vcode;
+ r_gen_code.vertex_global += "layout(location=" + itos(index) + ") " + interp_mode + "out " + vcode;
+ r_gen_code.fragment_global += "layout(location=" + itos(index) + ") " + interp_mode + "in " + vcode;
+ index++;
}
for (Map<StringName, SL::ShaderNode::Constant>::Element *E = pnode->constants.front(); E; E = E->next()) {
diff --git a/servers/visual/rasterizer_rd/shader_compiler_rd.h b/servers/visual/rasterizer_rd/shader_compiler_rd.h
index 3572a73a2d..67fc39005a 100644
--- a/servers/visual/rasterizer_rd/shader_compiler_rd.h
+++ b/servers/visual/rasterizer_rd/shader_compiler_rd.h
@@ -53,9 +53,10 @@ public:
ShaderLanguage::TextureFilter default_filter;
ShaderLanguage::TextureRepeat default_repeat;
String sampler_array_name;
- int base_texture_binding_index;
- int texture_layout_set;
+ int base_texture_binding_index = 0;
+ int texture_layout_set = 0;
String base_uniform_string;
+ uint32_t base_varying_index = 0;
};
private:
diff --git a/servers/visual/rasterizer_rd/shaders/scene_forward.glsl b/servers/visual/rasterizer_rd/shaders/scene_forward.glsl
index 1bd11c4288..bacf6f3e67 100644
--- a/servers/visual/rasterizer_rd/shaders/scene_forward.glsl
+++ b/servers/visual/rasterizer_rd/shaders/scene_forward.glsl
@@ -351,6 +351,8 @@ layout(location = 0) out vec4 frag_color;
// E. Heitz, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs", J. Comp. Graph. Tech. 3 (2) (2014).
// Eqns 71-72 and 85-86 (see also Eqns 43 and 80).
+#if !defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED)
+
float G_GGX_2cos(float cos_theta_m, float alpha) {
// Schlick's approximation
// C. Schlick, "An Inexpensive BRDF Model for Physically-based Rendering", Computer Graphics Forum. 13 (3): 233 (1994)
@@ -892,6 +894,10 @@ void reflection_process(uint ref_index, vec3 vertex, vec3 normal,float roughness
}
#endif //USE_LIGHTMAP
}
+
+#endif //!defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED)
+
+
void main() {
#ifdef MODE_DUAL_PARABOLOID
@@ -1030,7 +1036,8 @@ FRAGMENT_SHADER_CODE
vec3 diffuse_light = vec3(0.0, 0.0, 0.0);
vec3 ambient_light = vec3( 0.0, 0.0, 0.0);
-#ifndef MODE_RENDER_DEPTH
+#if !defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED)
+
if (scene_data.use_reflection_cubemap){
vec3 ref_vec = reflect(-view, normal);
@@ -1070,7 +1077,8 @@ FRAGMENT_SHADER_CODE
}
#endif // USE_LIGHTMAP
-#endif // MODE_RENDER_DEPTH
+#endif //!defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED)
+
//radiance
@@ -1080,7 +1088,7 @@ FRAGMENT_SHADER_CODE
specular_blob_intensity *= specular * 2.0;
#endif
-#ifndef MODE_RENDER_DEPTH
+#if !defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED)
//gi probes
//lightmap
@@ -1306,7 +1314,7 @@ FRAGMENT_SHADER_CODE
}
-#endif //!MODE_RENDER_DEPTH
+
#ifdef USE_SHADOW_TO_OPACITY
alpha = min(alpha, clamp(length(ambient_light), 0.0, 1.0));
@@ -1327,6 +1335,7 @@ FRAGMENT_SHADER_CODE
#endif // USE_SHADOW_TO_OPACITY
+#endif //!defined(MODE_RENDER_DEPTH) && !defined(MODE_UNSHADED)
#ifdef MODE_RENDER_DEPTH
@@ -1351,7 +1360,7 @@ FRAGMENT_SHADER_CODE
#ifdef MODE_MULTIPLE_RENDER_TARGETS
-#ifdef USE_NO_SHADING
+#ifdef MODE_UNSHADED
diffuse_buffer = vec4(albedo.rgb, 0.0);
specular_buffer = vec4(0.0);
@@ -1364,7 +1373,7 @@ FRAGMENT_SHADER_CODE
#else //MODE_MULTIPLE_RENDER_TARGETS
-#ifdef USE_NO_SHADING
+#ifdef MODE_UNSHADED
frag_color = vec4(albedo, alpha);
#else
frag_color = vec4(emission + ambient_light + diffuse_light + specular_light, alpha);
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index 5ef51e3e1a..d405dade6f 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -5169,143 +5169,145 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
if (tk.type == TK_COLON) {
//hint
-
- tk = _get_token();
- if (tk.type == TK_HINT_WHITE_TEXTURE) {
- uniform2.hint = ShaderNode::Uniform::HINT_WHITE;
- } else if (tk.type == TK_HINT_BLACK_TEXTURE) {
- uniform2.hint = ShaderNode::Uniform::HINT_BLACK;
- } else if (tk.type == TK_HINT_NORMAL_TEXTURE) {
- uniform2.hint = ShaderNode::Uniform::HINT_NORMAL;
- } else if (tk.type == TK_HINT_ROUGHNESS_NORMAL_TEXTURE) {
- uniform2.hint = ShaderNode::Uniform::HINT_ROUGHNESS_NORMAL;
- } else if (tk.type == TK_HINT_ROUGHNESS_R) {
- uniform2.hint = ShaderNode::Uniform::HINT_ROUGHNESS_R;
- } else if (tk.type == TK_HINT_ROUGHNESS_G) {
- uniform2.hint = ShaderNode::Uniform::HINT_ROUGHNESS_G;
- } else if (tk.type == TK_HINT_ROUGHNESS_B) {
- uniform2.hint = ShaderNode::Uniform::HINT_ROUGHNESS_B;
- } else if (tk.type == TK_HINT_ROUGHNESS_A) {
- uniform2.hint = ShaderNode::Uniform::HINT_ROUGHNESS_A;
- } else if (tk.type == TK_HINT_ROUGHNESS_GRAY) {
- uniform2.hint = ShaderNode::Uniform::HINT_ROUGHNESS_GRAY;
- } else if (tk.type == TK_HINT_ANISO_TEXTURE) {
- uniform2.hint = ShaderNode::Uniform::HINT_ANISO;
- } else if (tk.type == TK_HINT_ALBEDO_TEXTURE) {
- uniform2.hint = ShaderNode::Uniform::HINT_ALBEDO;
- } else if (tk.type == TK_HINT_BLACK_ALBEDO_TEXTURE) {
- uniform2.hint = ShaderNode::Uniform::HINT_BLACK_ALBEDO;
- } else if (tk.type == TK_HINT_COLOR) {
- if (type != TYPE_VEC4) {
- _set_error("Color hint is for vec4 only");
- return ERR_PARSE_ERROR;
- }
- uniform2.hint = ShaderNode::Uniform::HINT_COLOR;
- } else if (tk.type == TK_HINT_RANGE) {
-
- uniform2.hint = ShaderNode::Uniform::HINT_RANGE;
- if (type != TYPE_FLOAT && type != TYPE_INT) {
- _set_error("Range hint is for float and int only");
- return ERR_PARSE_ERROR;
- }
-
- tk = _get_token();
- if (tk.type != TK_PARENTHESIS_OPEN) {
- _set_error("Expected '(' after hint_range");
- return ERR_PARSE_ERROR;
- }
-
+ do {
tk = _get_token();
+ if (tk.type == TK_HINT_WHITE_TEXTURE) {
+ uniform2.hint = ShaderNode::Uniform::HINT_WHITE;
+ } else if (tk.type == TK_HINT_BLACK_TEXTURE) {
+ uniform2.hint = ShaderNode::Uniform::HINT_BLACK;
+ } else if (tk.type == TK_HINT_NORMAL_TEXTURE) {
+ uniform2.hint = ShaderNode::Uniform::HINT_NORMAL;
+ } else if (tk.type == TK_HINT_ROUGHNESS_NORMAL_TEXTURE) {
+ uniform2.hint = ShaderNode::Uniform::HINT_ROUGHNESS_NORMAL;
+ } else if (tk.type == TK_HINT_ROUGHNESS_R) {
+ uniform2.hint = ShaderNode::Uniform::HINT_ROUGHNESS_R;
+ } else if (tk.type == TK_HINT_ROUGHNESS_G) {
+ uniform2.hint = ShaderNode::Uniform::HINT_ROUGHNESS_G;
+ } else if (tk.type == TK_HINT_ROUGHNESS_B) {
+ uniform2.hint = ShaderNode::Uniform::HINT_ROUGHNESS_B;
+ } else if (tk.type == TK_HINT_ROUGHNESS_A) {
+ uniform2.hint = ShaderNode::Uniform::HINT_ROUGHNESS_A;
+ } else if (tk.type == TK_HINT_ROUGHNESS_GRAY) {
+ uniform2.hint = ShaderNode::Uniform::HINT_ROUGHNESS_GRAY;
+ } else if (tk.type == TK_HINT_ANISO_TEXTURE) {
+ uniform2.hint = ShaderNode::Uniform::HINT_ANISO;
+ } else if (tk.type == TK_HINT_ALBEDO_TEXTURE) {
+ uniform2.hint = ShaderNode::Uniform::HINT_ALBEDO;
+ } else if (tk.type == TK_HINT_BLACK_ALBEDO_TEXTURE) {
+ uniform2.hint = ShaderNode::Uniform::HINT_BLACK_ALBEDO;
+ } else if (tk.type == TK_HINT_COLOR) {
+ if (type != TYPE_VEC4) {
+ _set_error("Color hint is for vec4 only");
+ return ERR_PARSE_ERROR;
+ }
+ uniform2.hint = ShaderNode::Uniform::HINT_COLOR;
+ } else if (tk.type == TK_HINT_RANGE) {
- float sign = 1.0;
+ uniform2.hint = ShaderNode::Uniform::HINT_RANGE;
+ if (type != TYPE_FLOAT && type != TYPE_INT) {
+ _set_error("Range hint is for float and int only");
+ return ERR_PARSE_ERROR;
+ }
- if (tk.type == TK_OP_SUB) {
- sign = -1.0;
tk = _get_token();
- }
-
- if (tk.type != TK_REAL_CONSTANT && tk.type != TK_INT_CONSTANT) {
- _set_error("Expected integer constant");
- return ERR_PARSE_ERROR;
- }
+ if (tk.type != TK_PARENTHESIS_OPEN) {
+ _set_error("Expected '(' after hint_range");
+ return ERR_PARSE_ERROR;
+ }
- uniform2.hint_range[0] = tk.constant;
- uniform2.hint_range[0] *= sign;
+ tk = _get_token();
- tk = _get_token();
+ float sign = 1.0;
- if (tk.type != TK_COMMA) {
- _set_error("Expected ',' after integer constant");
- return ERR_PARSE_ERROR;
- }
+ if (tk.type == TK_OP_SUB) {
+ sign = -1.0;
+ tk = _get_token();
+ }
- tk = _get_token();
+ if (tk.type != TK_REAL_CONSTANT && tk.type != TK_INT_CONSTANT) {
+ _set_error("Expected integer constant");
+ return ERR_PARSE_ERROR;
+ }
- sign = 1.0;
+ uniform2.hint_range[0] = tk.constant;
+ uniform2.hint_range[0] *= sign;
- if (tk.type == TK_OP_SUB) {
- sign = -1.0;
tk = _get_token();
- }
- if (tk.type != TK_REAL_CONSTANT && tk.type != TK_INT_CONSTANT) {
- _set_error("Expected integer constant after ','");
- return ERR_PARSE_ERROR;
- }
+ if (tk.type != TK_COMMA) {
+ _set_error("Expected ',' after integer constant");
+ return ERR_PARSE_ERROR;
+ }
- uniform2.hint_range[1] = tk.constant;
- uniform2.hint_range[1] *= sign;
+ tk = _get_token();
- tk = _get_token();
+ sign = 1.0;
- if (tk.type == TK_COMMA) {
- tk = _get_token();
+ if (tk.type == TK_OP_SUB) {
+ sign = -1.0;
+ tk = _get_token();
+ }
if (tk.type != TK_REAL_CONSTANT && tk.type != TK_INT_CONSTANT) {
_set_error("Expected integer constant after ','");
return ERR_PARSE_ERROR;
}
- uniform2.hint_range[2] = tk.constant;
+ uniform2.hint_range[1] = tk.constant;
+ uniform2.hint_range[1] *= sign;
+
tk = _get_token();
- } else {
- if (type == TYPE_INT) {
- uniform2.hint_range[2] = 1;
+
+ if (tk.type == TK_COMMA) {
+ tk = _get_token();
+
+ if (tk.type != TK_REAL_CONSTANT && tk.type != TK_INT_CONSTANT) {
+ _set_error("Expected integer constant after ','");
+ return ERR_PARSE_ERROR;
+ }
+
+ uniform2.hint_range[2] = tk.constant;
+ tk = _get_token();
} else {
- uniform2.hint_range[2] = 0.001;
+ if (type == TYPE_INT) {
+ uniform2.hint_range[2] = 1;
+ } else {
+ uniform2.hint_range[2] = 0.001;
+ }
+ }
+
+ if (tk.type != TK_PARENTHESIS_CLOSE) {
+ _set_error("Expected ','");
+ return ERR_PARSE_ERROR;
}
+ } else if (tk.type == TK_FILTER_LINEAR) {
+ uniform2.filter = FILTER_LINEAR;
+ } else if (tk.type == TK_FILTER_NEAREST) {
+ uniform2.filter = FILTER_NEAREST;
+ } else if (tk.type == TK_FILTER_NEAREST_MIPMAP) {
+ uniform2.filter = FILTER_NEAREST_MIPMAP;
+ } else if (tk.type == TK_FILTER_LINEAR_MIPMAP) {
+ uniform2.filter = FILTER_LINEAR_MIPMAP;
+ } else if (tk.type == TK_FILTER_NEAREST_MIPMAP_ANISO) {
+ uniform2.filter = FILTER_NEAREST_MIPMAP_ANISO;
+ } else if (tk.type == TK_FILTER_LINEAR_MIPMAP_ANISO) {
+ uniform2.filter = FILTER_LINEAR_MIPMAP_ANISO;
+ } else if (tk.type == TK_REPEAT_DISABLE) {
+ uniform2.repeat = REPEAT_DISABLE;
+ } else if (tk.type == TK_REPEAT_ENABLE) {
+ uniform2.repeat = REPEAT_ENABLE;
+ } else {
+ _set_error("Expected valid type hint after ':'.");
}
- if (tk.type != TK_PARENTHESIS_CLOSE) {
- _set_error("Expected ','");
+ if (uniform2.hint != ShaderNode::Uniform::HINT_RANGE && uniform2.hint != ShaderNode::Uniform::HINT_NONE && uniform2.hint != ShaderNode::Uniform::HINT_COLOR && type <= TYPE_MAT4) {
+ _set_error("This hint is only for sampler types");
return ERR_PARSE_ERROR;
}
- } else if (tk.type == TK_FILTER_LINEAR) {
- uniform2.filter = FILTER_LINEAR;
- } else if (tk.type == TK_FILTER_NEAREST) {
- uniform2.filter = FILTER_NEAREST;
- } else if (tk.type == TK_FILTER_NEAREST_MIPMAP) {
- uniform2.filter = FILTER_NEAREST_MIPMAP;
- } else if (tk.type == TK_FILTER_LINEAR_MIPMAP) {
- uniform2.filter = FILTER_LINEAR_MIPMAP;
- } else if (tk.type == TK_FILTER_NEAREST_MIPMAP_ANISO) {
- uniform2.filter = FILTER_NEAREST_MIPMAP_ANISO;
- } else if (tk.type == TK_FILTER_LINEAR_MIPMAP_ANISO) {
- uniform2.filter = FILTER_LINEAR_MIPMAP_ANISO;
- } else if (tk.type == TK_REPEAT_DISABLE) {
- uniform2.repeat = REPEAT_DISABLE;
- } else if (tk.type == TK_REPEAT_ENABLE) {
- uniform2.repeat = REPEAT_ENABLE;
- } else {
- _set_error("Expected valid type hint after ':'.");
- }
- if (uniform2.hint != ShaderNode::Uniform::HINT_RANGE && uniform2.hint != ShaderNode::Uniform::HINT_NONE && uniform2.hint != ShaderNode::Uniform::HINT_COLOR && type <= TYPE_MAT4) {
- _set_error("This hint is only for sampler types");
- return ERR_PARSE_ERROR;
- }
+ tk = _get_token();
- tk = _get_token();
+ } while (tk.type == TK_COMMA);
}
if (tk.type == TK_OP_ASSIGN) {