[Mesa-dev] [v4 PATCH 02/10] mesa: Constants and functions for ARB_framebuffer_no_attachments

Ian Romanick idr at freedesktop.org
Tue Jun 9 15:04:56 PDT 2015


On 05/27/2015 02:49 AM, Kevin Rogovin wrote:
> Define the enumeration constants, function entry points and
> glGet for the GL_ARB_framebuffer_no_attachments.
> 
> v2:
>  Add output="true" for GetFramebufferParameteriv parameter params.
>  Alphabetical insertion.  
> 
> v3:
>  Implement _mesa_GetFramebufferParameteriv and _mesa_FramebufferParameteri
>  as always error.
> 
> v4:
>  Formatting fixes.
>  Remove added documentation of how to add enums for glGet
> 
> Signed-off-by: Kevin Rogovin <kevin.rogovin at intel.com>
> ---
>  .../glapi/gen/ARB_framebuffer_no_attachments.xml   | 32 ++++++++++++++++++++++
>  src/mapi/glapi/gen/Makefile.am                     |  1 +
>  src/mapi/glapi/gen/gl_API.xml                      |  4 ++-
>  src/mesa/main/fbobject.c                           | 28 +++++++++++++++++++
>  src/mesa/main/fbobject.h                           |  6 ++++
>  src/mesa/main/get.c                                |  1 +
>  src/mesa/main/get_hash_params.py                   |  6 ++++
>  src/mesa/main/tests/dispatch_sanity.cpp            |  4 +--
>  8 files changed, 79 insertions(+), 3 deletions(-)
>  create mode 100644 src/mapi/glapi/gen/ARB_framebuffer_no_attachments.xml
> 
> diff --git a/src/mapi/glapi/gen/ARB_framebuffer_no_attachments.xml b/src/mapi/glapi/gen/ARB_framebuffer_no_attachments.xml
> new file mode 100644
> index 0000000..10bdebc
> --- /dev/null
> +++ b/src/mapi/glapi/gen/ARB_framebuffer_no_attachments.xml
> @@ -0,0 +1,32 @@
> +<?xml version="1.0"?>
> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
> +
> +<OpenGLAPI>
> +
> +<category name="GL_ARB_framebuffer_no_attachments" number="130">
> +
> +<enum name="FRAMEBUFFER_DEFAULT_WIDTH" value="0x9310" />
> +<enum name="FRAMEBUFFER_DEFAULT_HEIGHT" value="0x9311" />
> +<enum name="FRAMEBUFFER_DEFAULT_LAYERS" value="0x9312" />
> +<enum name="FRAMEBUFFER_DEFAULT_SAMPLES" value="0x9313" />
> +<enum name="FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS" value="0x9314" />
> +<enum name="MAX_FRAMEBUFFER_WIDTH" value="0x9315" />
> +<enum name="MAX_FRAMEBUFFER_HEIGHT" value="0x9316" />
> +<enum name="MAX_FRAMEBUFFER_LAYERS" value="0x9317" />
> +<enum name="MAX_FRAMEBUFFER_SAMPLES" value="0x9318" />

Everything inside <category> should be indented more.  The 'value' tags
should have preceding whitespace so that they line up.

> +
> +<function name="FramebufferParameteri" offset="assign">

The 'offset' tag no longer exists. :)

You will, however need to add these functions to
src/mapi/glapi/apiexec.py.  The entries you need to add should be
something like:

   # OpenGL 4.3 / GL_ARB_framebuffer_no_attachments
   "FramebufferParameteri": exec_info(compatibility=12, core=31),
   "GetFramebufferParameteri": exec_info(compatibility=12, core=31),

Hopefully it won't be much longer until we don't have to maintain our
own XML...

> +    <param name="target" type="GLenum" />
> +    <param name="pname" type="GLenum" />
> +    <param name="param" type="GLint" />
> +</function>
> +
> +<function name="GetFramebufferParameteriv" offset="assign">
> +    <param name="target" type="GLenum" />
> +    <param name="pname" type="GLenum" />
> +    <param name="params" type="GLint *" output="true" />
> +</function>
> +
> +</category>
> +
> +</OpenGLAPI>
> diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
> index adebd5c..5099f12 100644
> --- a/src/mapi/glapi/gen/Makefile.am
> +++ b/src/mapi/glapi/gen/Makefile.am
> @@ -130,6 +130,7 @@ API_XML = \
>  	ARB_draw_instanced.xml \
>  	ARB_ES2_compatibility.xml \
>  	ARB_ES3_compatibility.xml \
> +	ARB_framebuffer_no_attachments.xml \
>  	ARB_framebuffer_object.xml \
>  	ARB_geometry_shader4.xml \
>  	ARB_get_program_binary.xml \
> diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
> index 3090b9f..5079d30 100644
> --- a/src/mapi/glapi/gen/gl_API.xml
> +++ b/src/mapi/glapi/gen/gl_API.xml
> @@ -8188,7 +8188,9 @@
>      <!-- No new functions, types, enums. -->
>  </category>
>  
> -<!-- ARB extensions #130..#131 -->
> +<xi:include href="ARB_framebuffer_no_attachments.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
> +
> +<!-- ARB extensions #131 -->
>  
>  <category name="GL_ARB_explicit_uniform_location" number="128">
>      <enum name="MAX_UNIFORM_LOCATIONS" count="1" value="0x826E" >
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 8fea7f8..4ac3f20 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -1335,6 +1335,34 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer)
>     bind_renderbuffer(target, renderbuffer, true);
>  }
>  
> +extern void GLAPIENTRY

