| 227 | //----------------------------------------------------------------------------- |
| 228 | |
| 229 | static void _fastTextureLoad(GFXGLTextureObject* texture, GBitmap* pDL) |
| 230 | { |
| 231 | glBindBuffer(GL_PIXEL_UNPACK_BUFFER, texture->getBuffer()); |
| 232 | U32 bufSize = pDL->getWidth(0) * pDL->getHeight(0) * pDL->getBytesPerPixel(); |
| 233 | glBufferData(GL_PIXEL_UNPACK_BUFFER, bufSize, NULL, GL_STREAM_DRAW); |
| 234 | |
| 235 | if(pDL->getFormat() == GFXFormatR8G8B8A8 || pDL->getFormat() == GFXFormatR8G8B8X8) |
| 236 | { |
| 237 | PROFILE_SCOPE(Swizzle32_Upload); |
| 238 | U8* pboMemory = (U8*)dMalloc(bufSize); |
| 239 | GFX->getDeviceSwizzle32()->ToBuffer(pboMemory, pDL->getBits(0), bufSize); |
| 240 | glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, bufSize, pboMemory ); |
| 241 | dFree(pboMemory); |
| 242 | } |
| 243 | else |
| 244 | { |
| 245 | PROFILE_SCOPE(SwizzleNull_Upload); |
| 246 | glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, bufSize, pDL->getBits(0) ); |
| 247 | } |
| 248 | |
| 249 | if(texture->getBinding() == GL_TEXTURE_2D) |
| 250 | glTexSubImage2D(texture->getBinding(), 0, 0, 0, pDL->getWidth(0), pDL->getHeight(0), GFXGLTextureFormat[pDL->getFormat()], GFXGLTextureType[pDL->getFormat()], NULL); |
| 251 | else |
| 252 | glTexSubImage1D(texture->getBinding(), 0, 0, (pDL->getWidth(0) > 1 ? pDL->getWidth(0) : pDL->getHeight(0)), GFXGLTextureFormat[pDL->getFormat()], GFXGLTextureType[pDL->getFormat()], NULL); |
| 253 | |
| 254 | glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); |
| 255 | } |
| 256 | |
| 257 | static void _slowTextureLoad(GFXGLTextureObject* texture, GBitmap* pDL) |
| 258 | { |
no test coverage detected