| 187 | } |
| 188 | |
| 189 | TextureDescriptor GLTexture::GetDesc() const |
| 190 | { |
| 191 | TextureDescriptor texDesc; |
| 192 | |
| 193 | texDesc.type = GetType(); |
| 194 | texDesc.bindFlags = 0; |
| 195 | texDesc.mipLevels = static_cast<std::uint32_t>(GetNumMipLevels()); |
| 196 | |
| 197 | /* Query hardware texture format and size */ |
| 198 | GLint extent[3] = {}, samples = 1; |
| 199 | if (IsRenderbuffer()) |
| 200 | GetRenderbufferParams(extent, &samples); |
| 201 | else |
| 202 | GetTextureParams(extent, &samples); |
| 203 | |
| 204 | /* |
| 205 | Translate data from OpenGL to LLGL. |
| 206 | Note: for cube textures, depth extent can also be copied directly without transformation (no need to multiply by 6). |
| 207 | */ |
| 208 | texDesc.format = GetFormat(); |
| 209 | |
| 210 | texDesc.extent.width = static_cast<std::uint32_t>(extent[0]); |
| 211 | texDesc.extent.height = static_cast<std::uint32_t>(extent[1]); |
| 212 | |
| 213 | if (GetType() == TextureType::Texture3D) |
| 214 | texDesc.extent.depth = static_cast<std::uint32_t>(extent[2]); |
| 215 | else |
| 216 | texDesc.arrayLayers = static_cast<std::uint32_t>(extent[2]); |
| 217 | |
| 218 | texDesc.samples = static_cast<std::uint32_t>(samples); |
| 219 | |
| 220 | return texDesc; |
| 221 | } |
| 222 | |
| 223 | // Maps the format from Alpha swizzling to RGBA |
| 224 | static Format MapGLSwizzleFormatAlpha(const Format format) |