Cleanup: Compositor: Omit default case for ResultType

Explicitly list all result types to make it easier to add new result
types.
This commit is contained in:
Omar Emara
2025-01-02 14:42:44 +02:00
parent b6be52c2b2
commit 0ec7edf411
4 changed files with 40 additions and 20 deletions

View File

@@ -46,8 +46,10 @@ void InputSingleValueOperation::execute()
case ResultType::Color:
result.set_single_value(float4(bsocket->default_value_typed<bNodeSocketValueRGBA>()->value));
break;
default:
/* Other types are internal and needn't be handled by operations. */
case ResultType::Float2:
case ResultType::Float3:
case ResultType::Int2:
/* Those types are internal and needn't be handled by operations. */
BLI_assert_unreachable();
break;
}

View File

@@ -61,8 +61,10 @@ static const CPPType &get_cpp_type(ResultType type)
case ResultType::Vector:
case ResultType::Color:
return CPPType::get<float4>();
default:
/* Other types are internal and needn't be handled by operations. */
case ResultType::Float2:
case ResultType::Float3:
case ResultType::Int2:
/* Those types are internal and needn't be handled by operations. */
break;
}
@@ -84,8 +86,10 @@ static void add_single_value_parameter(mf::ParamsBuilder &parameter_builder, con
case ResultType::Vector:
parameter_builder.add_readonly_single_input_value(input.get_single_value<float4>());
return;
default:
/* Other types are internal and needn't be handled by operations. */
case ResultType::Float2:
case ResultType::Float3:
case ResultType::Int2:
/* Those types are internal and needn't be handled by operations. */
BLI_assert_unreachable();
break;
}

View File

@@ -53,8 +53,10 @@ void ReduceToSingleValueOperation::execute()
case ResultType::Float:
result.set_single_value(*pixel);
break;
default:
/* Other types are internal and needn't be handled by operations. */
case ResultType::Float2:
case ResultType::Float3:
case ResultType::Int2:
/* Those types are internal and needn't be handled by operations. */
BLI_assert_unreachable();
break;
}

View File

@@ -208,8 +208,10 @@ static const char *get_set_function_name(ResultType type)
return "set_rgb";
case ResultType::Color:
return "set_rgba";
default:
/* Other types are internal and needn't be handled by operations. */
case ResultType::Float2:
case ResultType::Float3:
case ResultType::Int2:
/* Those types are internal and needn't be handled by operations. */
break;
}
@@ -288,8 +290,10 @@ static const char *get_store_function_name(ResultType type)
return "node_compositor_store_output_vector";
case ResultType::Color:
return "node_compositor_store_output_color";
default:
/* Other types are internal and needn't be handled by operations. */
case ResultType::Float2:
case ResultType::Float3:
case ResultType::Int2:
/* Those types are internal and needn't be handled by operations. */
break;
}
@@ -383,8 +387,10 @@ static const char *glsl_store_expression_from_result_type(ResultType type)
return "vec4(vector, 0.0)";
case ResultType::Color:
return "color";
default:
/* Other types are internal and needn't be handled by operations. */
case ResultType::Float2:
case ResultType::Float3:
case ResultType::Int2:
/* Those types are internal and needn't be handled by operations. */
break;
}
@@ -449,8 +455,10 @@ void ShaderOperation::generate_code_for_outputs(ShaderCreateInfo &shader_create_
case ResultType::Color:
store_color_function << case_code.str();
break;
default:
/* Other types are internal and needn't be handled by operations. */
case ResultType::Float2:
case ResultType::Float3:
case ResultType::Int2:
/* Those types are internal and needn't be handled by operations. */
BLI_assert_unreachable();
break;
}
@@ -476,8 +484,10 @@ static const char *glsl_type_from_result_type(ResultType type)
return "vec3";
case ResultType::Color:
return "vec4";
default:
/* Other types are internal and needn't be handled by operations. */
case ResultType::Float2:
case ResultType::Float3:
case ResultType::Int2:
/* Those types are internal and needn't be handled by operations. */
break;
}
@@ -496,8 +506,10 @@ static const char *glsl_swizzle_from_result_type(ResultType type)
return "xyz";
case ResultType::Color:
return "rgba";
default:
/* Other types are internal and needn't be handled by operations. */
case ResultType::Float2:
case ResultType::Float3:
case ResultType::Int2:
/* Those types are internal and needn't be handled by operations. */
break;
}