aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel/blorp
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-06-25 15:14:38 -0700
committerJason Ekstrand <[email protected]>2018-07-18 09:47:28 -0700
commitaaa6fac8f65e6a28ba73eef6a0e6da4bef4fc992 (patch)
tree99bb4c05aa8c4d589beb5afecca42b3fc31fecaf /src/intel/blorp
parent9fbe2a20078242594db788e5abec41651cbc6991 (diff)
intel/blorp: Take an explicit filter parameter in blorp_blit
This lets us move the glBlitFramebuffer nonsense into the GL driver and make the usage of BLORP mutch more explicit and obvious as to what it's doing. Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/intel/blorp')
-rw-r--r--src/intel/blorp/blorp.h3
-rw-r--r--src/intel/blorp/blorp_blit.c44
2 files changed, 6 insertions, 41 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(&params);
@@ -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;