-------------------------------------------------------------------------------------- User defines the resource for capturing from --------------------------------------------------------------------------------------
| 153 | // User defines the resource for capturing from |
| 154 | //-------------------------------------------------------------------------------------- |
| 155 | void Magnify::SetSourceResource( ID3D11Resource* pSourceResource, DXGI_FORMAT Format, |
| 156 | int nWidth, int nHeight, int nSamples ) |
| 157 | { |
| 158 | assert( NULL != pSourceResource ); |
| 159 | assert( Format > DXGI_FORMAT_UNKNOWN ); |
| 160 | assert( nWidth > 0 ); |
| 161 | assert( nHeight > 0 ); |
| 162 | assert( nSamples > 0 ); |
| 163 | |
| 164 | m_pSourceResource = pSourceResource; |
| 165 | m_SourceResourceFormat = Format; |
| 166 | m_nSourceResourceWidth = nWidth; |
| 167 | m_nSourceResourceHeight = nHeight; |
| 168 | m_nSourceResourceSamples = nSamples; |
| 169 | |
| 170 | m_bDepthFormat = false; |
| 171 | |
| 172 | switch (m_SourceResourceFormat) |
| 173 | { |
| 174 | case DXGI_FORMAT_D32_FLOAT: |
| 175 | m_DepthFormat = DXGI_FORMAT_R32_TYPELESS; |
| 176 | m_DepthSRVFormat = DXGI_FORMAT_R32_FLOAT; |
| 177 | m_bDepthFormat = true; |
| 178 | break; |
| 179 | |
| 180 | case DXGI_FORMAT_D24_UNORM_S8_UINT: |
| 181 | m_DepthFormat = DXGI_FORMAT_R24G8_TYPELESS; |
| 182 | m_DepthSRVFormat = DXGI_FORMAT_R24_UNORM_X8_TYPELESS; |
| 183 | m_bDepthFormat = true; |
| 184 | break; |
| 185 | |
| 186 | case DXGI_FORMAT_D16_UNORM: |
| 187 | m_DepthFormat = DXGI_FORMAT_R16_TYPELESS; |
| 188 | m_DepthSRVFormat = DXGI_FORMAT_R16_UNORM; |
| 189 | m_bDepthFormat = true; |
| 190 | break; |
| 191 | } |
| 192 | |
| 193 | CreateInternalResources(); |
| 194 | } |
| 195 | |
| 196 | |
| 197 | //-------------------------------------------------------------------------------------- |