[Mesa-dev] [PATCH 2/2] i965: Implement ARB_texture_filter_minmax
Ian Romanick
idr at freedesktop.org
Thu Nov 16 19:50:48 UTC 2017
On 11/14/2017 02:54 PM, Scott D Phillips wrote:
> On gen >= 9, minmax reduction modes are available as a flag in
> SAMPLER_STATE.
> ---
> docs/features.txt | 2 +-
> src/mesa/drivers/dri/i965/brw_formatquery.c | 4 ++++
> src/mesa/drivers/dri/i965/genX_state_upload.c | 10 ++++++++++
> src/mesa/drivers/dri/i965/intel_extensions.c | 1 +
> 4 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/docs/features.txt b/docs/features.txt
> index 86d07ba80b..9ec3f2b975 100644
> --- a/docs/features.txt
> +++ b/docs/features.txt
> @@ -312,7 +312,7 @@ Khronos, ARB, and OES extensions that are not part of any OpenGL or OpenGL ES ve
> GL_ARB_sparse_texture not started
> GL_ARB_sparse_texture2 not started
> GL_ARB_sparse_texture_clamp not started
> - GL_ARB_texture_filter_minmax not started
> + GL_ARB_texture_filter_minmax DONE (i965)
> GL_EXT_memory_object DONE (radeonsi)
> GL_EXT_memory_object_fd DONE (radeonsi)
> GL_EXT_memory_object_win32 not started
> diff --git a/src/mesa/drivers/dri/i965/brw_formatquery.c b/src/mesa/drivers/dri/i965/brw_formatquery.c
> index 4f3b9e467b..bb2281f571 100644
> --- a/src/mesa/drivers/dri/i965/brw_formatquery.c
> +++ b/src/mesa/drivers/dri/i965/brw_formatquery.c
> @@ -107,6 +107,10 @@ brw_query_internal_format(struct gl_context *ctx, GLenum target,
> break;
> }
>
> + case GL_TEXTURE_REDUCTION_MODE_ARB:
> + params[0] = GL_TRUE;
> + break;
> +
Can Gen9 actually support all formats? When this was getting discussed
in Khronos, I thought we had some format restrictions. This is the
difference between the EXT and the ARB extension. If we don't actually
have any restrictions on Gen9, a good follow-on would be to add support
for the EXT... since that doesn't have the OpenGL 3.3 requirement and
has interactions with OpenGL ES.
I also thought that Gen8 could do some min/max modes. Perhaps that's
where the restrictions were that I was thinking of...
> default:
> /* By default, we call the driver hook's fallback function from the frontend,
> * which has generic implementation for all pnames.
> diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c
> index 453b8e4add..8af907648b 100644
> --- a/src/mesa/drivers/dri/i965/genX_state_upload.c
> +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
> @@ -5094,6 +5094,16 @@ genX(update_sampler_state)(struct brw_context *brw,
> samp_st.LODPreClampEnable = true;
> #endif
>
> +#if GEN_GEN >= 9
> + if (sampler->ReductionMode != GL_WEIGHTED_AVERAGE_ARB) {
> + samp_st.ReductionTypeEnable = true;
> + if (sampler->ReductionMode == GL_MIN)
> + samp_st.ReductionType = MINIMUM;
> + else
> + samp_st.ReductionType = MAXIMUM;
> + }
> +#endif
> +
> GENX(SAMPLER_STATE_pack)(brw, sampler_state, &samp_st);
> }
>
> diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
> index 4d17393948..e280474875 100644
> --- a/src/mesa/drivers/dri/i965/intel_extensions.c
> +++ b/src/mesa/drivers/dri/i965/intel_extensions.c
> @@ -285,6 +285,7 @@ intelInitExtensions(struct gl_context *ctx)
> if (devinfo->gen >= 9) {
> ctx->Extensions.ANDROID_extension_pack_es31a = true;
> ctx->Extensions.ARB_shader_stencil_export = true;
> + ctx->Extensions.ARB_texture_filter_minmax = true;
> ctx->Extensions.KHR_blend_equation_advanced_coherent = true;
> ctx->Extensions.KHR_texture_compression_astc_ldr = true;
> ctx->Extensions.KHR_texture_compression_astc_sliced_3d = true;
>
More information about the mesa-dev
mailing list