Since this "extern"...

> +_mesa_FramebufferParameteri(GLenum target, GLenum pname, GLint param)
> +{
> +   GET_CURRENT_CONTEXT(ctx);
> +
> +   (void) target;
> +   (void) pname;
> +   (void) param;
> +
> +   _mesa_error(ctx, GL_INVALID_OPERATION,
> +               "glFramebufferParameteri not supported "
> +               "(ARB_framebuffer_no_attachments not implemented)");
> +}
> +
> +extern void GLAPIENTRY

...and this "extern" are removed in patch 3, just never add them in the
first place.

> +_mesa_GetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
> +{
> +   GET_CURRENT_CONTEXT(ctx);
> +
> +   (void) target;
> +   (void) pname;
> +   (void) param;
> +
> +   _mesa_error(ctx, GL_INVALID_OPERATION,
> +               "glGetNamedFramebufferParameteriv not supported "
> +               "(ARB_framebuffer_no_attachments not implemented)");
> +}
> +
>  
>  /**
>   * Remove the specified renderbuffer or texture from any attachment point in
> diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h
> index 9f570db..8dad0ff 100644
> --- a/src/mesa/main/fbobject.h
> +++ b/src/mesa/main/fbobject.h
> @@ -288,4 +288,10 @@ extern void GLAPIENTRY
>  _mesa_DiscardFramebufferEXT(GLenum target, GLsizei numAttachments,
>                              const GLenum *attachments);
>  
> +extern void GLAPIENTRY
> +_mesa_FramebufferParameteri(GLenum target, GLenum pname, GLint param);
> +
> +extern void GLAPIENTRY
> +_mesa_GetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);
> +
>  #endif /* FBOBJECT_H */
> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> index 8a6c81a..6290096 100644
> --- a/src/mesa/main/get.c
> +++ b/src/mesa/main/get.c
> @@ -393,6 +393,7 @@ EXTRA_EXT(INTEL_performance_query);
>  EXTRA_EXT(ARB_explicit_uniform_location);
>  EXTRA_EXT(ARB_clip_control);
>  EXTRA_EXT(EXT_polygon_offset_clamp);
> +EXTRA_EXT(ARB_framebuffer_no_attachments);
>  
>  static const int
>  extra_ARB_color_buffer_float_or_glcore[] = {
> diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
> index 41cb2c1..4d30cee 100644
> --- a/src/mesa/main/get_hash_params.py
> +++ b/src/mesa/main/get_hash_params.py
> @@ -798,6 +798,12 @@ descriptor=[
>    [ "MIN_FRAGMENT_INTERPOLATION_OFFSET", "CONTEXT_FLOAT(Const.MinFragmentInterpolationOffset), extra_ARB_gpu_shader5" ],
>    [ "MAX_FRAGMENT_INTERPOLATION_OFFSET", "CONTEXT_FLOAT(Const.MaxFragmentInterpolationOffset), extra_ARB_gpu_shader5" ],
>    [ "FRAGMENT_INTERPOLATION_OFFSET_BITS", "CONST(FRAGMENT_INTERPOLATION_OFFSET_BITS), extra_ARB_gpu_shader5" ],
> +
> +# GL_ARB_framebuffer_no_attachments
> +  ["MAX_FRAMEBUFFER_WIDTH", "CONTEXT_INT(Const.MaxFramebufferWidth), extra_ARB_framebuffer_no_attachments"],
> +  ["MAX_FRAMEBUFFER_HEIGHT", "CONTEXT_INT(Const.MaxFramebufferHeight), extra_ARB_framebuffer_no_attachments"],
> +  ["MAX_FRAMEBUFFER_LAYERS", "CONTEXT_INT(Const.MaxFramebufferLayers), extra_ARB_framebuffer_no_attachments"],
> +  ["MAX_FRAMEBUFFER_SAMPLES", "CONTEXT_INT(Const.MaxFramebufferSamples), extra_ARB_framebuffer_no_attachments"],
>  ]},
>  
>  # Enums restricted to OpenGL Core profile
> diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
> index d38b68d..c895fe0 100644
> --- a/src/mesa/main/tests/dispatch_sanity.cpp
> +++ b/src/mesa/main/tests/dispatch_sanity.cpp
> @@ -853,8 +853,8 @@ const struct function gl_core_functions_possible[] = {
>  // { "glVertexArrayVertexAttribLFormatEXT", 43, -1 },   // XXX: Add to xml
>  // { "glVertexArrayVertexAttribBindingEXT", 43, -1 },   // XXX: Add to xml
>  // { "glVertexArrayVertexBindingDivisorEXT", 43, -1 },  // XXX: Add to xml
> -// { "glFramebufferParameteri", 43, -1 },               // XXX: Add to xml
> -// { "glGetFramebufferParameteriv", 43, -1 },           // XXX: Add to xml
> +   { "glFramebufferParameteri", 43, -1 },
> +   { "glGetFramebufferParameteriv", 43, -1 },

And these will need to go in common_desktop_functions_possible now.

With all of those comments addressed (and assuming it still passes
piglit, etc.), this patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

>  // { "glNamedFramebufferParameteriEXT", 43, -1 },       // XXX: Add to xml
>  // { "glGetNamedFramebufferParameterivEXT", 43, -1 },   // XXX: Add to xml
>  // { "glGetInternalformati64v", 43, -1 },               // XXX: Add to xml
> 



More information about the mesa-dev mailing list