diff options
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/blorp/blorp.h | 3 | ||||
-rw-r--r-- | src/intel/blorp/blorp_blit.c | 44 | ||||
-rw-r--r-- | src/intel/vulkan/anv_blorp.c | 34 |
3 files changed, 32 insertions, 49 deletions
diff --git a/src/intel/blorp/blorp.h b/src/intel/blorp/blorp.h index 6e2f888d17f..ee343a4a6bb 100644 --- a/src/intel/blorp/blorp.h +++ b/src/intel/blorp/blorp.h @@ -139,7 +139,8 @@ blorp_blit(struct blorp_batch *batch, float src_x1, float src_y1, float dst_x0, float dst_y0, float dst_x1, float dst_y1, - uint32_t filter, bool mirror_x, bool mirror_y); + enum blorp_filter filter, + bool mirror_x, bool mirror_y); void blorp_copy(struct blorp_batch *batch, diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c index cdabf441e52..a18f96a0ae1 100644 --- a/src/intel/blorp/blorp_blit.c +++ b/src/intel/blorp/blorp_blit.c @@ -2211,7 +2211,8 @@ blorp_blit(struct blorp_batch *batch, float src_x1, float src_y1, float dst_x0, float dst_y0, float dst_x1, float dst_y1, - GLenum filter, bool mirror_x, bool mirror_y) + enum blorp_filter filter, + bool mirror_x, bool mirror_y) { struct blorp_params params; blorp_params_init(¶ms); @@ -2240,14 +2241,10 @@ blorp_blit(struct blorp_batch *batch, params.dst.view.swizzle = dst_swizzle; struct brw_blorp_blit_prog_key wm_prog_key = { - .shader_type = BLORP_SHADER_TYPE_BLIT + .shader_type = BLORP_SHADER_TYPE_BLIT, + .filter = filter, }; - /* Scaled blitting or not. */ - const bool blit_scaled = - ((dst_x1 - dst_x0) == (src_x1 - src_x0) && - (dst_y1 - dst_y0) == (src_y1 - src_y0)) ? false : true; - /* Scaling factors used for bilinear filtering in multisample scaled * blits. */ @@ -2257,39 +2254,6 @@ blorp_blit(struct blorp_batch *batch, wm_prog_key.x_scale = 2.0f; wm_prog_key.y_scale = params.src.surf.samples / wm_prog_key.x_scale; - const bool bilinear_filter = filter == GL_LINEAR && - params.src.surf.samples <= 1 && - params.dst.surf.samples <= 1; - - /* If we are downsampling a non-integer color buffer, blend. - * - * Regarding integer color buffers, the OpenGL ES 3.2 spec says: - * - * "If the source formats are integer types or stencil values, a - * single sample's value is selected for each pixel." - * - * This implies we should not blend in that case. - */ - const bool blend = - (params.src.surf.usage & ISL_SURF_USAGE_DEPTH_BIT) == 0 && - (params.src.surf.usage & ISL_SURF_USAGE_STENCIL_BIT) == 0 && - !isl_format_has_int_channel(params.src.surf.format) && - params.src.surf.samples > 1 && - params.dst.surf.samples <= 1; - - if (blend && !blit_scaled) { - wm_prog_key.filter = BLORP_FILTER_AVERAGE; - } else if (blend && blit_scaled) { - wm_prog_key.filter = BLORP_FILTER_BILINEAR; - } else if (bilinear_filter) { - wm_prog_key.filter = BLORP_FILTER_BILINEAR; - } else { - if (params.src.surf.samples > 1) - wm_prog_key.filter = BLORP_FILTER_SAMPLE_0; - else - wm_prog_key.filter = BLORP_FILTER_NEAREST; - } - params.wm_inputs.rect_grid.x1 = minify(params.src.surf.logical_level0_px.width, src_level) * wm_prog_key.x_scale - 1.0f; diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index c76392fcd97..cd67cc636b2 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -513,13 +513,13 @@ void anv_CmdBlitImage( struct blorp_surf src, dst; - uint32_t gl_filter; + enum blorp_filter blorp_filter; switch (filter) { case VK_FILTER_NEAREST: - gl_filter = 0x2600; /* GL_NEAREST */ + blorp_filter = BLORP_FILTER_NEAREST; break; case VK_FILTER_LINEAR: - gl_filter = 0x2601; /* GL_LINEAR */ + blorp_filter = BLORP_FILTER_BILINEAR; break; default: unreachable("Invalid filter"); @@ -604,7 +604,7 @@ void anv_CmdBlitImage( dst_format.isl_format, dst_format.swizzle, src_x0, src_y0, src_x1, src_y1, dst_x0, dst_y0, dst_x1, dst_y1, - gl_filter, flip_x, flip_y); + blorp_filter, flip_x, flip_y); } } @@ -1171,7 +1171,8 @@ resolve_surface(struct blorp_batch *batch, struct blorp_surf *dst_surf, uint32_t dst_level, uint32_t dst_layer, uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y, - uint32_t width, uint32_t height) + uint32_t width, uint32_t height, + enum blorp_filter filter) { blorp_blit(batch, src_surf, src_level, src_layer, @@ -1180,7 +1181,7 @@ resolve_surface(struct blorp_batch *batch, ISL_FORMAT_UNSUPPORTED, ISL_SWIZZLE_IDENTITY, src_x, src_y, src_x + width, src_y + height, dst_x, dst_y, dst_x + width, dst_y + height, - 0x2600 /* GL_NEAREST */, false, false); + filter, false, false); } static void @@ -1219,13 +1220,22 @@ resolve_image(struct anv_device *device, dst_surf.aux_usage, dst_level, dst_layer, 1); + enum blorp_filter filter; + if ((src_surf.surf->usage & ISL_SURF_USAGE_DEPTH_BIT) || + (src_surf.surf->usage & ISL_SURF_USAGE_STENCIL_BIT) || + isl_format_has_int_channel(src_surf.surf->format)) { + filter = BLORP_FILTER_SAMPLE_0; + } else { + filter = BLORP_FILTER_AVERAGE; + } + assert(!src_image->format->can_ycbcr); assert(!dst_image->format->can_ycbcr); resolve_surface(batch, &src_surf, src_level, src_layer, &dst_surf, dst_level, dst_layer, - src_x, src_y, dst_x, dst_y, width, height); + src_x, src_y, dst_x, dst_y, width, height, filter); } } @@ -1340,6 +1350,13 @@ anv_cmd_buffer_resolve_subpass(struct anv_cmd_buffer *cmd_buffer) assert(src_iview->aspect_mask == VK_IMAGE_ASPECT_COLOR_BIT && dst_iview->aspect_mask == VK_IMAGE_ASPECT_COLOR_BIT); + enum blorp_filter filter; + if (isl_format_has_int_channel(src_iview->planes[0].isl.format)) { + filter = BLORP_FILTER_SAMPLE_0; + } else { + filter = BLORP_FILTER_AVERAGE; + } + struct blorp_surf src_surf, dst_surf; get_blorp_surf_for_anv_image(cmd_buffer->device, src_iview->image, VK_IMAGE_ASPECT_COLOR_BIT, @@ -1381,7 +1398,8 @@ anv_cmd_buffer_resolve_subpass(struct anv_cmd_buffer *cmd_buffer) base_dst_layer + i, render_area.offset.x, render_area.offset.y, render_area.offset.x, render_area.offset.y, - render_area.extent.width, render_area.extent.height); + render_area.extent.width, render_area.extent.height, + filter); } } |