Route RTT region readbacks through backend
This commit is contained in:
@@ -325,18 +325,14 @@ void Canvas::pick_update(int plane)
|
||||
draw_merge(true, faces);
|
||||
|
||||
int i = plane;
|
||||
m_layers_merge.rtt(i).bindFramebuffer();
|
||||
if (!m_pick_data[plane])
|
||||
m_pick_data[plane] = std::make_unique<glm::u8vec4[]>(m_width * m_height);
|
||||
glReadPixels(
|
||||
m_layers_merge.rtt(i).readPixelsRgba8(
|
||||
0,
|
||||
0,
|
||||
m_width,
|
||||
m_height,
|
||||
rgba_pixel_format(),
|
||||
unsigned_byte_component_type(),
|
||||
m_pick_data[plane].get());
|
||||
m_layers_merge.rtt(i).unbindFramebuffer();
|
||||
});
|
||||
|
||||
m_pick_ready[plane] = true;
|
||||
@@ -1030,13 +1026,11 @@ void Canvas::stroke_commit()
|
||||
// save image before commit
|
||||
glm::vec2 box_sz = zw(m_dirty_box[i]) - xy(m_dirty_box[i]);
|
||||
action->m_image[i] = std::make_unique<uint8_t[]>(box_sz.x * box_sz.y * 4);
|
||||
glReadPixels(
|
||||
m_dirty_box[i].x,
|
||||
m_dirty_box[i].y,
|
||||
box_sz.x,
|
||||
box_sz.y,
|
||||
rgba_pixel_format(),
|
||||
unsigned_byte_component_type(),
|
||||
m_layers[m_current_layer_idx]->rtt(i).readPixelsRgba8(
|
||||
static_cast<int>(m_dirty_box[i].x),
|
||||
static_cast<int>(m_dirty_box[i].y),
|
||||
static_cast<int>(box_sz.x),
|
||||
static_cast<int>(box_sz.y),
|
||||
action->m_image[i].get());
|
||||
|
||||
action->m_box[i] = m_dirty_box[i];
|
||||
@@ -3105,7 +3099,12 @@ void Canvas::draw_objects(std::function<void(const glm::mat4& camera, const glm:
|
||||
if (has_data)
|
||||
{
|
||||
action->m_image[i] = std::make_unique<uint8_t[]>(box_sz.x * box_sz.y * 4);
|
||||
glReadPixels(bounds.x, bounds.y, box_sz.x, box_sz.y, rgba_pixel_format(), unsigned_byte_component_type(), action->m_image[i].get());
|
||||
layer.rtt(i, frame).readPixelsRgba8(
|
||||
static_cast<int>(bounds.x),
|
||||
static_cast<int>(bounds.y),
|
||||
static_cast<int>(box_sz.x),
|
||||
static_cast<int>(box_sz.y),
|
||||
action->m_image[i].get());
|
||||
action->m_box[i] = bounds;
|
||||
}
|
||||
action->m_old_box[i] = layer.box(i, frame);
|
||||
|
||||
Reference in New Issue
Block a user