Refactor: Remove concept of temporary result

Temporary results are essentially results with a default reference count
of 1, so we default to 1 for all results and set the initial reference
count differently as need.
This commit is contained in:
Omar Emara
2024-08-06 19:37:18 +03:00
parent fae2195553
commit 885db0986c
26 changed files with 77 additions and 120 deletions

View File

@@ -169,14 +169,6 @@ class Context {
/* Create a result of the given type using the context's precision. */
Result create_result(ResultType type);
/* Create a temporary result of the given type and precision; See Result::Temporary for more
* information. */
Result create_temporary_result(ResultType type, ResultPrecision precision);
/* Create a temporary result of the given type using the context's precision. See
* Result::Temporary for more information. */
Result create_temporary_result(ResultType type);
/* Get a reference to the texture pool of this context. */
TexturePool &texture_pool();

View File

@@ -100,13 +100,13 @@ class Result {
* reference count is decremented, until it reaches zero, where the result's texture is then
* released. If this result have a master result, then this reference count is irrelevant and
* shadowed by the reference count of the master result. */
int reference_count_;
int reference_count_ = 1;
/* The number of operations that reference and use this result at the time when it was initially
* computed. Since reference_count_ is decremented and always becomes zero at the end of the
* evaluation, this member is used to reset the reference count of the results for later
* evaluations by calling the reset method. This member is also used to determine if this result
* should be computed by calling the should_compute method. */
int initial_reference_count_;
int initial_reference_count_ = 1;
/* If the result is a single value, this member stores the value of the result, the value of
* which will be identical to that stored in the texture member. The active union member depends
* on the type of the result. This member is uninitialized and should not be used if the result
@@ -139,11 +139,6 @@ class Result {
/* Construct a result of the given type and precision within the given context. */
Result(Context &context, ResultType type, ResultPrecision precision);
/* Identical to the standard constructor but initializes the reference count to 1. This is useful
* to construct temporary results that are created and released by the developer manually, which
* are typically used in operations that need temporary intermediate results. */
static Result Temporary(Context &context, ResultType type, ResultPrecision precision);
/* Returns the appropriate texture format based on the given result type and precision. */
static eGPUTextureFormat texture_format(ResultType type, ResultPrecision precision);

View File

@@ -79,11 +79,11 @@ static void blur_pass(Context &context, Result &input, Result &output, float sig
const Domain domain = input.domain();
Result causal_result = context.create_temporary_result(ResultType::Color);
Result causal_result = context.create_result(ResultType::Color);
causal_result.allocate_texture(domain);
causal_result.bind_as_image(shader, "causal_output_img");
Result non_causal_result = context.create_temporary_result(ResultType::Color);
Result non_causal_result = context.create_result(ResultType::Color);
non_causal_result.allocate_texture(domain);
non_causal_result.bind_as_image(shader, "non_causal_output_img");
@@ -110,7 +110,7 @@ void deriche_gaussian_blur(Context &context, Result &input, Result &output, floa
"Deriche filter is not accurate nor numerically stable for sigma values larger "
"than 32. Use Van Vliet filter instead.");
Result horizontal_pass_result = context.create_temporary_result(ResultType::Color);
Result horizontal_pass_result = context.create_result(ResultType::Color);
blur_pass(context, input, horizontal_pass_result, sigma.x);
blur_pass(context, horizontal_pass_result, output, sigma.y);
horizontal_pass_result.release();

View File

@@ -42,15 +42,13 @@ void jump_flooding(Context &context, Result &input, Result &output)
/* First, run a jump flooding pass with a step size of 1. This initial pass is proposed by the
* 1+FJA variant to improve accuracy. */
Result initial_flooded_result = context.create_temporary_result(ResultType::Int2,
ResultPrecision::Half);
Result initial_flooded_result = context.create_result(ResultType::Int2, ResultPrecision::Half);
initial_flooded_result.allocate_texture(input.domain());
jump_flooding_pass(context, input, initial_flooded_result, 1);
/* We compute the result using a ping-pong buffer, so create an intermediate result. */
Result *result_to_flood = &initial_flooded_result;
Result intermediate_result = context.create_temporary_result(ResultType::Int2,
ResultPrecision::Half);
Result intermediate_result = context.create_result(ResultType::Int2, ResultPrecision::Half);
intermediate_result.allocate_texture(input.domain());
Result *result_after_flooding = &intermediate_result;

View File

@@ -48,7 +48,7 @@ static Result horizontal_pass(Context &context, Result &input, int distance, int
const Domain domain = input.domain();
const int2 transposed_domain = int2(domain.size.y, domain.size.x);
Result output = context.create_temporary_result(ResultType::Float);
Result output = context.create_result(ResultType::Float);
output.allocate_texture(transposed_domain);
output.bind_as_image(shader, "output_img");

View File

@@ -70,7 +70,7 @@ static Result detect_edges(Context &context,
GPU_texture_filter_mode(input.texture(), true);
input.bind_as_texture(shader, "input_tx");
Result edges = context.create_temporary_result(ResultType::Color);
Result edges = context.create_result(ResultType::Color);
edges.allocate_texture(input.domain());
edges.bind_as_image(shader, "edges_img");
@@ -98,7 +98,7 @@ static Result calculate_blending_weights(Context &context, Result &edges, int co
smaa_precomputed_textures.bind_area_texture(shader, "area_tx");
smaa_precomputed_textures.bind_search_texture(shader, "search_tx");
Result weights = context.create_temporary_result(ResultType::Color);
Result weights = context.create_result(ResultType::Color);
weights.allocate_texture(edges.domain());
weights.bind_as_image(shader, "weights_img");

View File

@@ -204,23 +204,19 @@ void summed_area_table(Context &context,
Result &output,
SummedAreaTableOperation operation)
{
Result incomplete_x_prologues = context.create_temporary_result(ResultType::Color,
ResultPrecision::Full);
Result incomplete_y_prologues = context.create_temporary_result(ResultType::Color,
ResultPrecision::Full);
Result incomplete_x_prologues = context.create_result(ResultType::Color, ResultPrecision::Full);
Result incomplete_y_prologues = context.create_result(ResultType::Color, ResultPrecision::Full);
compute_incomplete_prologues(
context, input, operation, incomplete_x_prologues, incomplete_y_prologues);
Result complete_x_prologues = context.create_temporary_result(ResultType::Color,
ResultPrecision::Full);
Result complete_x_prologues_sum = context.create_temporary_result(ResultType::Color,
ResultPrecision::Full);
Result complete_x_prologues = context.create_result(ResultType::Color, ResultPrecision::Full);
Result complete_x_prologues_sum = context.create_result(ResultType::Color,
ResultPrecision::Full);
compute_complete_x_prologues(
context, input, incomplete_x_prologues, complete_x_prologues, complete_x_prologues_sum);
incomplete_x_prologues.release();
Result complete_y_prologues = context.create_temporary_result(ResultType::Color,
ResultPrecision::Full);
Result complete_y_prologues = context.create_result(ResultType::Color, ResultPrecision::Full);
compute_complete_y_prologues(
context, input, incomplete_y_prologues, complete_x_prologues_sum, complete_y_prologues);
incomplete_y_prologues.release();

View File

@@ -77,7 +77,7 @@ static Result horizontal_pass(Context &context,
* pass. */
const int2 transposed_domain = int2(domain.size.y, domain.size.x);
Result output = context.create_temporary_result(input.type());
Result output = context.create_result(input.type());
output.allocate_texture(transposed_domain);
output.bind_as_image(shader, "output_img");

View File

@@ -70,7 +70,7 @@ static Result horizontal_pass(
Domain domain = input.domain();
const int2 transposed_domain = int2(domain.size.y, domain.size.x);
Result output = context.create_temporary_result(input.type());
Result output = context.create_result(input.type());
output.allocate_texture(transposed_domain);
output.bind_as_image(shader, "output_img");

View File

@@ -100,19 +100,19 @@ static void blur_pass(Context &context, Result &input, Result &output, float sig
const Domain domain = input.domain();
Result first_causal_result = context.create_temporary_result(ResultType::Color);
Result first_causal_result = context.create_result(ResultType::Color);
first_causal_result.allocate_texture(domain);
first_causal_result.bind_as_image(shader, "first_causal_output_img");
Result first_non_causal_result = context.create_temporary_result(ResultType::Color);
Result first_non_causal_result = context.create_result(ResultType::Color);
first_non_causal_result.allocate_texture(domain);
first_non_causal_result.bind_as_image(shader, "first_non_causal_output_img");
Result second_causal_result = context.create_temporary_result(ResultType::Color);
Result second_causal_result = context.create_result(ResultType::Color);
second_causal_result.allocate_texture(domain);
second_causal_result.bind_as_image(shader, "second_causal_output_img");
Result second_non_causal_result = context.create_temporary_result(ResultType::Color);
Result second_non_causal_result = context.create_result(ResultType::Color);
second_non_causal_result.allocate_texture(domain);
second_non_causal_result.bind_as_image(shader, "second_non_causal_output_img");
@@ -146,7 +146,7 @@ void van_vliet_gaussian_blur(Context &context, Result &input, Result &output, fl
"Van Vliet filter is less accurate for sigma values less than 32. Use Deriche "
"filter instead or direct convolution instead.");
Result horizontal_pass_result = context.create_temporary_result(ResultType::Color);
Result horizontal_pass_result = context.create_result(ResultType::Color);
blur_pass(context, input, horizontal_pass_result, sigma.x);
blur_pass(context, horizontal_pass_result, output, sigma.y);
horizontal_pass_result.release();

View File

@@ -109,16 +109,6 @@ Result Context::create_result(ResultType type)
return create_result(type, get_precision());
}
Result Context::create_temporary_result(ResultType type, ResultPrecision precision)
{
return Result::Temporary(*this, type, precision);
}
Result Context::create_temporary_result(ResultType type)
{
return create_temporary_result(type, get_precision());
}
TexturePool &Context::texture_pool()
{
return texture_pool_;

View File

@@ -21,14 +21,6 @@ Result::Result(Context &context, ResultType type, ResultPrecision precision)
{
}
Result Result::Temporary(Context &context, ResultType type, ResultPrecision precision)
{
Result result = Result(context, type, precision);
result.set_initial_reference_count(1);
result.reset();
return result;
}
eGPUTextureFormat Result::texture_format(ResultType type, ResultPrecision precision)
{
switch (precision) {

View File

@@ -217,7 +217,7 @@ void compute_preview_from_result(Context &context, const DNode &node, Result &in
input_result.bind_as_texture(shader, "input_tx");
Result preview_result = context.create_temporary_result(ResultType::Color);
Result preview_result = context.create_result(ResultType::Color);
preview_result.allocate_texture(Domain(preview_size));
preview_result.bind_as_image(shader, "preview_img");

View File

@@ -77,7 +77,7 @@ class CornerPinOperation : public NodeOperation {
}
Result plane_mask = compute_plane_mask(homography_matrix);
Result anti_aliased_plane_mask = context().create_temporary_result(ResultType::Float);
Result anti_aliased_plane_mask = context().create_result(ResultType::Float);
smaa(context(), plane_mask, anti_aliased_plane_mask);
plane_mask.release();
@@ -129,7 +129,7 @@ class CornerPinOperation : public NodeOperation {
GPU_shader_uniform_mat3_as_mat4(shader, "homography_matrix", homography_matrix.ptr());
const Domain domain = compute_domain();
Result plane_mask = context().create_temporary_result(ResultType::Float);
Result plane_mask = context().create_result(ResultType::Float);
plane_mask.allocate_texture(domain);
plane_mask.bind_as_image(shader, "mask_img");

View File

@@ -325,7 +325,7 @@ class BaseCryptoMatteOperation : public NodeOperation {
Result compute_matte(Vector<GPUTexture *> &layers)
{
const Domain domain = compute_domain();
Result output_matte = context().create_temporary_result(ResultType::Float);
Result output_matte = context().create_result(ResultType::Float);
output_matte.allocate_texture(domain);
/* Clear the matte to zero to ready it to accumulate the coverage. */

View File

@@ -176,7 +176,7 @@ class DefocusOperation : public NodeOperation {
Result &input_radius = get_input("Z");
input_radius.bind_as_texture(shader, "radius_tx");
Result output_radius = context().create_temporary_result(ResultType::Float);
Result output_radius = context().create_result(ResultType::Float);
const Domain domain = input_radius.domain();
output_radius.allocate_texture(domain);
output_radius.bind_as_image(shader, "radius_img");
@@ -205,7 +205,7 @@ class DefocusOperation : public NodeOperation {
Result &input_depth = get_input("Z");
input_depth.bind_as_texture(shader, "depth_tx");
Result output_radius = context().create_temporary_result(ResultType::Float);
Result output_radius = context().create_result(ResultType::Float);
const Domain domain = input_depth.domain();
output_radius.allocate_texture(domain);
output_radius.bind_as_image(shader, "radius_img");
@@ -221,7 +221,7 @@ class DefocusOperation : public NodeOperation {
* focus---that is, objects whose defocus radius is small---are not affected by nearby out of
* focus objects, hence the use of dilation. */
const float morphological_radius = compute_maximum_defocus_radius();
Result eroded_radius = context().create_temporary_result(ResultType::Float);
Result eroded_radius = context().create_result(ResultType::Float);
morphological_blur(context(), output_radius, eroded_radius, float2(morphological_radius));
output_radius.release();

View File

@@ -125,7 +125,7 @@ class DilateErodeOperation : public NodeOperation {
const Domain domain = compute_domain();
const int2 transposed_domain = int2(domain.size.y, domain.size.x);
Result horizontal_pass_result = context().create_temporary_result(ResultType::Color);
Result horizontal_pass_result = context().create_result(ResultType::Color);
horizontal_pass_result.allocate_texture(transposed_domain);
horizontal_pass_result.bind_as_image(shader, "output_img");
@@ -196,7 +196,7 @@ class DilateErodeOperation : public NodeOperation {
input_mask.bind_as_texture(shader, "input_tx");
const Domain domain = compute_domain();
Result output_mask = context().create_temporary_result(ResultType::Float);
Result output_mask = context().create_result(ResultType::Float);
output_mask.allocate_texture(domain);
output_mask.bind_as_image(shader, "output_img");

View File

@@ -66,18 +66,16 @@ class DoubleEdgeMaskOperation : public NodeOperation {
/* Compute an image that marks the boundary pixels of the masks as seed pixels in the format
* expected by the jump flooding algorithm. */
Result inner_boundary = context().create_temporary_result(ResultType::Int2,
ResultPrecision::Half);
Result outer_boundary = context().create_temporary_result(ResultType::Int2,
ResultPrecision::Half);
Result inner_boundary = context().create_result(ResultType::Int2, ResultPrecision::Half);
Result outer_boundary = context().create_result(ResultType::Int2, ResultPrecision::Half);
compute_boundary(inner_boundary, outer_boundary);
/* Compute a jump flooding table for each mask boundary to get a distance transform to each of
* the boundaries. */
Result flooded_inner_boundary = context().create_temporary_result(ResultType::Int2,
ResultPrecision::Half);
Result flooded_outer_boundary = context().create_temporary_result(ResultType::Int2,
ResultPrecision::Half);
Result flooded_inner_boundary = context().create_result(ResultType::Int2,
ResultPrecision::Half);
Result flooded_outer_boundary = context().create_result(ResultType::Int2,
ResultPrecision::Half);
jump_flooding(context(), inner_boundary, flooded_inner_boundary);
jump_flooding(context(), outer_boundary, flooded_outer_boundary);
inner_boundary.release();

View File

@@ -167,7 +167,7 @@ class GlareOperation : public NodeOperation {
return execute_bloom(highlights_result);
default:
BLI_assert_unreachable();
return context().create_temporary_result(ResultType::Color);
return context().create_result(ResultType::Color);
}
}
@@ -187,7 +187,7 @@ class GlareOperation : public NodeOperation {
input_image.bind_as_texture(shader, "input_tx");
const int2 glare_size = get_glare_size();
Result highlights_result = context().create_temporary_result(ResultType::Color);
Result highlights_result = context().create_result(ResultType::Color);
highlights_result.allocate_texture(glare_size);
highlights_result.bind_as_image(shader, "output_img");
@@ -250,7 +250,7 @@ class GlareOperation : public NodeOperation {
/* The horizontal pass is applied in-plane, so copy the highlights to a new image since the
* highlights result is still needed by the vertical pass. */
const int2 glare_size = get_glare_size();
Result horizontal_pass_result = context().create_temporary_result(ResultType::Color);
Result horizontal_pass_result = context().create_result(ResultType::Color);
horizontal_pass_result.allocate_texture(glare_size);
GPU_memory_barrier(GPU_BARRIER_TEXTURE_UPDATE);
GPU_texture_copy(horizontal_pass_result.texture(), highlights_result.texture());
@@ -307,7 +307,7 @@ class GlareOperation : public NodeOperation {
/* The diagonal pass is applied in-plane, so copy the highlights to a new image since the
* highlights result is still needed by the anti-diagonal pass. */
const int2 glare_size = get_glare_size();
Result diagonal_pass_result = context().create_temporary_result(ResultType::Color);
Result diagonal_pass_result = context().create_result(ResultType::Color);
diagonal_pass_result.allocate_texture(glare_size);
GPU_memory_barrier(GPU_BARRIER_TEXTURE_UPDATE);
GPU_texture_copy(diagonal_pass_result.texture(), highlights_result.texture());
@@ -348,7 +348,7 @@ class GlareOperation : public NodeOperation {
/* Create an initially zero image where streaks will be accumulated. */
const float4 zero_color = float4(0.0f);
const int2 glare_size = get_glare_size();
Result accumulated_streaks_result = context().create_temporary_result(ResultType::Color);
Result accumulated_streaks_result = context().create_result(ResultType::Color);
accumulated_streaks_result.allocate_texture(glare_size);
GPU_texture_clear(accumulated_streaks_result.texture(), GPU_DATA_FLOAT, zero_color);
@@ -387,12 +387,12 @@ class GlareOperation : public NodeOperation {
/* Copy the highlights result into a new image because the output will be copied to the input
* after each iteration and the highlights result is still needed to compute other streaks. */
const int2 glare_size = get_glare_size();
Result input_streak_result = context().create_temporary_result(ResultType::Color);
Result input_streak_result = context().create_result(ResultType::Color);
input_streak_result.allocate_texture(glare_size);
GPU_memory_barrier(GPU_BARRIER_TEXTURE_UPDATE);
GPU_texture_copy(input_streak_result.texture(), highlights_result.texture());
Result output_streak_result = context().create_temporary_result(ResultType::Color);
Result output_streak_result = context().create_result(ResultType::Color);
output_streak_result.allocate_texture(glare_size);
/* For the given number of iterations, apply the streak filter in the given direction. The
@@ -531,7 +531,7 @@ class GlareOperation : public NodeOperation {
/* Create an initially zero image where ghosts will be accumulated. */
const float4 zero_color = float4(0.0f);
const int2 glare_size = get_glare_size();
Result accumulated_ghosts_result = context().create_temporary_result(ResultType::Color);
Result accumulated_ghosts_result = context().create_result(ResultType::Color);
accumulated_ghosts_result.allocate_texture(glare_size);
GPU_texture_clear(accumulated_ghosts_result.texture(), GPU_DATA_FLOAT, zero_color);
@@ -573,7 +573,7 @@ class GlareOperation : public NodeOperation {
* the center of the image. */
Result compute_base_ghost(Result &highlights_result)
{
Result small_ghost_result = context().create_temporary_result(ResultType::Color);
Result small_ghost_result = context().create_result(ResultType::Color);
symmetric_separable_blur(context(),
highlights_result,
small_ghost_result,
@@ -582,7 +582,7 @@ class GlareOperation : public NodeOperation {
false,
false);
Result big_ghost_result = context().create_temporary_result(ResultType::Color);
Result big_ghost_result = context().create_result(ResultType::Color);
symmetric_separable_blur(context(),
highlights_result,
big_ghost_result,
@@ -605,7 +605,7 @@ class GlareOperation : public NodeOperation {
big_ghost_result.bind_as_texture(shader, "big_ghost_tx");
const int2 glare_size = get_glare_size();
Result base_ghost_result = context().create_temporary_result(ResultType::Color);
Result base_ghost_result = context().create_result(ResultType::Color);
base_ghost_result.allocate_texture(glare_size);
base_ghost_result.bind_as_image(shader, "combined_ghost_img");
@@ -745,7 +745,7 @@ class GlareOperation : public NodeOperation {
* return a copy of the highlights. This is a sanitization of a corner case, so no need to
* worry about optimizing the copy away. */
if (chain_length < 2) {
Result bloom_result = context().create_temporary_result(ResultType::Color);
Result bloom_result = context().create_result(ResultType::Color);
bloom_result.allocate_texture(highlights_result.domain());
GPU_texture_copy(bloom_result.texture(), highlights_result.texture());
return bloom_result;
@@ -787,7 +787,7 @@ class GlareOperation : public NodeOperation {
* one pixel. */
Array<Result> compute_bloom_downsample_chain(Result &highlights_result, int chain_length)
{
const Result downsampled_result = context().create_temporary_result(ResultType::Color);
const Result downsampled_result = context().create_result(ResultType::Color);
Array<Result> downsample_chain(chain_length, downsampled_result);
/* We assign the original highlights result to the first result of the chain to make the code
@@ -850,7 +850,7 @@ class GlareOperation : public NodeOperation {
Result execute_fog_glow(Result &highlights_result)
{
Result fog_glow_result = context().create_temporary_result(ResultType::Color);
Result fog_glow_result = context().create_result(ResultType::Color);
fog_glow_result.allocate_texture(highlights_result.domain());
#if defined(WITH_FFTW3)

View File

@@ -62,7 +62,7 @@ class IDMaskOperation : public NodeOperation {
/* If anti-aliasing is disabled, write to the output directly, otherwise, write to a temporary
* result to later perform anti-aliasing. */
Result non_anti_aliased_mask = context().create_temporary_result(ResultType::Float);
Result non_anti_aliased_mask = context().create_result(ResultType::Float);
Result &output_mask = use_anti_aliasing() ? non_anti_aliased_mask : get_result("Alpha");
const Domain domain = compute_domain();

View File

@@ -53,21 +53,19 @@ class InpaintOperation : public NodeOperation {
Result inpainting_boundary = compute_inpainting_boundary();
/* Compute a jump flooding table to get the closest boundary pixel to each pixel. */
Result flooded_boundary = context().create_temporary_result(ResultType::Int2,
ResultPrecision::Half);
Result flooded_boundary = context().create_result(ResultType::Int2, ResultPrecision::Half);
jump_flooding(context(), inpainting_boundary, flooded_boundary);
inpainting_boundary.release();
Result filled_region = context().create_temporary_result(ResultType::Color);
Result distance_to_boundary = context().create_temporary_result(ResultType::Float,
ResultPrecision::Half);
Result smoothing_radius = context().create_temporary_result(ResultType::Float,
ResultPrecision::Half);
Result filled_region = context().create_result(ResultType::Color);
Result distance_to_boundary = context().create_result(ResultType::Float,
ResultPrecision::Half);
Result smoothing_radius = context().create_result(ResultType::Float, ResultPrecision::Half);
fill_inpainting_region(
flooded_boundary, filled_region, distance_to_boundary, smoothing_radius);
flooded_boundary.release();
Result smoothed_region = context().create_temporary_result(ResultType::Color);
Result smoothed_region = context().create_result(ResultType::Color);
symmetric_separable_blur_variable_size(context(),
filled_region,
smoothed_region,
@@ -94,8 +92,7 @@ class InpaintOperation : public NodeOperation {
const Result &input = get_input("Image");
input.bind_as_texture(shader, "input_tx");
Result inpainting_boundary = context().create_temporary_result(ResultType::Int2,
ResultPrecision::Half);
Result inpainting_boundary = context().create_result(ResultType::Int2, ResultPrecision::Half);
const Domain domain = compute_domain();
inpainting_boundary.allocate_texture(domain);
inpainting_boundary.bind_as_image(shader, "boundary_img");

View File

@@ -135,7 +135,7 @@ class KeyingOperation : public NodeOperation {
Result chroma = extract_input_chroma();
Result blurred_chroma = context().create_temporary_result(ResultType::Color);
Result blurred_chroma = context().create_result(ResultType::Color);
symmetric_separable_blur(
context(), chroma, blurred_chroma, float2(blur_size) / 2, R_FILTER_BOX);
chroma.release();
@@ -154,7 +154,7 @@ class KeyingOperation : public NodeOperation {
Result &input = get_input("Image");
input.bind_as_texture(shader, "input_tx");
Result output = context().create_temporary_result(ResultType::Color);
Result output = context().create_result(ResultType::Color);
output.allocate_texture(input.domain());
output.bind_as_image(shader, "output_img");
@@ -177,7 +177,7 @@ class KeyingOperation : public NodeOperation {
new_chroma.bind_as_texture(shader, "new_chroma_tx");
Result output = context().create_temporary_result(ResultType::Color);
Result output = context().create_result(ResultType::Color);
output.allocate_texture(input.domain());
output.bind_as_image(shader, "output_img");
@@ -203,7 +203,7 @@ class KeyingOperation : public NodeOperation {
Result &key_color = get_input("Key Color");
key_color.bind_as_texture(shader, "key_tx");
Result output = context().create_temporary_result(ResultType::Float);
Result output = context().create_result(ResultType::Float);
output.allocate_texture(input.domain());
output.bind_as_image(shader, "output_img");
@@ -258,7 +258,7 @@ class KeyingOperation : public NodeOperation {
Result &core_matte = get_input("Core Matte");
core_matte.bind_as_texture(shader, "core_matte_tx");
Result output_matte = context().create_temporary_result(ResultType::Float);
Result output_matte = context().create_result(ResultType::Float);
output_matte.allocate_texture(input_matte.domain());
output_matte.bind_as_image(shader, "output_matte_img");
@@ -289,7 +289,7 @@ class KeyingOperation : public NodeOperation {
return output_matte;
}
Result blurred_matte = context().create_temporary_result(ResultType::Float);
Result blurred_matte = context().create_result(ResultType::Float);
symmetric_separable_blur(
context(), input_matte, blurred_matte, float2(blur_size) / 2, R_FILTER_BOX);
@@ -308,7 +308,7 @@ class KeyingOperation : public NodeOperation {
return output_matte;
}
Result morphed_matte = context().create_temporary_result(ResultType::Float);
Result morphed_matte = context().create_result(ResultType::Float);
morphological_distance(context(), input_matte, morphed_matte, distance);
return morphed_matte;
@@ -326,7 +326,7 @@ class KeyingOperation : public NodeOperation {
return output_matte;
}
Result feathered_matte = context().create_temporary_result(ResultType::Float);
Result feathered_matte = context().create_result(ResultType::Float);
morphological_distance_feather(
context(), input_matte, feathered_matte, distance, node_storage(bnode()).feather_falloff);

View File

@@ -128,11 +128,10 @@ class ConvertKuwaharaOperation : public NodeOperation {
void execute_classic_summed_area_table()
{
Result table = context().create_temporary_result(ResultType::Color, ResultPrecision::Full);
Result table = context().create_result(ResultType::Color, ResultPrecision::Full);
summed_area_table(context(), get_input("Image"), table);
Result squared_table = context().create_temporary_result(ResultType::Color,
ResultPrecision::Full);
Result squared_table = context().create_result(ResultType::Color, ResultPrecision::Full);
summed_area_table(
context(), get_input("Image"), squared_table, SummedAreaTableOperation::Square);
@@ -174,7 +173,7 @@ class ConvertKuwaharaOperation : public NodeOperation {
void execute_anisotropic()
{
Result structure_tensor = compute_structure_tensor();
Result smoothed_structure_tensor = context().create_temporary_result(ResultType::Color);
Result smoothed_structure_tensor = context().create_result(ResultType::Color);
symmetric_separable_blur(context(),
structure_tensor,
smoothed_structure_tensor,
@@ -225,7 +224,7 @@ class ConvertKuwaharaOperation : public NodeOperation {
input.bind_as_texture(shader, "input_tx");
const Domain domain = compute_domain();
Result structure_tensor = context().create_temporary_result(ResultType::Color);
Result structure_tensor = context().create_result(ResultType::Color);
structure_tensor.allocate_texture(domain);
structure_tensor.bind_as_image(shader, "structure_tensor_img");

View File

@@ -151,7 +151,7 @@ class PlaneTrackDeformOperation : public NodeOperation {
"Plane Track Deform Homography Matrices");
Result plane_mask = compute_plane_mask(homography_matrices, homography_matrices_buffer);
Result anti_aliased_plane_mask = context().create_temporary_result(ResultType::Float);
Result anti_aliased_plane_mask = context().create_result(ResultType::Float);
smaa(context(), plane_mask, anti_aliased_plane_mask);
plane_mask.release();
@@ -215,7 +215,7 @@ class PlaneTrackDeformOperation : public NodeOperation {
GPU_uniformbuf_bind(homography_matrices_buffer, ubo_location);
const Domain domain = compute_domain();
Result plane_mask = context().create_temporary_result(ResultType::Float);
Result plane_mask = context().create_result(ResultType::Float);
plane_mask.allocate_texture(domain);
plane_mask.bind_as_image(shader, "mask_img");

View File

@@ -97,7 +97,7 @@ class VectorBlurOperation : public NodeOperation {
Result &input = get_input("Speed");
input.bind_as_texture(shader, "input_tx");
Result output = context().create_temporary_result(ResultType::Color);
Result output = context().create_result(ResultType::Color);
const int2 tiles_count = math::divide_ceil(input.domain().size, int2(32));
output.allocate_texture(Domain(tiles_count));
output.bind_as_image(shader, "output_img");

View File

@@ -198,7 +198,7 @@ class ZCombineOperation : public NodeOperation {
second_z.bind_as_texture(shader, "second_z_tx");
const Domain domain = compute_domain();
Result mask = context().create_temporary_result(ResultType::Float);
Result mask = context().create_result(ResultType::Float);
mask.allocate_texture(domain);
mask.bind_as_image(shader, "mask_img");
@@ -209,7 +209,7 @@ class ZCombineOperation : public NodeOperation {
mask.unbind_as_image();
GPU_shader_unbind();
Result anti_aliased_mask = context().create_temporary_result(ResultType::Float);
Result anti_aliased_mask = context().create_result(ResultType::Float);
smaa(context(), mask, anti_aliased_mask);
mask.release();