From 3f2ca466264b345301cd888fc3981ce013f1f007 Mon Sep 17 00:00:00 2001 From: Manish Mathai Date: Mon, 2 Jan 2023 12:05:32 +0530 Subject: [PATCH 1/2] Fix index out of range in Texture2D When `Texture2DSamplerExecutionObject<>::GetColor()` is called with u or v as 0, when running with linear filter mode, it can go out of index and try to access data at location before the texture data array. This fixes that issue. --- vtkm/rendering/Texture2D.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vtkm/rendering/Texture2D.h b/vtkm/rendering/Texture2D.h index d37d33746..9772a6cb4 100644 --- a/vtkm/rendering/Texture2D.h +++ b/vtkm/rendering/Texture2D.h @@ -145,8 +145,8 @@ public: VTKM_EXEC inline ColorType GetLinearFilteredColor(vtkm::Float32 u, vtkm::Float32 v) const { - u = u * static_cast(Width) - 0.5f; - v = v * static_cast(Height) - 0.5f; + u = u * static_cast(Width - 1); + v = v * static_cast(Height - 1); vtkm::Id x = static_cast(vtkm::Floor(u)); vtkm::Id y = static_cast(vtkm::Floor(v)); vtkm::Float32 uRatio = u - static_cast(x); From fecea93da490d460709001ce18c389154c36633c Mon Sep 17 00:00:00 2001 From: Manish Mathai Date: Mon, 2 Jan 2023 12:28:36 +0530 Subject: [PATCH 2/2] Update render unit test baseline images --- data/baseline/filter/contour-uniform-boundaries.png | 4 ++-- data/baseline/filter/contour-uniform.png | 4 ++-- data/baseline/filter/contour-wedge.png | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/data/baseline/filter/contour-uniform-boundaries.png b/data/baseline/filter/contour-uniform-boundaries.png index 193c76848..07c9bad5c 100644 --- a/data/baseline/filter/contour-uniform-boundaries.png +++ b/data/baseline/filter/contour-uniform-boundaries.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:25d61b72591e1ecd66a70e1005cb31a5d37b0bba90bec42288dd41118801000e -size 29986 +oid sha256:137439af2a14dfaab461b07e643fb45dc8e898690f21ca9514cc794dc4afd50a +size 30144 diff --git a/data/baseline/filter/contour-uniform.png b/data/baseline/filter/contour-uniform.png index ddf6f318e..fb743f089 100644 --- a/data/baseline/filter/contour-uniform.png +++ b/data/baseline/filter/contour-uniform.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:558028eae0ddb162a3c437b7d12c30857f7b964b3dc9bda601e9750db0813fe5 -size 31393 +oid sha256:c62a7084613dddda80f2fb1c869f5adaef9efe50d6762b92b61aebd9692afcd4 +size 31812 diff --git a/data/baseline/filter/contour-wedge.png b/data/baseline/filter/contour-wedge.png index d913558c8..2fe68ba23 100644 --- a/data/baseline/filter/contour-wedge.png +++ b/data/baseline/filter/contour-wedge.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a879c39ef99c13722da91b7178e41a70ac0aaa5735e7cd201899639464f2f151 -size 35281 +oid sha256:bfca08fc98539bb4241c44b47352e95c5b32e7126545d215291d0e51280709c3 +size 35099