[Mesa-dev] [PATCH 15/41] intel: Refactor intel_render_texture()

Eric Anholt eric at anholt.net
Fri Nov 18 12:35:17 PST 2011


On Thu, 17 Nov 2011 19:58:42 -0800, Chad Versace <chad.versace at linux.intel.com> wrote:
> This is in preparation for properly implementing glFramebufferTexture*()
> for mipmapped depthstencil textures. The FIXME comments deleted by this
> patch give a rough explanation of what was broken.
> 
> This refactor does the following:
>    - In intel_update_wrapper() and intel_wrap_texture(), prepare to
>      replace the 'att' parameter with a miptree.
>    - Move the call to intel_renderbuffer_set_draw_offsets() from
>      intel_render_texture() into intel_udpate_wrapper().
> 
> Each time I encounter those functions, I dislike their vague names.
> (Update which wrapper? What is wrapped? What is the wrapper?). So, while
> I was mucking around, I also renamed the functions.
> 
> Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
> ---
>  src/mesa/drivers/dri/intel/intel_fbo.c |  113 +++++++++++++++++++++++---------
>  1 files changed, 81 insertions(+), 32 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
> index 8e4f7a9..a61c74c 100644
> --- a/src/mesa/drivers/dri/intel/intel_fbo.c
> +++ b/src/mesa/drivers/dri/intel/intel_fbo.c
> @@ -945,41 +945,54 @@ intel_framebuffer_renderbuffer(struct gl_context * ctx,
>     intel_draw_buffer(ctx);
>  }
>  
> +/**
> + * NOTE: The 'att' parameter is a kludge that will soon be removed. Its
> + * presence allows us to refactor the wrapping of depthstencil textures that
> + * use separate stencil in two easily manageable steps, rather than in one
> + * large, hairy step. First, refactor the common wrapping code used by all
> + * texture formats. Second, refactor the separate stencil code paths.
> + */
>  static bool
> -intel_update_wrapper(struct gl_context *ctx, struct intel_renderbuffer *irb, 
> -		     struct gl_renderbuffer_attachment *att)
> +intel_renderbuffer_update_wrapper(struct intel_context *intel,
> +                                  struct intel_renderbuffer *irb,
> +                                  struct intel_mipmap_tree *mt,
> +                                  uint32_t level,
> +                                  uint32_t layer,
> +                                  GLenum internal_format,
> +                                  struct gl_renderbuffer_attachment *att)
>  {
> +   struct gl_context *ctx = &intel->ctx;
> +   struct gl_renderbuffer *rb = &irb->Base;
> +
> +   /* The image variables are a kludge. See the note above for the att
> +    * parameter.
> +    */
>     struct gl_texture_image *texImage = _mesa_get_attachment_teximage(att);
>     struct intel_texture_image *intel_image = intel_texture_image(texImage);
> -   int width, height, depth;
>  
> -   if (!intel_span_supports_format(texImage->TexFormat)) {
> +   irb->Base.Format = ctx->Driver.ChooseTextureFormat(ctx, internal_format,
> +                                                      GL_NONE, GL_NONE);
> +
> +   if (!intel_span_supports_format(rb->Format)) {

This ChooseTextureFormat looks really out of place. I don't know why
you'd be choosing a new format here.

Actually, I can't even figure out where the "-" lines here, like
intel_span_supports_format(), came from.  I don't think I can review
this patch.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20111118/c5208ab9/attachment.pgp>


More information about the mesa-dev mailing list