Skip to content

Commit

Permalink
Move GPU LUT files into the tests dir
Browse files Browse the repository at this point in the history
Instead of creating temporary LUT files for GPU tests,
read them from the testdata directory instead.

This removes the need to clean them up after each run.

Signed-off-by: Ananth Bhaskararaman <ananth.b@qubecinema.com>
  • Loading branch information
ananthb committed Oct 1, 2024
1 parent 4dd0273 commit 102a06d
Show file tree
Hide file tree
Showing 14 changed files with 146 additions and 271 deletions.
22 changes: 22 additions & 0 deletions tests/data/files/Lut3DOp_arbitrary_using_CSP_file.csp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CSPLUTV100
3D

2
0.0 1.0
0.0 1.0
2
0.0 1.0
0.0 1.0
2
0.0 1.0
0.0 1.0

2 2 2
0.100000 0.100000 0.100000
1.100000 0.100000 0.100000
0.100000 1.100000 0.100000
1.100000 1.100000 0.100000
0.100000 0.100000 1.100000
1.100000 0.100000 1.100000
0.100000 1.100000 1.100000
1.100000 1.100000 1.100000
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CSPLUTV100
3D

2
0.0 1.0
0.0 1.0
2
0.0 1.0
0.0 1.0
2
0.0 1.0
0.0 1.0

2 2 2
0.100000 0.100000 0.100000
1.100000 0.100000 0.100000
0.100000 1.100000 0.100000
1.100000 1.100000 0.100000
0.100000 0.100000 1.100000
1.100000 0.100000 1.100000
0.100000 1.100000 1.100000
1.100000 1.100000 1.100000
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CSPLUTV100
3D

2
0.0 1.0
0.0 1.0
2
0.0 1.0
0.0 1.0
2
0.0 1.0
0.0 1.0

2 2 2
0.0 0.0 0.0
0.0 0.0 0.0
0.0 0.0 0.0
0.0 0.0 0.0
0.0 0.0 1.0
0.0 0.0 1.0
0.0 0.0 1.0
0.0 0.0 1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CSPLUTV100
3D

2
0.0 1.0
0.0 1.0
2
0.0 1.0
0.0 1.0
2
0.0 1.0
0.0 1.0

2 2 2
0.0 0.0 0.0
0.0 0.0 0.0
0.0 0.0 0.0
0.0 0.0 0.0
0.0 1.0 0.0
0.0 1.0 0.0
0.0 1.0 0.0
0.0 1.0 0.0
22 changes: 22 additions & 0 deletions tests/data/files/Lut3DOp_red_only_using_CSP_file_legacy_shader.csp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CSPLUTV100
3D

2
0.0 1.0
0.0 1.0
2
0.0 1.0
0.0 1.0
2
0.0 1.0
0.0 1.0

2 2 2
0.0 0.0 0.0
0.0 0.0 0.0
0.0 0.0 0.0
0.0 0.0 0.0
1.0 0.0 0.0
1.0 0.0 0.0
1.0 0.0 0.0
1.0 0.0 0.0
1 change: 0 additions & 1 deletion tests/gpu/CDLOp_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <OpenColorIO/OpenColorIO.h>

#include "GPUUnitTest.h"
#include "GPUHelpers.h"


