|
40 | 40 |
|
41 | 41 | NS_AX_BACKEND_BEGIN
|
42 | 42 |
|
| 43 | +#if AX_GLES_PROFILE != 200 && AX_TARGET_PLATFORM != AX_PLATFORM_WASM |
| 44 | +# define AX_HAVE_MAP_BUFFER_RANGE 1 |
| 45 | +#else |
| 46 | +# define AX_HAVE_MAP_BUFFER_RANGE 0 |
| 47 | +#endif |
| 48 | + |
43 | 49 | namespace
|
44 | 50 | {
|
45 | 51 | void applyTexture(TextureBackend* texture, int slot, int index)
|
@@ -469,7 +475,7 @@ void CommandBufferGL::readPixels(RenderTarget* rt,
|
469 | 475 | glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
470 | 476 |
|
471 | 477 | auto bufferSize = bytesPerRow * height;
|
472 |
| -#if AX_GLES_PROFILE != 200 |
| 478 | +#if AX_HAVE_MAP_BUFFER_RANGE |
473 | 479 | GLuint pbo;
|
474 | 480 | glGenBuffers(1, &pbo);
|
475 | 481 | __gl->bindBuffer(BufferType::PIXEL_PACK_BUFFER, pbo);
|
@@ -507,14 +513,14 @@ void CommandBufferGL::readPixels(RenderTarget* rt,
|
507 | 513 | // for cache for restore on EGL context resume, don't need flip
|
508 | 514 | pbd._width = width;
|
509 | 515 | pbd._height = height;
|
510 |
| -#if AX_GLES_PROFILE != 200 |
| 516 | +#if AX_HAVE_MAP_BUFFER_RANGE |
511 | 517 | pbd._data.copy(buffer_ptr, static_cast<ssize_t>(bufferSize));
|
512 | 518 | #else
|
513 | 519 | static_cast<axstd::byte_buffer&>(pbd._data).swap(buffer);
|
514 | 520 | #endif
|
515 | 521 | }
|
516 | 522 | }
|
517 |
| -#if AX_GLES_PROFILE != 200 |
| 523 | +#if AX_HAVE_MAP_BUFFER_RANGE |
518 | 524 | glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
|
519 | 525 | __gl->bindBuffer(BufferType::PIXEL_PACK_BUFFER, 0);
|
520 | 526 | glDeleteBuffers(1, &pbo);
|
|
0 commit comments