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

Method createShaderText

src/OpenColorIO/GpuShaderDesc.cpp:326–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324}
325
326void GpuShaderCreator::createShaderText(const char * shaderParameterDeclarations,
327 const char * shaderTextureDeclarations,
328 const char * shaderHelperMethods,
329 const char * shaderFunctionHeader,
330 const char * shaderFunctionBody,
331 const char * shaderFunctionFooter)
332{
333 AutoMutex lock(getImpl()->m_cacheIDMutex);
334
335 getImpl()->m_shaderCode.clear();
336
337 if (getImpl()->m_language == GPU_LANGUAGE_GLSL_VK_4_6 && (shaderParameterDeclarations && *shaderParameterDeclarations))
338 {
339 getImpl()->m_shaderCode += "layout (set = "+std::to_string(getImpl()->m_descriptorSetIndex) +
340 ", binding = 0) uniform " +
341 getImpl()->m_functionName + "_Parameters\n{\n";
342 }
343 getImpl()->m_shaderCode += (shaderParameterDeclarations && *shaderParameterDeclarations) ? shaderParameterDeclarations : "";
344 if (getImpl()->m_language == GPU_LANGUAGE_GLSL_VK_4_6 && (shaderParameterDeclarations && *shaderParameterDeclarations))
345 {
346 getImpl()->m_shaderCode += "\n};\n";
347 }
348
349 getImpl()->m_shaderCode += (shaderTextureDeclarations && *shaderTextureDeclarations) ? shaderTextureDeclarations : "";
350 getImpl()->m_shaderCode += (shaderHelperMethods && *shaderHelperMethods) ? shaderHelperMethods : "";
351 getImpl()->m_shaderCode += (shaderFunctionHeader && *shaderFunctionHeader) ? shaderFunctionHeader : "";
352 getImpl()->m_shaderCode += (shaderFunctionBody && *shaderFunctionBody) ? shaderFunctionBody : "";
353 getImpl()->m_shaderCode += (shaderFunctionFooter && *shaderFunctionFooter) ? shaderFunctionFooter : "";
354
355 getImpl()->m_shaderCodeID = CacheIDHash(getImpl()->m_shaderCode.c_str(),
356 getImpl()->m_shaderCode.length());
357
358 getImpl()->m_cacheID.clear();
359}
360
361void GpuShaderCreator::finalize()
362{

Callers

nothing calls this directly

Calls 3

CacheIDHashFunction · 0.85
getImplFunction · 0.50
clearMethod · 0.45

Tested by

no test coverage detected