MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / AddLogShader

Function AddLogShader

src/OpenColorIO/ops/log/LogOpGPU.cpp:18–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16{
17
18void AddLogShader(GpuShaderCreatorRcPtr & shaderCreator, ConstLogOpDataRcPtr & /* logData */, float base)
19{
20 const float minValue = std::numeric_limits<float>::min();
21
22 GpuShaderText st(shaderCreator->getLanguage());
23
24 st.indent();
25 st.newLine() << "";
26 st.newLine() << "// Add Log processing";
27 st.newLine() << "";
28 st.newLine() << "{";
29 st.indent();
30
31 const std::string pix(shaderCreator->getPixelName());
32 const std::string pixrgb = pix + std::string(".rgb");
33
34 st.newLine() << pixrgb << " = max( " << st.float3Const(minValue) << ", " << pixrgb << ");";
35
36 if (base == 2.0f)
37 {
38 st.newLine() << pixrgb << " = log2(" << pixrgb << ");";
39 }
40 else // base 10
41 {
42 const float oneOverLog10 = 1.0f / logf(base);
43 st.newLine() << pixrgb << " = log(" << pixrgb << ") * " << st.float3Const(oneOverLog10) << ";";
44 }
45
46 st.dedent();
47 st.newLine() << "}";
48
49 shaderCreator->addToFunctionShaderCode(st.string().c_str());
50}
51
52void AddAntiLogShader(GpuShaderCreatorRcPtr & shaderCreator, ConstLogOpDataRcPtr & /* logData */, float base)
53{

Callers 1

GetLogGPUShaderProgramFunction · 0.85

Calls 8

indentMethod · 0.80
newLineMethod · 0.80
getPixelNameMethod · 0.80
float3ConstMethod · 0.80
dedentMethod · 0.80
stringMethod · 0.80
getLanguageMethod · 0.45

Tested by

no test coverage detected