| 324 | } |
| 325 | |
| 326 | void 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 | |
| 361 | void GpuShaderCreator::finalize() |
| 362 | { |
nothing calls this directly
no test coverage detected