Plan thumbnail blend feedback copies
This commit is contained in:
@@ -44,17 +44,17 @@ GLenum rgba_pixel_format()
|
||||
return static_cast<GLenum>(pp::renderer::gl::rgba_pixel_format());
|
||||
}
|
||||
|
||||
pp::renderer::RenderDeviceFeatures canvas_stroke_composite_features() noexcept
|
||||
pp::renderer::RenderDeviceFeatures canvas_render_device_features() noexcept
|
||||
{
|
||||
return ShaderManager::render_device_features();
|
||||
}
|
||||
|
||||
pp::paint_renderer::CanvasStrokeFeedbackPlan canvas_stroke_feedback_plan(
|
||||
pp::paint_renderer::CanvasStrokeFeedbackPlan canvas_destination_feedback_plan(
|
||||
int width,
|
||||
int height) noexcept
|
||||
{
|
||||
const auto plan = pp::paint_renderer::plan_canvas_stroke_feedback(
|
||||
canvas_stroke_composite_features(),
|
||||
canvas_render_device_features(),
|
||||
pp::renderer::Extent2D {
|
||||
.width = static_cast<std::uint32_t>(std::max(width, 0)),
|
||||
.height = static_cast<std::uint32_t>(std::max(height, 0)),
|
||||
@@ -86,7 +86,7 @@ pp::paint_renderer::CanvasBlendGatePlan draw_merge_blend_gate_plan(
|
||||
}
|
||||
|
||||
const auto plan = pp::paint_renderer::plan_canvas_blend_gate(
|
||||
canvas_stroke_composite_features(),
|
||||
canvas_render_device_features(),
|
||||
pp::paint_renderer::CanvasBlendGateRequest {
|
||||
.extent = pp::renderer::Extent2D {
|
||||
.width = static_cast<std::uint32_t>(std::max(width, 0)),
|
||||
@@ -654,7 +654,7 @@ void Canvas::stroke_draw()
|
||||
if (brush->m_pattern_flipx) patt_scale.x *= -1.f;
|
||||
if (brush->m_pattern_flipy) patt_scale.y *= -1.f;
|
||||
|
||||
const auto stroke_feedback = canvas_stroke_feedback_plan(m_width, m_height);
|
||||
const auto stroke_feedback = canvas_destination_feedback_plan(m_width, m_height);
|
||||
const bool copy_stroke_destination = !stroke_feedback.reads_destination_color;
|
||||
|
||||
glDisable(blend_state());
|
||||
@@ -2842,6 +2842,8 @@ Image Canvas::thumbnail_generate(int w, int h)
|
||||
m_face_plane.create<1>(2, 2);
|
||||
Texture2D blendtex;
|
||||
blendtex.create(w, h);
|
||||
const auto layer_feedback = canvas_destination_feedback_plan(w, h);
|
||||
const bool copy_layer_destination = !layer_feedback.reads_destination_color;
|
||||
|
||||
// recalculate because of different aspect ratio than the m_proj matrix
|
||||
glm::mat4 proj = glm::perspective(glm::radians(m_cam_fov), (float)w / (float)h, 0.1f, 1000.f);
|
||||
@@ -2855,7 +2857,7 @@ Image Canvas::thumbnail_generate(int w, int h)
|
||||
ShaderManager::use(kShader::TextureBlend);
|
||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||
ShaderManager::u_mat4(kShaderUniform::MVP, plane_mvp);
|
||||
if (!ShaderManager::ext_framebuffer_fetch)
|
||||
if (copy_layer_destination)
|
||||
{
|
||||
ShaderManager::u_int(kShaderUniform::TexBG, 2);
|
||||
set_active_texture_unit(2);
|
||||
@@ -2869,7 +2871,7 @@ Image Canvas::thumbnail_generate(int w, int h)
|
||||
m_layers[layer_index]->m_opacity == 0.f ||
|
||||
!m_layers[layer_index]->face(i))
|
||||
continue;
|
||||
if (!ShaderManager::ext_framebuffer_fetch)
|
||||
if (copy_layer_destination)
|
||||
{
|
||||
set_active_texture_unit(2);
|
||||
glCopyTexSubImage2D(texture_2d_target(), 0, 0, 0, 0, 0, w, h);
|
||||
@@ -2882,7 +2884,7 @@ Image Canvas::thumbnail_generate(int w, int h)
|
||||
m_layers[layer_index]->rtt(i).unbindTexture();
|
||||
}
|
||||
|
||||
if (!ShaderManager::ext_framebuffer_fetch)
|
||||
if (copy_layer_destination)
|
||||
{
|
||||
set_active_texture_unit(2);
|
||||
blendtex.unbind();
|
||||
|
||||
Reference in New Issue
Block a user