Files
Bernard LefebvreandPatrick Hodoul 9313e811c6 Adsk Contrib - Refactor opengl usage (#985)
* Refactor opengl usage for apps and utit tests.
All opengl code used by command line apps (and gpu tests) has been refactor.
Ociodisplay is also using the refactored code and still uses  opengl directly.
- add gpu support to ociochecklut.
- add optimization level to ociodisplay.

Signed-off-by: Bernard Lefebvre <bernard.lefebvre@autodesk.com>

* Build fix: use {} instead of () for makefile.

Signed-off-by: Bernard Lefebvre <bernard.lefebvre@autodesk.com>

Co-authored-by: Patrick Hodoul <patrickhodoul@gmail.com>
2020-04-21 09:21:32 -04:00

121 lines
3.1 KiB
C++

// SPDX-License-Identifier: BSD-3-Clause
// Copyright Contributors to the OpenColorIO Project.
#include <stdio.h>
#include <sstream>
#include <string>
#include <OpenColorIO/OpenColorIO.h>
#include "GPUHelpers.h"
#include "GPUUnitTest.h"
namespace OCIO = OCIO_NAMESPACE;
const float g_epsilon = 1e-6f;
OCIO_ADD_GPU_TEST(RangeOp, scale_with_low_and_high_clippings)
{
OCIO::RangeTransformRcPtr range = OCIO::RangeTransform::Create();
range->setMinInValue(0.1f);
range->setMaxInValue(1.1f);
range->setMinOutValue(0.5f);
range->setMaxOutValue(1.5f);
test.setProcessor(range);
test.setTestWideRange(true);
test.setErrorThreshold(g_epsilon);
}
OCIO_ADD_GPU_TEST(RangeOp, scale_with_low_clipping)
{
OCIO::RangeTransformRcPtr range = OCIO::RangeTransform::Create();
range->setMinInValue(0.2f);
range->setMinOutValue(0.2f);
test.setProcessor(range);
test.setErrorThreshold(g_epsilon);
}
OCIO_ADD_GPU_TEST(RangeOp, scale_with_high_clipping)
{
OCIO::RangeTransformRcPtr range = OCIO::RangeTransform::Create();
range->setMaxInValue(0.9f);
range->setMaxOutValue(0.9f);
test.setProcessor(range);
test.setErrorThreshold(g_epsilon);
}
OCIO_ADD_GPU_TEST(RangeOp, scale_with_low_and_high_clippings_2)
{
// The similar test above is only an offset, this test is a scale & offset.
OCIO::RangeTransformRcPtr range = OCIO::RangeTransform::Create();
range->setMinInValue(0.1f);
range->setMaxInValue(1.1f);
range->setMinOutValue(-0.5f);
range->setMaxOutValue(1.5f);
test.setProcessor(range);
test.setTestWideRange(true);
test.setErrorThreshold(g_epsilon);
}
OCIO_ADD_GPU_TEST(RangeOp, arbitrary_1)
{
OCIO::RangeTransformRcPtr range = OCIO::RangeTransform::Create();
range->setMinInValue (0.4000202f);
range->setMaxInValue (0.6000502f);
range->setMinOutValue(0.4000601f);
range->setMaxOutValue(0.6000801f);
test.setProcessor(range);
test.setErrorThreshold(g_epsilon);
}
OCIO_ADD_GPU_TEST(RangeOp, arbitrary_1_no_clamp)
{
OCIO::RangeTransformRcPtr range = OCIO::RangeTransform::Create();
range->setStyle(OCIO::RANGE_NO_CLAMP);
range->setMinInValue (0.4000202f);
range->setMaxInValue (0.6000502f);
range->setMinOutValue(0.4000601f);
range->setMaxOutValue(0.6000801f);
test.setProcessor(range);
test.setErrorThreshold(g_epsilon);
}
OCIO_ADD_GPU_TEST(RangeOp, arbitrary_2)
{
OCIO::RangeTransformRcPtr range = OCIO::RangeTransform::Create();
range->setMinInValue(-0.010201f);
range->setMaxInValue (0.601102f);
range->setMinOutValue(0.209803f);
range->setMaxOutValue(1.600208f);
test.setProcessor(range);
test.setTestWideRange(true);
test.setErrorThreshold(g_epsilon);
}
OCIO_ADD_GPU_TEST(RangeOp, arbitrary_2_no_clamp)
{
OCIO::RangeTransformRcPtr range = OCIO::RangeTransform::Create();
range->setStyle(OCIO::RANGE_NO_CLAMP);
range->setMinInValue(-0.010201f);
range->setMaxInValue (0.601102f);
range->setMinOutValue(0.209803f);
range->setMaxOutValue(1.600208f);
test.setProcessor(range);
test.setTestWideRange(true);
test.setErrorThreshold(g_epsilon);
}