-------------------------------------------------------------------------------------- User adds a shader to the cache --------------------------------------------------------------------------------------
| 619 | // User adds a shader to the cache |
| 620 | //-------------------------------------------------------------------------------------- |
| 621 | bool ShaderCache::AddShader( ID3D11DeviceChild** ppShader, |
| 622 | SHADER_TYPE ShaderType, |
| 623 | const wchar_t* pwsTarget, |
| 624 | const wchar_t* pwsEntryPoint, |
| 625 | const wchar_t* pwsSourceFile, |
| 626 | unsigned int uNumMacros, |
| 627 | Macro* pMacros, |
| 628 | ID3D11InputLayout** ppInputLayout, |
| 629 | const D3D11_INPUT_ELEMENT_DESC* pInputLayoutDesc, |
| 630 | unsigned int uNumDescElements, |
| 631 | const wchar_t* pwsCanonicalName, |
| 632 | const int i_iMaxVGPR, |
| 633 | const int i_iMaxSGPR, |
| 634 | const bool i_kbIsApplicationShader |
| 635 | ) |
| 636 | { |
| 637 | #if AMD_SDK_INTERNAL_BUILD |
| 638 | assert( (NULL != ppShader) || (!i_kbIsApplicationShader) ); |
| 639 | #else |
| 640 | assert( NULL != ppShader && i_kbIsApplicationShader); |
| 641 | #endif |
| 642 | assert( (ShaderType >= SHADER_TYPE_VERTEX) && (ShaderType <= SHADER_TYPE_COMPUTE) ); |
| 643 | assert( (NULL != pwsTarget) && (wcslen( pwsTarget ) <= m_uTARGET_MAX_LENGTH) ); |
| 644 | assert( (NULL != pwsEntryPoint) && (wcslen( pwsEntryPoint ) <= m_uENTRY_POINT_MAX_LENGTH) ); |
| 645 | assert( (NULL != pwsSourceFile) && (wcslen( pwsSourceFile ) <= m_uFILENAME_MAX_LENGTH) ); |
| 646 | if (uNumMacros > 0) |
| 647 | { |
| 648 | assert( NULL != pMacros ); |
| 649 | } |
| 650 | |
| 651 | if (i_kbIsApplicationShader) |
| 652 | { |
| 653 | Shader* pShaderSource = new Shader(); |
| 654 | pShaderSource->m_eShaderType = ShaderType; |
| 655 | wcscpy_s( pShaderSource->m_wsTarget, m_uTARGET_MAX_LENGTH, pwsTarget ); |
| 656 | wcscpy_s( pShaderSource->m_wsEntryPoint, m_uENTRY_POINT_MAX_LENGTH, pwsEntryPoint ); |
| 657 | wcscpy_s( pShaderSource->m_wsSourceFile, m_uFILENAME_MAX_LENGTH, pwsSourceFile ); |
| 658 | pShaderSource->m_uNumMacros = uNumMacros; |
| 659 | pShaderSource->m_uNumDescElements = uNumDescElements; |
| 660 | pShaderSource->m_ppInputLayout = ppInputLayout; |
| 661 | if (NULL != pwsCanonicalName) |
| 662 | { |
| 663 | wcscpy_s( pShaderSource->m_wsCanonicalName, m_uFILENAME_MAX_LENGTH, pwsCanonicalName ); |
| 664 | } |
| 665 | #if AMD_SDK_INTERNAL_BUILD |
| 666 | pShaderSource->m_ISA_VGPRs = i_iMaxVGPR; |
| 667 | pShaderSource->m_ISA_SGPRs = i_iMaxSGPR; |
| 668 | #endif |
| 669 | |
| 670 | if (pShaderSource->m_uNumMacros > 0) |
| 671 | { |
| 672 | pShaderSource->m_pMacros = new Macro[pShaderSource->m_uNumMacros]; |
| 673 | memcpy( pShaderSource->m_pMacros, pMacros, sizeof( Macro ) * pShaderSource->m_uNumMacros ); |
| 674 | } |
| 675 | |
| 676 | if (pShaderSource->m_eShaderType == SHADER_TYPE_VERTEX) |
| 677 | { |
| 678 | if (pShaderSource->m_uNumDescElements > 0) |
nothing calls this directly
no test coverage detected