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

Function WriteShaderHeader

src/OpenColorIO/GPUProcessor.cpp:27–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25{
26
27void WriteShaderHeader(GpuShaderCreatorRcPtr & shaderCreator)
28{
29 const std::string fcnName(shaderCreator->getFunctionName());
30
31 GpuShaderText ss(shaderCreator->getLanguage());
32
33 ss.newLine();
34 ss.newLine() << "// Declaration of the OCIO shader function";
35 ss.newLine();
36
37 if (shaderCreator->getLanguage() == LANGUAGE_OSL_1)
38 {
39 ss.newLine() << "color4 " << fcnName << "(color4 inPixel)";
40 ss.newLine() << "{";
41 ss.indent();
42 ss.newLine() << "color4 " << shaderCreator->getPixelName() << " = inPixel;";
43 }
44 else
45 {
46 ss.newLine() << ss.float4Keyword() << " " << fcnName
47 << "(" << ss.float4Keyword() << " inPixel)";
48 ss.newLine() << "{";
49 ss.indent();
50 ss.newLine() << ss.float4Decl(shaderCreator->getPixelName()) << " = inPixel;";
51 }
52
53 shaderCreator->addToFunctionHeaderShaderCode(ss.string().c_str());
54}
55
56
57void WriteShaderFooter(GpuShaderCreatorRcPtr & shaderCreator)

Callers 1

extractGpuShaderInfoMethod · 0.85

Calls 9

newLineMethod · 0.80
indentMethod · 0.80
getPixelNameMethod · 0.80
float4KeywordMethod · 0.80
float4DeclMethod · 0.80
stringMethod · 0.80
getFunctionNameMethod · 0.45
getLanguageMethod · 0.45

Tested by

no test coverage detected