403 {
404 const auto& gl = reactor.GetProcTable();
405
406
407
408 if (!gl.BlitFramebuffer.IsAvailable()) {
409
410 VALIDATION_LOG <<
"Texture blit fallback not implemented yet for GLES2.";
411 return false;
412 }
413
415
416 GLuint read_fbo = GL_NONE;
417 GLuint draw_fbo = GL_NONE;
419 DeleteFBO(gl, read_fbo, GL_READ_FRAMEBUFFER);
420 DeleteFBO(gl, draw_fbo, GL_DRAW_FRAMEBUFFER);
421 });
422
423 {
425 if (!read.has_value()) {
426 return false;
427 }
428 read_fbo = read.value();
429 }
430
431 {
433 if (!draw.has_value()) {
434 return false;
435 }
436 draw_fbo = draw.value();
437 }
438
439 gl.Disable(GL_SCISSOR_TEST);
440 gl.Disable(GL_DEPTH_TEST);
441 gl.Disable(GL_STENCIL_TEST);
442
445
446 gl.BlitFramebuffer(source_region.GetX(),
447 source_region.GetY(),
448 source_region.GetWidth(),
449 source_region.GetHeight(),
450 destination_region.GetX(),
451 destination_region.GetY(),
452 destination_region.GetWidth(),
453 destination_region.GetHeight(),
454 GL_COLOR_BUFFER_BIT,
455 GL_LINEAR
456 );
457
458 return true;
459}
Wraps a closure that is invoked in the destructor unless released by the caller.
static std::optional< GLuint > ConfigureFBO(const ProcTableGLES &gl, const std::shared_ptr< Texture > &texture, GLenum fbo_type)
static void DeleteFBO(const ProcTableGLES &gl, GLuint fbo, GLenum type)
std::shared_ptr< Texture > destination
std::shared_ptr< Texture > source
static constexpr TRect MakeSize(const TSize< U > &size)