Cleanup: Rename wrap to repeat in realization options

The wrap member in realization options is no longer used to indicate
wrapping since 8f8ae302ba. So rename it to repeat since the only user is
now repeating in the realization algorithm.
This commit is contained in:
Omar Emara 2025-01-15 15:22:36 +02:00
parent 484fa519fb
commit 7e5af160bd
2 changed files with 12 additions and 10 deletions

View file

@ -34,11 +34,11 @@ struct RealizationOptions {
/* If true, the result will be repeated infinitely along the horizontal axis when realizing the /* If true, the result will be repeated infinitely along the horizontal axis when realizing the
* result. If false, regions outside of bounds of the result along the horizontal axis will be * result. If false, regions outside of bounds of the result along the horizontal axis will be
* filled with zeros. */ * filled with zeros. */
bool wrap_x = false; bool repeat_x = false;
/* If true, the result will be repeated infinitely along the vertical axis when realizing the /* If true, the result will be repeated infinitely along the vertical axis when realizing the
* result. If false, regions outside of bounds of the result along the vertical axis will be * result. If false, regions outside of bounds of the result along the vertical axis will be
* filled with zeros. */ * filled with zeros. */
bool wrap_y = false; bool repeat_y = false;
}; };
/* ------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------

View file

@ -82,14 +82,16 @@ static void realize_on_domain_gpu(Context &context,
realization_options.interpolation, Interpolation::Bilinear, Interpolation::Bicubic); realization_options.interpolation, Interpolation::Bilinear, Interpolation::Bicubic);
GPU_texture_filter_mode(input, use_bilinear); GPU_texture_filter_mode(input, use_bilinear);
/* If the input wraps, set a repeating wrap mode for out-of-bound texture access. Otherwise, /* If the input repeats, set a repeating extend mode for out-of-bound texture access. Otherwise,
* make out-of-bound texture access return zero by setting a clamp to border extend mode. */ * make out-of-bound texture access return zero by setting a clamp to border extend mode. */
GPU_texture_extend_mode_x(input, GPU_texture_extend_mode_x(input,
realization_options.wrap_x ? GPU_SAMPLER_EXTEND_MODE_REPEAT : realization_options.repeat_x ?
GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER); GPU_SAMPLER_EXTEND_MODE_REPEAT :
GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER);
GPU_texture_extend_mode_y(input, GPU_texture_extend_mode_y(input,
realization_options.wrap_y ? GPU_SAMPLER_EXTEND_MODE_REPEAT : realization_options.repeat_y ?
GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER); GPU_SAMPLER_EXTEND_MODE_REPEAT :
GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER);
input.bind_as_texture(shader, "input_tx"); input.bind_as_texture(shader, "input_tx");
@ -129,15 +131,15 @@ static void realize_on_domain_cpu(Result &input,
switch (realization_options.interpolation) { switch (realization_options.interpolation) {
case Interpolation::Nearest: case Interpolation::Nearest:
sample = input.sample_nearest_wrap( sample = input.sample_nearest_wrap(
normalized_coordinates, realization_options.wrap_x, realization_options.wrap_y); normalized_coordinates, realization_options.repeat_x, realization_options.repeat_y);
break; break;
case Interpolation::Bilinear: case Interpolation::Bilinear:
sample = input.sample_bilinear_wrap( sample = input.sample_bilinear_wrap(
normalized_coordinates, realization_options.wrap_x, realization_options.wrap_y); normalized_coordinates, realization_options.repeat_x, realization_options.repeat_y);
break; break;
case Interpolation::Bicubic: case Interpolation::Bicubic:
sample = input.sample_cubic_wrap( sample = input.sample_cubic_wrap(
normalized_coordinates, realization_options.wrap_x, realization_options.wrap_y); normalized_coordinates, realization_options.repeat_x, realization_options.repeat_y);
break; break;
} }
output.store_pixel_generic_type(texel, sample); output.store_pixel_generic_type(texel, sample);