355 {
356 const auto& gl = reactor.GetProcTable();
357
358
359
360 if (!gl.BlitFramebuffer.IsAvailable()) {
361
362 VALIDATION_LOG <<
"Texture blit fallback not implemented yet for GLES2.";
363 return false;
364 }
365
367
368 GLuint read_fbo = GL_NONE;
369 GLuint draw_fbo = GL_NONE;
371 DeleteFBO(gl, read_fbo, GL_READ_FRAMEBUFFER);
372 DeleteFBO(gl, draw_fbo, GL_DRAW_FRAMEBUFFER);
373 });
374
375 {
377 if (!read.has_value()) {
378 return false;
379 }
380 read_fbo = read.value();
381 }
382
383 {
385 if (!draw.has_value()) {
386 return false;
387 }
388 draw_fbo = draw.value();
389 }
390
391 gl.Disable(GL_SCISSOR_TEST);
392 gl.Disable(GL_DEPTH_TEST);
393 gl.Disable(GL_STENCIL_TEST);
394
397
398 gl.BlitFramebuffer(source_region.GetX(),
399 source_region.GetY(),
400 source_region.GetWidth(),
401 source_region.GetHeight(),
402 destination_region.GetX(),
403 destination_region.GetY(),
404 destination_region.GetWidth(),
405 destination_region.GetHeight(),
406 GL_COLOR_BUFFER_BIT,
407 GL_LINEAR
408 );
409
410 return true;
411}
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)