diff options
author | Kenneth Graunke <[email protected]> | 2018-07-24 14:31:07 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-02-21 10:26:07 -0800 |
commit | 5b8dd5f303ef6fe5ccf0faeb4e8f207e1c6edf37 (patch) | |
tree | 9c4690fe628c0359979efae06d16e0cd67546d1f /src/gallium/drivers/iris/iris_blit.c | |
parent | 3aa1fcc65a51c0e15d18c608da9b4f3009d4ab2d (diff) |
iris: fix blorp filters
we have to switch to blorp enums after the rebase, but also we were
probably doing it wrong for MSAA before this.
Diffstat (limited to 'src/gallium/drivers/iris/iris_blit.c')
-rw-r--r-- | src/gallium/drivers/iris/iris_blit.c | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/src/gallium/drivers/iris/iris_blit.c b/src/gallium/drivers/iris/iris_blit.c index b83f1aa7172..c47e964df74 100644 --- a/src/gallium/drivers/iris/iris_blit.c +++ b/src/gallium/drivers/iris/iris_blit.c @@ -25,6 +25,7 @@ #include "pipe/p_state.h" #include "pipe/p_context.h" #include "pipe/p_screen.h" +#include "util/u_format.h" #include "util/u_inlines.h" #include "util/ralloc.h" #include "intel/blorp/blorp.h" @@ -95,8 +96,53 @@ iris_blit(struct pipe_context *ctx, const struct pipe_blit_info *info) int dst_y1 = info->dst.box.y + info->dst.box.height; bool mirror_x = false; bool mirror_y = false; - GLenum filter = - info->filter == PIPE_TEX_FILTER_LINEAR ? GL_LINEAR : GL_NEAREST; + enum blorp_filter filter; + + if (info->dst.box.width == info->src.box.width && + info->dst.box.height == info->src.box.height) { + if (src_surf.surf->samples > 1 && dst_surf.surf->samples <= 1) { + /* The OpenGL ES 3.2 specification, section 16.2.1, says: + * + * "If the read framebuffer is multisampled (its effective + * value of SAMPLE_BUFFERS is one) and the draw framebuffer + * is not (its value of SAMPLE_BUFFERS is zero), the samples + * corresponding to each pixel location in the source are + * converted to a single sample before being written to the + * destination. The filter parameter is ignored. If the + * source formats are integer types or stencil values, a + * single sample’s value is selected for each pixel. If the + * source formats are floating-point or normalized types, + * the sample values for each pixel are resolved in an + * implementation-dependent manner. If the source formats + * are depth values, sample values are resolved in an + * implementation-dependent manner where the result will be + * between the minimum and maximum depth values in the pixel." + * + * When selecting a single sample, we always choose sample 0. + */ + if (util_format_is_depth_or_stencil(info->src.format) || + util_format_is_pure_integer(info->src.format)) { + filter = BLORP_FILTER_SAMPLE_0; + } else { + filter = BLORP_FILTER_AVERAGE; + } + } else { + /* The OpenGL 4.6 specification, section 18.3.1, says: + * + * "If the source and destination dimensions are identical, + * no filtering is applied." + * + * Using BLORP_FILTER_NONE will also handle the upsample case by + * replicating the one value in the source to all values in the + * destination. + */ + filter = BLORP_FILTER_NONE; + } + } else if (info->filter == PIPE_TEX_FILTER_LINEAR) { + filter = BLORP_FILTER_BILINEAR; + } else { + filter = BLORP_FILTER_NEAREST; + } struct iris_batch *batch = &ice->render_batch; |