| 175 | } |
| 176 | |
| 177 | void TextureMipData::Copy(void* data, uint32 dataRowPitch, uint32 dataDepthPitch, uint32 dataDepthSlices, uint32 targetRowPitch) |
| 178 | { |
| 179 | // Check if target row pitch is the same |
| 180 | if (targetRowPitch == dataRowPitch || targetRowPitch == 0) |
| 181 | { |
| 182 | Lines = dataDepthPitch / dataRowPitch; |
| 183 | DepthPitch = dataDepthPitch; |
| 184 | RowPitch = dataRowPitch; |
| 185 | |
| 186 | // Single memory copy |
| 187 | Data.Copy((byte*)data, dataDepthPitch * dataDepthSlices); |
| 188 | } |
| 189 | else |
| 190 | { |
| 191 | Lines = dataDepthPitch / dataRowPitch; |
| 192 | DepthPitch = targetRowPitch * Lines; |
| 193 | RowPitch = targetRowPitch; |
| 194 | |
| 195 | // Convert row by row |
| 196 | Data.Allocate(DepthPitch * dataDepthSlices); |
| 197 | for (uint32 depth = 0; depth < dataDepthSlices; depth++) |
| 198 | { |
| 199 | byte* src = (byte*)data + depth * dataDepthPitch; |
| 200 | byte* dst = Data.Get() + depth * DepthPitch; |
| 201 | for (uint32 row = 0; row < Lines; row++) |
| 202 | { |
| 203 | Platform::MemoryCopy(dst + row * RowPitch, src + row * dataRowPitch, RowPitch); |
| 204 | } |
| 205 | } |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | int32 TextureData::GetArraySize() const |
| 210 | { |
no test coverage detected