[Mesa-dev] [PATCH 1/9] mesa:Define extension GL_ARB_framebuffer_no_attachments

Ian Romanick idr at freedesktop.org
Tue May 5 23:36:32 PDT 2015


These patches are partitioned in a atypical way.  The usual way is

 - A patch that modifies extensions.c, struct gl_extensions, the XML
   files (in patch #2), dispatch_sanity (see my comment on patch #2),
   and adds the stub functions (in patch #2).

 - A patch that adds the other necessary bits to the data structures
   and code to initialize them to sensible default values.

 - Several patches that add the rest of the device-independent parts
   (patches 3 through 5... that looks fine).

 - Several patches that add the device-dependent parts (the rest of the
   series... that also looks fine).

This is mostly for future reference.  I don't think it's worth
rearranging the series.

Additional comments below.

On 04/29/2015 01:56 AM, kevin.rogovin at intel.com wrote:
> From: Kevin Rogovin <kevin.rogovin at intel.com>
> 
> Define the infrastructure for the extension GL_ARB_framebuffer_no_attachments:
>  - extension table
>  - additions to gl_framebuffer
> 
> ---
>  src/mesa/main/extensions.c  |  1 +
>  src/mesa/main/fbobject.c    |  1 +
>  src/mesa/main/framebuffer.c |  1 +
>  src/mesa/main/mtypes.h      | 52 ++++++++++++++++++++++++++++++++++++++++-----
>  4 files changed, 50 insertions(+), 5 deletions(-)
> 
> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
> index 3d4965c..99c1b06 100644
> --- a/src/mesa/main/extensions.c
> +++ b/src/mesa/main/extensions.c
> @@ -117,6 +117,7 @@ static const struct extension extension_table[] = {
>     { "GL_ARB_fragment_program",                    o(ARB_fragment_program),                    GLL,            2002 },
>     { "GL_ARB_fragment_program_shadow",             o(ARB_fragment_program_shadow),             GLL,            2003 },
>     { "GL_ARB_fragment_shader",                     o(ARB_fragment_shader),                     GL,             2002 },
> +   { "GL_ARB_framebuffer_no_attachments",          o(ARB_framebuffer_no_attachments),          GL,             2012 },
>     { "GL_ARB_framebuffer_object",                  o(ARB_framebuffer_object),                  GL,             2005 },
>     { "GL_ARB_framebuffer_sRGB",                    o(EXT_framebuffer_sRGB),                    GL,             1998 },
>     { "GL_ARB_get_program_binary",                  o(dummy_true),                              GL,             2010 },
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 27cf97f..eabbb96 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -914,6 +914,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>     fb->Height = 0;
>     fb->_AllColorBuffersFixedPoint = GL_TRUE;
>     fb->_HasSNormOrFloatColorBuffer = GL_FALSE;
> +   fb->_HasAttachments = GL_TRUE;
>  
>     /* Start at -2 to more easily loop over all attachment points.
>      *  -2: depth buffer
> diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
> index 4f7736a..4e4d896 100644
> --- a/src/mesa/main/framebuffer.c
> +++ b/src/mesa/main/framebuffer.c
> @@ -157,6 +157,7 @@ _mesa_initialize_window_framebuffer(struct gl_framebuffer *fb,
>     fb->_Status = GL_FRAMEBUFFER_COMPLETE_EXT;
>     fb->_AllColorBuffersFixedPoint = !visual->floatMode;
>     fb->_HasSNormOrFloatColorBuffer = visual->floatMode;
> +   fb->_HasAttachments = GL_TRUE;
>  
>     compute_depth_max(fb);
>  }
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index fb41430..ef97538 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -3133,12 +3133,29 @@ struct gl_framebuffer
>      */
>     struct gl_config Visual;
>  
> -   GLuint Width, Height;	/**< size of frame buffer in pixels */
> +   /**
> +    * size of frame buffer in pixels,
> +    * no attachments has these values as 0
> +    */
> +   GLuint Width, Height;
> +
> +   /**
> +    * In the case that the framebuffer has no attachment (i.e.
> +    * GL_ARB_framebuffer_no_attachments) then the geometry of
> +    * the framebuffer is specified by the default values.
> +    */
> +   struct {
> +     GLuint Width, Height, Layers, NumSamples;
> +     GLboolean FixedSampleLocations;
> +   } DefaultGeometry;
>  
> -   /** \name  Drawing bounds (Intersection of buffer size and scissor box) */
> +   /** \name  Drawing bounds (Intersection of buffer size and scissor box)
> +    * The drawing region is given by [_Xmin, _Xmax) x [_Ymin, _Ymax),
> +    * (inclusive for _Xmin and _Ymin while exclusive for _Xmax and _Ymax)
> +    */
>     /*@{*/
> -   GLint _Xmin, _Xmax;  /**< inclusive */
> -   GLint _Ymin, _Ymax;  /**< exclusive */
> +   GLint _Xmin, _Xmax;
> +   GLint _Ymin, _Ymax;
>     /*@}*/
>  
>     /** \name  Derived Z buffer stuff */
> @@ -3151,6 +3168,20 @@ struct gl_framebuffer
>     /** One of the GL_FRAMEBUFFER_(IN)COMPLETE_* tokens */
>     GLenum _Status;
>  
> +   /** True if both of the conditions:
> +    *  1. one of Attachment has Type != GL_NONE
> +    *  2 _Status is GL_FRAMEBUFFER_COMPLETE_EXT
> +    * NOTE: the values for Width and Height are set to 0 in
> +    * case of no attachments, a backend driver supporting
> +    * GL_ARB_framebuffer_no_attachments must check for the
> +    * flag _HasAttachments and if GL_FALSE, must then use
> +    * the values in DefaultGeometry to initialize its
> +    * viewport, scissor and so on (in particular _Xmin,
> +    * _Xmax, _Ymin and _Ymax do NOT take into account
> +    * _HasAttachments being false)
> +    */
> +   GLboolean _HasAttachments;
> +

For things that are not visible to the API, we're moving away from using
GL types.  For this one, use bool/true/false instead.

>     /** Integer color values */
>     GLboolean _IntegerColor;
>  
> @@ -3161,7 +3192,9 @@ struct gl_framebuffer
>     /**
>      * The maximum number of layers in the framebuffer, or 0 if the framebuffer
>      * is not layered.  For cube maps and cube map arrays, each cube face
> -    * counts as a layer.
> +    * counts as a layer. As the case for Width, Height a backend driver
> +    * supporting GL_ARB_framebuffer_no_attachments must use DefaultGeometry
> +    * in the case that _HasAttachments is false
>      */
>     GLuint MaxNumLayers;
>  
> @@ -3340,6 +3373,14 @@ struct gl_constants
>     GLuint MaxRenderbufferSize;   /**< GL_EXT_framebuffer_object */
>     GLuint MaxSamples;            /**< GL_ARB_framebuffer_object */
>  
> +   /**
> +    * GL_ARB_framebuffer_no_attachments
> +    */
> +   GLuint MaxFramebufferWidth;
> +   GLuint MaxFramebufferHeight;
> +   GLuint MaxFramebufferLayers;
> +   GLuint MaxFramebufferSamples;
> +
>     /** Number of varying vectors between any two shader stages. */
>     GLuint MaxVarying;
>  
> @@ -3618,6 +3659,7 @@ struct gl_extensions
>     GLboolean ARB_fragment_program_shadow;
>     GLboolean ARB_fragment_shader;
>     GLboolean ARB_framebuffer_object;
> +   GLboolean ARB_framebuffer_no_attachments;

Alphabetize.

>     GLboolean ARB_explicit_attrib_location;
>     GLboolean ARB_explicit_uniform_location;
>     GLboolean ARB_geometry_shader4;
> 



More information about the mesa-dev mailing list