namespace OCIO = OCIO_NAMESPACE;
Expand Down
3 changes: 1 addition & 2 deletions tests/gpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ set(SOURCES
ECOp_test.cpp
FixedFunctionOp_test.cpp
GammaOp_test.cpp
GPUHelpers.cpp
GPUUnitTest.cpp
GradingPrimaryOp_test.cpp
GradingRGBCurveOp_test.cpp
Expand All @@ -26,7 +25,7 @@ set(SOURCES

add_executable(test_gpu_exec ${SOURCES})

set_target_properties(test_gpu_exec PROPERTIES
set_target_properties(test_gpu_exec PROPERTIES
COMPILE_OPTIONS "${PLATFORM_COMPILE_OPTIONS}"
LINK_OPTIONS "${PLATFORM_LINK_OPTIONS}"
)
Expand Down
58 changes: 0 additions & 58 deletions tests/gpu/GPUHelpers.cpp

This file was deleted.

16 changes: 0 additions & 16 deletions tests/gpu/GPUHelpers.h

This file was deleted.

7 changes: 3 additions & 4 deletions tests/gpu/GPUUnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <sstream>

Expand Down Expand Up @@ -333,11 +332,11 @@ namespace

OCIO::ConstProcessorRcPtr & processor = test->getProcessor();
OCIO::GpuShaderDescRcPtr & shaderDesc = test->getShaderDesc();

OCIO::ConstGPUProcessorRcPtr gpu;
if (test->isLegacyShader())
{
gpu = processor->getOptimizedLegacyGPUProcessor(OCIO::OPTIMIZATION_DEFAULT,
gpu = processor->getOptimizedLegacyGPUProcessor(OCIO::OPTIMIZATION_DEFAULT,
test->getLegacyShaderLutEdge());
}
else
Expand Down Expand Up @@ -575,7 +574,7 @@ int main(int argc, const char ** argv)

// Step 1: Initialize the graphic library engines.
OCIO::OglAppRcPtr app;

try
{
if(useMetalRenderer)
Expand Down
10 changes: 5 additions & 5 deletions tests/gpu/GPUUnitTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ using OCIOTestFuncCallback = std::function<void(OCIOGPUTest & test)>;
//
// By default, the framework compares the GPU results to the CPU results
// using an automatically generated neutral ramp for the standard range [0, 1].
//
//
class OCIOGPUTest
{
public:
Expand All @@ -30,7 +30,7 @@ class OCIOGPUTest
typedef std::vector<float> Values;
Values m_inputValues;

// Keeping the original input value size allows
// Keeping the original input value size allows
// to avoid manipulating padded values added to fit
// the predefined GPU texture size.
size_t m_originalInputValueSize{ 0 };
Expand All @@ -50,7 +50,7 @@ class OCIOGPUTest
void setProcessor(OCIO_NAMESPACE::TransformRcPtr transform);

void setProcessor(OCIO_NAMESPACE::ConstProcessorRcPtr processor);

void setShadingLanguage(OCIO_NAMESPACE::GpuLanguage gpuShadingLanguage)
{
m_gpuShadingLanguage = gpuShadingLanguage;
Expand All @@ -75,7 +75,7 @@ class OCIOGPUTest
inline void setTestInfinity(bool use) { m_testInfinity = use; }

// Provide a set of RGBA values to test (otherwise a neutral ramp will be used).
// TestWideRange, TestNaN & TestInfinity are used when m_inputValues is empty.
// TestWideRange, TestNaN & TestInfinity are used when m_inputValues is empty.
inline void setCustomValues(CustomValues & values) { m_values = values; }
inline CustomValues & getCustomValues() { return m_values; }

Expand All @@ -85,7 +85,7 @@ class OCIOGPUTest
inline bool getRelativeComparison() const { return m_performRelativeComparison; }
inline void setRelativeComparison(bool relCompare) { m_performRelativeComparison = relCompare; }

// This is the lower bound for the value that is divided into the absolute error
// This is the lower bound for the value that is divided into the absolute error
// to obtain the relative error.
inline float getExpectedMinimalValue() const { return m_expectedMinimalValue; }
inline void setExpectedMinimalValue(float minValue) { m_expectedMinimalValue = minValue; }
Expand Down
1 change: 0 additions & 1 deletion tests/gpu/Lut1DOp_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <OpenColorIO/OpenColorIO.h>

#include "GPUUnitTest.h"
#include "GPUHelpers.h"

namespace OCIO = OCIO_NAMESPACE;

Expand Down
Loading

0 comments on commit 102a06d

Please sign in to comment.