Skip to content

Commit

Permalink
exponentop implements gpu path
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyselan committed Sep 23, 2010
1 parent 7763930 commit 13dfeeb
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/core/ExponentOps.cpp
Expand Up @@ -26,15 +26,16 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <cmath>
#include <cstring>
#include <sstream>

#include <OpenColorIO/OpenColorIO.h>

#include "GpuShaderUtils.h"
#include "MatrixOps.h"
#include "MathUtils.h"

#include <cmath>
#include <cstring>
#include <sstream>

OCIO_NAMESPACE_ENTER
{
namespace
Expand Down Expand Up @@ -171,15 +172,19 @@ OCIO_NAMESPACE_ENTER

bool ExponentOp::supportsGpuShader() const
{
return false;
return true;
}

void ExponentOp::writeGpuShader(std::ostringstream & /*shader*/,
const std::string & /*pixelName*/,
const GpuShaderDesc & /*shaderDesc*/) const
void ExponentOp::writeGpuShader(std::ostringstream & shader,
const std::string & pixelName,
const GpuShaderDesc & shaderDesc) const
{
// TODO: Add Gpu Shader for exponent op
throw Exception("ExponentOp does not support analytical shader generation.");
GpuLanguage lang = shaderDesc.getLanguage();
float zerovec[4] = { 0.0f, 0.0f, 0.0f, 0.0f };

shader << pixelName << " = pow(";
shader << "max(" << pixelName << ", " << GpuTextHalf4(zerovec, lang) << ")";
shader << ", " << GpuTextHalf4(m_finalExp4, lang) << ");\n";
}

bool ExponentOp::definesGpuAllocation() const
Expand Down

0 comments on commit 13dfeeb

Please sign in to comment.