83 if (
input.is_single_value()) {
84 result.allocate_single_value();
90 if (this->
context().use_gpu()) {
91 const std::string shader_name = fmt::format(
"compositor_convert_{}_to_{}",
100 float luminance_coefficients[3];
105 input.bind_as_texture(shader,
"input_tx");
106 result.bind_as_image(shader,
"output_img");
110 input.unbind_as_texture();
120 const Result &input_result,
129 if (result_type != expected_type) {
159void ConversionOperation::execute_single(
const Result &
input, Result &
output)
164 output.update_single_value_data();
175 result.cpu_data().size());
187 result.cpu_data().size());
193void ConversionOperation::execute_cpu(
const Result &
input, Result &
output)
#define BLI_assert_unreachable()
void GPU_shader_uniform_3fv(blender::gpu::Shader *sh, const char *name, const float data[3])
void GPU_shader_bind(blender::gpu::Shader *shader, const blender::gpu::shader::SpecializationConstants *constants_state=nullptr)
BLI_INLINE void IMB_colormanagement_get_luminance_coefficients(float r_rgb[3])
static const CPPType & get()
void convert_to_initialized_n(GSpan from_span, GMutableSpan to_span) const
Result create_result(ResultType type, ResultPrecision precision)
gpu::Shader * get_shader(const char *info_name, ResultPrecision precision)
static SimpleOperation * construct_if_needed(Context &context, const Result &input_result, const InputDescriptor &input_descriptor)
ConversionOperation(Context &context, const ResultType input_type, const ResultType expected_type)
Context & context() const
static const char * type_name(const ResultType type)
static ResultType type(blender::gpu::TextureFormat format)
void declare_input_descriptor(InputDescriptor descriptor)
void populate_result(Result result)
const DataTypeConversions & get_implicit_type_conversions()
void compute_dispatch_threads_at_least(gpu::Shader *shader, int2 threads_range, int2 local_size=int2(16))
static GSpan get_result_data(const Result &result)
static GSpan get_result_single_value(const Result &result)
static bool is_conversion_supported(const ResultType from_type, const ResultType to_type)
static Type to_type(const GPUType type)