diff options
author | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2023-09-09 17:46:44 +0200 |
---|---|---|
committer | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2023-09-12 20:13:32 +0200 |
commit | 3565d1bf7ebd2e36556736479cb8ba9523d70a63 (patch) | |
tree | 0824bb3429bf999f2cbb3e405ae21ffd118fd617 /drivers/gles3/storage/material_storage.cpp | |
parent | 3ed4497113fa10611b90290ce22a751fb9d26e2e (diff) | |
download | redot-engine-3565d1bf7ebd2e36556736479cb8ba9523d70a63.tar.gz |
[Drivers,Platform] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable
Diffstat (limited to 'drivers/gles3/storage/material_storage.cpp')
-rw-r--r-- | drivers/gles3/storage/material_storage.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp index 32b62ee605..600672b7ef 100644 --- a/drivers/gles3/storage/material_storage.cpp +++ b/drivers/gles3/storage/material_storage.cpp @@ -2137,7 +2137,7 @@ void MaterialStorage::shader_initialize(RID p_rid) { void MaterialStorage::shader_free(RID p_rid) { GLES3::Shader *shader = shader_owner.get_or_null(p_rid); - ERR_FAIL_COND(!shader); + ERR_FAIL_NULL(shader); //make material unreference this while (shader->owners.size()) { @@ -2153,7 +2153,7 @@ void MaterialStorage::shader_free(RID p_rid) { void MaterialStorage::shader_set_code(RID p_shader, const String &p_code) { GLES3::Shader *shader = shader_owner.get_or_null(p_shader); - ERR_FAIL_COND(!shader); + ERR_FAIL_NULL(shader); shader->code = p_code; @@ -2231,7 +2231,7 @@ void MaterialStorage::shader_set_code(RID p_shader, const String &p_code) { void MaterialStorage::shader_set_path_hint(RID p_shader, const String &p_path) { GLES3::Shader *shader = shader_owner.get_or_null(p_shader); - ERR_FAIL_COND(!shader); + ERR_FAIL_NULL(shader); shader->path_hint = p_path; if (shader->data) { @@ -2241,13 +2241,13 @@ void MaterialStorage::shader_set_path_hint(RID p_shader, const String &p_path) { String MaterialStorage::shader_get_code(RID p_shader) const { const GLES3::Shader *shader = shader_owner.get_or_null(p_shader); - ERR_FAIL_COND_V(!shader, String()); + ERR_FAIL_NULL_V(shader, String()); return shader->code; } void MaterialStorage::get_shader_parameter_list(RID p_shader, List<PropertyInfo> *p_param_list) const { GLES3::Shader *shader = shader_owner.get_or_null(p_shader); - ERR_FAIL_COND(!shader); + ERR_FAIL_NULL(shader); if (shader->data) { return shader->data->get_shader_uniform_list(p_param_list); } @@ -2255,7 +2255,7 @@ void MaterialStorage::get_shader_parameter_list(RID p_shader, List<PropertyInfo> void MaterialStorage::shader_set_default_texture_parameter(RID p_shader, const StringName &p_name, RID p_texture, int p_index) { GLES3::Shader *shader = shader_owner.get_or_null(p_shader); - ERR_FAIL_COND(!shader); + ERR_FAIL_NULL(shader); if (p_texture.is_valid() && TextureStorage::get_singleton()->owns_texture(p_texture)) { if (!shader->default_texture_parameter.has(p_name)) { @@ -2282,7 +2282,7 @@ void MaterialStorage::shader_set_default_texture_parameter(RID p_shader, const S RID MaterialStorage::shader_get_default_texture_parameter(RID p_shader, const StringName &p_name, int p_index) const { const GLES3::Shader *shader = shader_owner.get_or_null(p_shader); - ERR_FAIL_COND_V(!shader, RID()); + ERR_FAIL_NULL_V(shader, RID()); if (shader->default_texture_parameter.has(p_name) && shader->default_texture_parameter[p_name].has(p_index)) { return shader->default_texture_parameter[p_name][p_index]; } @@ -2292,7 +2292,7 @@ RID MaterialStorage::shader_get_default_texture_parameter(RID p_shader, const St Variant MaterialStorage::shader_get_parameter_default(RID p_shader, const StringName &p_param) const { Shader *shader = shader_owner.get_or_null(p_shader); - ERR_FAIL_COND_V(!shader, Variant()); + ERR_FAIL_NULL_V(shader, Variant()); if (shader->data) { return shader->data->get_default_parameter(p_param); } @@ -2301,7 +2301,7 @@ Variant MaterialStorage::shader_get_parameter_default(RID p_shader, const String RS::ShaderNativeSourceCode MaterialStorage::shader_get_native_source_code(RID p_shader) const { Shader *shader = shader_owner.get_or_null(p_shader); - ERR_FAIL_COND_V(!shader, RS::ShaderNativeSourceCode()); + ERR_FAIL_NULL_V(shader, RS::ShaderNativeSourceCode()); if (shader->data) { return shader->data->get_native_source_code(); } @@ -2347,7 +2347,7 @@ void MaterialStorage::material_initialize(RID p_rid) { void MaterialStorage::material_free(RID p_rid) { Material *material = material_owner.get_or_null(p_rid); - ERR_FAIL_COND(!material); + ERR_FAIL_NULL(material); // Need to clear texture arrays to prevent spin locking of their RID's. // This happens when the app is being closed. @@ -2365,7 +2365,7 @@ void MaterialStorage::material_free(RID p_rid) { void MaterialStorage::material_set_shader(RID p_material, RID p_shader) { GLES3::Material *material = material_owner.get_or_null(p_material); - ERR_FAIL_COND(!material); + ERR_FAIL_NULL(material); if (material->data) { memdelete(material->data); @@ -2385,7 +2385,7 @@ void MaterialStorage::material_set_shader(RID p_material, RID p_shader) { } Shader *shader = get_shader(p_shader); - ERR_FAIL_COND(!shader); + ERR_FAIL_NULL(shader); material->shader = shader; material->shader_mode = shader->mode; material->shader_id = p_shader.get_local_index(); @@ -2408,7 +2408,7 @@ void MaterialStorage::material_set_shader(RID p_material, RID p_shader) { void MaterialStorage::material_set_param(RID p_material, const StringName &p_param, const Variant &p_value) { GLES3::Material *material = material_owner.get_or_null(p_material); - ERR_FAIL_COND(!material); + ERR_FAIL_NULL(material); if (p_value.get_type() == Variant::NIL) { material->params.erase(p_param); @@ -2427,7 +2427,7 @@ void MaterialStorage::material_set_param(RID p_material, const StringName &p_par Variant MaterialStorage::material_get_param(RID p_material, const StringName &p_param) const { const GLES3::Material *material = material_owner.get_or_null(p_material); - ERR_FAIL_COND_V(!material, Variant()); + ERR_FAIL_NULL_V(material, Variant()); if (material->params.has(p_param)) { return material->params[p_param]; } else { @@ -2437,7 +2437,7 @@ Variant MaterialStorage::material_get_param(RID p_material, const StringName &p_ void MaterialStorage::material_set_next_pass(RID p_material, RID p_next_material) { GLES3::Material *material = material_owner.get_or_null(p_material); - ERR_FAIL_COND(!material); + ERR_FAIL_NULL(material); if (material->next_pass == p_next_material) { return; @@ -2456,7 +2456,7 @@ void MaterialStorage::material_set_render_priority(RID p_material, int priority) ERR_FAIL_COND(priority > RS::MATERIAL_RENDER_PRIORITY_MAX); GLES3::Material *material = material_owner.get_or_null(p_material); - ERR_FAIL_COND(!material); + ERR_FAIL_NULL(material); material->priority = priority; if (material->data) { material->data->set_render_priority(priority); @@ -2466,7 +2466,7 @@ void MaterialStorage::material_set_render_priority(RID p_material, int priority) bool MaterialStorage::material_is_animated(RID p_material) { GLES3::Material *material = material_owner.get_or_null(p_material); - ERR_FAIL_COND_V(!material, false); + ERR_FAIL_NULL_V(material, false); if (material->shader && material->shader->data) { if (material->shader->data->is_animated()) { return true; @@ -2479,7 +2479,7 @@ bool MaterialStorage::material_is_animated(RID p_material) { bool MaterialStorage::material_casts_shadows(RID p_material) { GLES3::Material *material = material_owner.get_or_null(p_material); - ERR_FAIL_COND_V(!material, true); + ERR_FAIL_NULL_V(material, true); if (material->shader && material->shader->data) { if (material->shader->data->casts_shadows()) { return true; @@ -2492,7 +2492,7 @@ bool MaterialStorage::material_casts_shadows(RID p_material) { void MaterialStorage::material_get_instance_shader_parameters(RID p_material, List<InstanceShaderParam> *r_parameters) { GLES3::Material *material = material_owner.get_or_null(p_material); - ERR_FAIL_COND(!material); + ERR_FAIL_NULL(material); if (material->shader && material->shader->data) { material->shader->data->get_instance_param_list(r_parameters); @@ -2504,7 +2504,7 @@ void MaterialStorage::material_get_instance_shader_parameters(RID p_material, Li void MaterialStorage::material_update_dependency(RID p_material, DependencyTracker *p_instance) { Material *material = material_owner.get_or_null(p_material); - ERR_FAIL_COND(!material); + ERR_FAIL_NULL(material); p_instance->update_dependency(&material->dependency); if (material->next_pass.is_valid()) { material_update_dependency(material->next_pass, p_instance); |