[Mesa-dev] [PATCH 07/15] i965: Mark texture formats as supported using the surface formats table.

Kenneth Graunke kenneth at whitecape.org
Wed Nov 16 00:52:22 PST 2011


On 11/15/2011 05:55 PM, Eric Anholt wrote:
> This is currently duplicated with intel_context.c's setup of the
> formats table, and sets true for exactly the same set of formats on
> gen6.
> ---
>  src/mesa/drivers/dri/i965/brw_wm_surface_state.c |   13 ++++++++++++-
>  1 files changed, 12 insertions(+), 1 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> index 28a40a2..e29a1dc 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> @@ -364,6 +364,7 @@ void
>  brw_init_surface_formats(struct brw_context *brw)
>  {
>     struct intel_context *intel = &brw->intel;
> +   struct gl_context *ctx = &intel->ctx;
>     int gen;
>     gl_format format;
>  
> @@ -373,10 +374,11 @@ brw_init_surface_formats(struct brw_context *brw)
>  
>     for (format = MESA_FORMAT_NONE + 1; format < MESA_FORMAT_COUNT; format++) {
>        uint32_t texture, render;
> -      const struct surface_format_info *rinfo;
> +      const struct surface_format_info *rinfo, *tinfo;
>        bool is_integer = _mesa_is_format_integer_color(format);
>  
>        render = texture = brw_format_for_mesa_format(format);
> +      tinfo = &surface_formats[texture];
>  
>        /* The value of BRW_SURFACEFORMAT_R32G32B32A32_FLOAT is 0, so don't skip
>         * it.
> @@ -384,6 +386,9 @@ brw_init_surface_formats(struct brw_context *brw)
>        if (texture == 0 && format != MESA_FORMAT_RGBA_FLOAT32)
>  	 continue;
>  
> +      if (gen >= tinfo->sampling && (gen >= tinfo->filtering || is_integer))
> +	 ctx->TextureFormatSupported[format] = true;
> +
>        /* Re-map some render target formats to make them supported when they
>         * wouldn't be using their format for texturing.
>         */
> @@ -434,6 +439,12 @@ brw_init_surface_formats(struct brw_context *brw)
>     brw->format_supported_as_render_target[MESA_FORMAT_X8_Z24] = true;
>     brw->format_supported_as_render_target[MESA_FORMAT_S8] = true;
>     brw->format_supported_as_render_target[MESA_FORMAT_Z16] = true;
> +
> +   /* We remap depth formats to a supported texturing format in
> +    * translate_tex_format().
> +    */
> +   ctx->TextureFormatSupported[MESA_FORMAT_S8_Z24] = true;
> +   ctx->TextureFormatSupported[MESA_FORMAT_X8_Z24] = true;
>  }
>  
>  bool

I think we can actually support MESA_FORMAT_Z16 as well, no?  Though
enabling that should definitely be a separate patch, in case it breaks
things.  (I'm a little wary about it because the Windows team apparently
had some issues with Z16 in GLBenchmark, but they weren't sure if it was
a hardware or software issue.)


More information about the mesa-dev mailing list