| 641 | } |
| 642 | |
| 643 | void Texture::uploadInitData(RenderContext* pRenderContext, const void* pData, bool autoGenMips) |
| 644 | { |
| 645 | if (autoGenMips) |
| 646 | { |
| 647 | // Upload just the first mip-level |
| 648 | size_t arraySliceSize = mWidth * mHeight * getFormatBytesPerBlock(mFormat); |
| 649 | const uint8_t* pSrc = (uint8_t*)pData; |
| 650 | uint32_t numFaces = (mType == Texture::Type::TextureCube) ? 6 : 1; |
| 651 | for (uint32_t i = 0; i < mArraySize * numFaces; i++) |
| 652 | { |
| 653 | uint32_t subresource = getSubresourceIndex(i, 0); |
| 654 | pRenderContext->updateSubresourceData(this, subresource, pSrc); |
| 655 | pSrc += arraySliceSize; |
| 656 | } |
| 657 | } |
| 658 | else |
| 659 | { |
| 660 | pRenderContext->updateTextureData(this, pData); |
| 661 | } |
| 662 | |
| 663 | if (autoGenMips) |
| 664 | { |
| 665 | generateMips(pRenderContext); |
| 666 | invalidateViews(); |
| 667 | } |
| 668 | } |
| 669 | |
| 670 | void Texture::generateMips(RenderContext* pContext, bool minMaxMips) |
| 671 | { |
nothing calls this directly
no test coverage detected