--------------------------------------------------------------------------------------
| 798 | |
| 799 | //-------------------------------------------------------------------------------------- |
| 800 | static HRESULT FillInitData( _In_ size_t width, |
| 801 | _In_ size_t height, |
| 802 | _In_ size_t depth, |
| 803 | _In_ size_t mipCount, |
| 804 | _In_ size_t arraySize, |
| 805 | _In_ DXGI_FORMAT format, |
| 806 | _In_ size_t maxsize, |
| 807 | _In_ size_t bitSize, |
| 808 | _In_reads_bytes_(bitSize) const uint8_t* bitData, |
| 809 | _Out_ size_t& twidth, |
| 810 | _Out_ size_t& theight, |
| 811 | _Out_ size_t& tdepth, |
| 812 | _Out_ size_t& skipMip, |
| 813 | _Out_writes_(mipCount*arraySize) D3D11_SUBRESOURCE_DATA* initData ) |
| 814 | { |
| 815 | if ( !bitData || !initData ) |
| 816 | { |
| 817 | return E_POINTER; |
| 818 | } |
| 819 | |
| 820 | skipMip = 0; |
| 821 | twidth = 0; |
| 822 | theight = 0; |
| 823 | tdepth = 0; |
| 824 | |
| 825 | size_t NumBytes = 0; |
| 826 | size_t RowBytes = 0; |
| 827 | const uint8_t* pSrcBits = bitData; |
| 828 | const uint8_t* pEndBits = bitData + bitSize; |
| 829 | |
| 830 | size_t index = 0; |
| 831 | for( size_t j = 0; j < arraySize; j++ ) |
| 832 | { |
| 833 | size_t w = width; |
| 834 | size_t h = height; |
| 835 | size_t d = depth; |
| 836 | for( size_t i = 0; i < mipCount; i++ ) |
| 837 | { |
| 838 | GetSurfaceInfo( w, |
| 839 | h, |
| 840 | format, |
| 841 | &NumBytes, |
| 842 | &RowBytes, |
| 843 | nullptr |
| 844 | ); |
| 845 | |
| 846 | if ( (mipCount <= 1) || !maxsize || (w <= maxsize && h <= maxsize && d <= maxsize) ) |
| 847 | { |
| 848 | if ( !twidth ) |
| 849 | { |
| 850 | twidth = w; |
| 851 | theight = h; |
| 852 | tdepth = d; |
| 853 | } |
| 854 | |
| 855 | assert(index < mipCount * arraySize); |
| 856 | _Analysis_assume_(index < mipCount * arraySize); |
| 857 | initData[index].pSysMem = ( const void* )pSrcBits; |
no test coverage detected