[Mesa-dev] [PATCH 1/2] mesa: MESA_framebuffer_flip_y extension [v4]

2018-07-23 Thread Fritz Koenig
Adds an extension to glFramebufferParameteri
that will specify if the framebuffer is vertically
flipped. Historically system framebuffers are
vertically flipped and user framebuffers are not.
Checking to see the state was done by looking at
the name field.  This adds an explicit field.

v2:
* updated spec language [for chadv]
* correctly specifying ES 3.1 [for chadv]
* refactor access to rb->Name [for jason]
* handle GetFramebufferParameteriv [for chadv]
v3:
* correct _mesa_GetMultisamplefv [for kusmabite]
v4:
* update spec language [for chadv]
* s/GLboolean/bool/g [for chadv]
* s/InvertedY/FlipY/g [for chadv]
* s/inverted_y/flip_y/g [for chadv]
* assert changes [for chadv]
---
 docs/specs/MESA_framebuffer_flip_y.txt | 81 ++
 docs/specs/enums.txt   |  3 +
 include/GLES2/gl2ext.h |  5 ++
 src/mapi/glapi/registry/gl.xml |  6 ++
 src/mesa/drivers/dri/i915/intel_fbo.c  |  6 +-
 src/mesa/drivers/dri/i965/intel_fbo.c  |  6 +-
 src/mesa/drivers/dri/nouveau/nouveau_fbo.c |  6 +-
 src/mesa/drivers/dri/radeon/radeon_fbo.c   |  6 +-
 src/mesa/drivers/dri/radeon/radeon_span.c  |  9 ++-
 src/mesa/drivers/dri/swrast/swrast.c   |  6 +-
 src/mesa/drivers/osmesa/osmesa.c   |  5 +-
 src/mesa/drivers/x11/xm_buffer.c   |  3 +-
 src/mesa/drivers/x11/xmesaP.h  |  3 +-
 src/mesa/main/accum.c  | 17 +++--
 src/mesa/main/dd.h |  3 +-
 src/mesa/main/extensions_table.h   |  1 +
 src/mesa/main/fbobject.c   | 16 +
 src/mesa/main/framebuffer.c|  1 +
 src/mesa/main/glheader.h   |  3 +
 src/mesa/main/mtypes.h |  4 ++
 src/mesa/main/readpix.c| 20 +++---
 src/mesa/state_tracker/st_cb_fbo.c |  6 +-
 src/mesa/swrast/s_blit.c   | 17 +++--
 src/mesa/swrast/s_clear.c  |  3 +-
 src/mesa/swrast/s_copypix.c| 11 +--
 src/mesa/swrast/s_depth.c  |  6 +-
 src/mesa/swrast/s_drawpix.c| 26 ---
 src/mesa/swrast/s_renderbuffer.c   |  6 +-
 src/mesa/swrast/s_renderbuffer.h   |  3 +-
 src/mesa/swrast/s_stencil.c|  3 +-
 30 files changed, 235 insertions(+), 56 deletions(-)
 create mode 100644 docs/specs/MESA_framebuffer_flip_y.txt

diff --git a/docs/specs/MESA_framebuffer_flip_y.txt 
b/docs/specs/MESA_framebuffer_flip_y.txt
new file mode 100644
index 00..697ab4e75d
--- /dev/null
+++ b/docs/specs/MESA_framebuffer_flip_y.txt
@@ -0,0 +1,81 @@
+Name
+
+MESA_framebuffer_flip_y
+
+Name Strings
+
+GL_MESA_framebuffer_flip_y
+
+Contact
+
+Fritz Koenig 
+
+Contributors
+
+Fritz Koenig, Google
+Kristian Høgsberg, Google
+Chad Versace, Google
+
+Status
+
+Proposal
+
+Version
+
+Version 1, June 7, 2018
+
+Number
+
+302
+
+Dependencies
+
+OpenGL ES 3.1 is required, for FramebufferParameteri.
+
+Overview
+
+This extension defines a new framebuffer parameter,
+GL_FRAMEBUFFER_FLIP_Y_MESA, that changes the behavior of the reads and
+writes to the framebuffer attachment points. When 
GL_FRAMEBUFFER_FLIP_Y_MESA
+is GL_TRUE, render commands and pixel transfer operations access the
+backing store of each attachment point with an y-inverted coordinate
+system. This y-inversion is relative to the coordinate system set when
+GL_FRAMEBUFFER_FLIP_Y_MESA is GL_FALSE.
+
+Access through TexSubImage2D and similar calls will notice the effect of
+the flip when they are not attached to framebuffer objects because
+GL_FRAMEBUFFER_FLIP_Y_MESA is associated with the framebuffer object and
+not the attachment points.
+
+IP Status
+
+None
+
+Issues
+
+None
+
+New Procedures and Functions
+
+None
+
+New Types
+
+None
+
+New Tokens
+
+Accepted by the  argument of FramebufferParameteri and
+GetFramebufferParameteriv:
+
+GL_FRAMEBUFFER_FLIP_Y_MESA  0x8BBB
+
+Errors
+
+An INVALID_OPERATION error is generated by GetFramebufferParameteriv if the
+default framebuffer is bound to  and  is 
FRAMEBUFFER_FLIP_Y_MESA.
+
+Revision History
+
+Version 1, June, 2018
+Initial draft (Fritz Koenig)
diff --git a/docs/specs/enums.txt b/docs/specs/enums.txt
index bf3ca9c176..e1b95ec874 100644
--- a/docs/specs/enums.txt
+++ b/docs/specs/enums.txt
@@ -71,6 +71,9 @@ GL_MESA_tile_raster_order
GL_TILE_RASTER_ORDER_INCREASING_X_MESA  0x8BB9
GL_TILE_RASTER_ORDER_INCREASING_Y_MESA  0x8BBA
 
+GL_MESA_framebuffer_flip_y
+   GL_FRAMEBUFFER_FLIP_Y_MESA   0x8BBB
+
 EGL_MESA_drm_image
 EGL_DRM_BUFFER_FORMAT_MESA 0x31D0
 EGL_DRM_BUFFER_USE_MESA0x31D1
diff --git a/include/GLES2/gl2ext.h b/include/GLES2/gl2ext.h
index a7d19a1fc8..0a93bfb865 100644
--- a/include/GLES2/gl2ext.h
+++ b/include/GLES2/gl2ext.h
@@ -2334,6 

Re: [Mesa-dev] [PATCH 1/2] mesa: MESA_framebuffer_flip_y extension [v3]

2018-07-19 Thread Fritz Koenig
On Wed, Jul 11, 2018 at 3:54 PM Chad Versace  wrote:
>
> +Ken, I had a question about GLboolean. I call you by name in the
> comments below.
>
> On Fri 29 Jun 2018, Fritz Koenig wrote:
> > Adds an extension to glFramebufferParameteri
> > that will specify if the framebuffer is vertically
> > flipped. Historically system framebuffers are
> > vertically flipped and user framebuffers are not.
> > Checking to see the state was done by looking at
> > the name field.  This adds an explicit field.
> >
> > v2:
> > * updated spec language [for chadv]
> > * correctly specifying ES 3.1 [for chadv]
> > * refactor access to rb->Name [for jason]
> > * handle GetFramebufferParameteriv [for chadv]
> > v3:
> > * correct _mesa_GetMultisamplefv [for kusmabite]
> > ---
>
> >  docs/specs/MESA_framebuffer_flip_y.spec| 84 ++
>
> Use file extension '.txt'. Khronos no longer uses the '.spec' extension.
>
> File docs/specs/enums.txt needs an update too.
>
> >  include/GLES2/gl2ext.h |  5 ++
> >  src/mapi/glapi/registry/gl.xml |  6 ++
> >  src/mesa/drivers/dri/i915/intel_fbo.c  |  7 +-
> >  src/mesa/drivers/dri/i965/intel_fbo.c  |  7 +-
> >  src/mesa/drivers/dri/nouveau/nouveau_fbo.c |  7 +-
> >  src/mesa/drivers/dri/radeon/radeon_fbo.c   |  7 +-
> >  src/mesa/drivers/dri/radeon/radeon_span.c  |  9 ++-
> >  src/mesa/drivers/dri/swrast/swrast.c   |  7 +-
> >  src/mesa/drivers/osmesa/osmesa.c   |  5 +-
> >  src/mesa/drivers/x11/xm_buffer.c   |  3 +-
> >  src/mesa/drivers/x11/xmesaP.h  |  3 +-
> >  src/mesa/main/accum.c  | 17 +++--
> >  src/mesa/main/dd.h |  3 +-
> >  src/mesa/main/extensions_table.h   |  1 +
> >  src/mesa/main/fbobject.c   | 18 -
> >  src/mesa/main/framebuffer.c|  1 +
> >  src/mesa/main/glheader.h   |  3 +
> >  src/mesa/main/mtypes.h |  3 +
> >  src/mesa/main/readpix.c| 20 +++---
> >  src/mesa/state_tracker/st_cb_fbo.c |  7 +-
> >  src/mesa/swrast/s_blit.c   | 17 +++--
> >  src/mesa/swrast/s_clear.c  |  3 +-
> >  src/mesa/swrast/s_copypix.c| 11 +--
> >  src/mesa/swrast/s_depth.c  |  6 +-
> >  src/mesa/swrast/s_drawpix.c| 26 ---
> >  src/mesa/swrast/s_renderbuffer.c   |  6 +-
> >  src/mesa/swrast/s_renderbuffer.h   |  3 +-
> >  src/mesa/swrast/s_stencil.c|  3 +-
> >  29 files changed, 241 insertions(+), 57 deletions(-)
> >  create mode 100644 docs/specs/MESA_framebuffer_flip_y.spec
> >
> > diff --git a/docs/specs/MESA_framebuffer_flip_y.spec 
> > b/docs/specs/MESA_framebuffer_flip_y.spec
> > new file mode 100644
> > index 00..dca77a9541
> > --- /dev/null
> > +++ b/docs/specs/MESA_framebuffer_flip_y.spec
> > @@ -0,0 +1,84 @@
> > +Name
> > +
> > +MESA_framebuffer_flip_y
> > +
> > +Name Strings
> > +
> > +GL_MESA_framebuffer_flip_y
> > +
> > +Contact
> > +
> > +Fritz Koenig 
> > +
> > +Contributors
> > +
> > +Fritz Koenig, Google
> > +Kristian Høgsberg, Google
> > +Chad Versace, Google
> > +
> > +Status
> > +
> > +Proposal
> > +
> > +Version
> > +
> > +Version 1, June 7, 2018
> > +
> > +Number
> > +
> > +TBD
> > +
> > +Dependencies
> > +
> > +OpenGL ES 3.1 is required, for FramebufferParameteri.
> > +
> > +Overview
> > +
> > +Rendered buffers are normally returned right side up, as accessed
> > +top to bottom.  This extension allows those buffers to be upside down
> > +when accessed top to bottom.
> > +
> > +This extension defines a new framebuffer parameter,
> > +GL_FRAMEBUFFER_FLIP_Y_MESA, that changes the behavior of the reads and
> > +writes to the framebuffer attachment points. When 
> > GL_FRAMEBUFFER_FLIP_Y_MESA
> > +is GL_TRUE, render commands and pixel transfer operations access the
> > +backing store of each attachment point with an y-inverted coordinate
> > +system. This y-inversion is relative to the coordinate system set when
> > +GL_FRAMEBUFFER_FLIP_Y_MESA is GL_FALSE.
> > +
> > +Access through TexSubImage2D and similar calls will notice the effect 
> > of
> > +the flip when they are not attached to framebuffer objects because
> > +GL_FRAMEBUFFER_FLIP_Y_MESA is associated with the framebuffer object 
> > and
> > +not the attachment points.
> > +
> > +IP Status
> > +
> > +None
> > +
> > +Issues
> > +
> > +None
> > +
> > +New Procedures and Functions
> > +
> > +None
> > +
> > +New Types
> > +
> > +None
> > +
> > +New Tokens
> > +
> > +Accepted by the  argument of FramebufferParameteri and
> > +GetFramebufferParameteriv:
> > +
> > +GL_FRAMEBUFFER_FLIP_Y_MESA  0x8BBB
> > +
> > +Errors
> > +GL_INVALID_OPERATION is returned from  GetFramebufferParameteriv if 
> > this
> > +is called on a winsys 

Re: [Mesa-dev] [PATCH 1/2] mesa: MESA_framebuffer_flip_y extension [v3]

2018-07-18 Thread Chad Versace
On Wed 11 Jul 2018, Chad Versace wrote:
> +Ken, I had a question about GLboolean. I call you by name in the
> comments below.
>
> On Fri 29 Jun 2018, Fritz Koenig wrote:
> > Adds an extension to glFramebufferParameteri
> > that will specify if the framebuffer is vertically
> > flipped. Historically system framebuffers are
> > vertically flipped and user framebuffers are not.
> > Checking to see the state was done by looking at
> > the name field.  This adds an explicit field.
> >
> > v2:
> > * updated spec language [for chadv]
> > * correctly specifying ES 3.1 [for chadv]
> > * refactor access to rb->Name [for jason]
> > * handle GetFramebufferParameteriv [for chadv]
> > v3:
> > * correct _mesa_GetMultisamplefv [for kusmabite]
> > ---
>
> >  docs/specs/MESA_framebuffer_flip_y.spec| 84 ++

[snip]

> > diff --git a/src/mesa/drivers/dri/i915/intel_fbo.c 
> > b/src/mesa/drivers/dri/i915/intel_fbo.c
> > index 827a77f722..31b65fb53b 100644
> > --- a/src/mesa/drivers/dri/i915/intel_fbo.c
> > +++ b/src/mesa/drivers/dri/i915/intel_fbo.c
> > @@ -86,7 +86,8 @@ intel_map_renderbuffer(struct gl_context *ctx,
> >GLuint x, GLuint y, GLuint w, GLuint h,
> >GLbitfield mode,
> >GLubyte **out_map,
> > -  GLint *out_stride)
> > +  GLint *out_stride,
> > +  GLboolean inverted_y)

[snip]

> And I believe the internal APIs should use 'bool' instead of
> 'GLboolean'. See commit 786a6472450b50977e6906e27d5f481e00b05d73 .
>
> Ken, should Fritz also use plain 'bool' in struct gl_framebuffer? That
> is, should it be
>
> struct gl_framebuffer {
> ...
> GLboolean FlipY;
> or
> bool FlipY;

I received feedback on #intel-3d about the GLboolean-vs-bool question.

jekstrand | chadv: The extension?  GLboolean.  Internal calls?  bool.
jekstrand | chadv: GLboolean should die!
   Kayden | chadv: definitely bool, GLboolean is evil
   Kayden | anything not touching the GL API explicitly should be bool
   Kayden | even fields in gl_context should get converted IMO
   anholt | agreed
   Kayden | we've had bugs where somebody returned a pointer as a GLboolean
   Kayden | thinking it would get treated as true/false
   Kayden | and instead it truncated to signed char
   Kayden | so based on the address it would have a random truth value
   Kayden | sorry I neglected to email you back :(
jekstrand | unless you're on a 64-bit system and it just happens to be aligned
  | correctly...

Based on their emphatic feedback, definitely use bool in all driver internal 
APIs.
And you should probably use bool in struct framebuffer too.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] mesa: MESA_framebuffer_flip_y extension [v3]

2018-07-18 Thread Fritz Koenig
On Wed, Jul 11, 2018 at 3:54 PM Chad Versace  wrote:
>
> +Ken, I had a question about GLboolean. I call you by name in the
> comments below.
>
> On Fri 29 Jun 2018, Fritz Koenig wrote:
> > Adds an extension to glFramebufferParameteri
> > that will specify if the framebuffer is vertically
> > flipped. Historically system framebuffers are
> > vertically flipped and user framebuffers are not.
> > Checking to see the state was done by looking at
> > the name field.  This adds an explicit field.
> >
> > v2:
> > * updated spec language [for chadv]
> > * correctly specifying ES 3.1 [for chadv]
> > * refactor access to rb->Name [for jason]
> > * handle GetFramebufferParameteriv [for chadv]
> > v3:
> > * correct _mesa_GetMultisamplefv [for kusmabite]
> > ---
>
> >  docs/specs/MESA_framebuffer_flip_y.spec| 84 ++
>
> Use file extension '.txt'. Khronos no longer uses the '.spec' extension.
>
> File docs/specs/enums.txt needs an update too.
>
> >  include/GLES2/gl2ext.h |  5 ++
> >  src/mapi/glapi/registry/gl.xml |  6 ++
> >  src/mesa/drivers/dri/i915/intel_fbo.c  |  7 +-
> >  src/mesa/drivers/dri/i965/intel_fbo.c  |  7 +-
> >  src/mesa/drivers/dri/nouveau/nouveau_fbo.c |  7 +-
> >  src/mesa/drivers/dri/radeon/radeon_fbo.c   |  7 +-
> >  src/mesa/drivers/dri/radeon/radeon_span.c  |  9 ++-
> >  src/mesa/drivers/dri/swrast/swrast.c   |  7 +-
> >  src/mesa/drivers/osmesa/osmesa.c   |  5 +-
> >  src/mesa/drivers/x11/xm_buffer.c   |  3 +-
> >  src/mesa/drivers/x11/xmesaP.h  |  3 +-
> >  src/mesa/main/accum.c  | 17 +++--
> >  src/mesa/main/dd.h |  3 +-
> >  src/mesa/main/extensions_table.h   |  1 +
> >  src/mesa/main/fbobject.c   | 18 -
> >  src/mesa/main/framebuffer.c|  1 +
> >  src/mesa/main/glheader.h   |  3 +
> >  src/mesa/main/mtypes.h |  3 +
> >  src/mesa/main/readpix.c| 20 +++---
> >  src/mesa/state_tracker/st_cb_fbo.c |  7 +-
> >  src/mesa/swrast/s_blit.c   | 17 +++--
> >  src/mesa/swrast/s_clear.c  |  3 +-
> >  src/mesa/swrast/s_copypix.c| 11 +--
> >  src/mesa/swrast/s_depth.c  |  6 +-
> >  src/mesa/swrast/s_drawpix.c| 26 ---
> >  src/mesa/swrast/s_renderbuffer.c   |  6 +-
> >  src/mesa/swrast/s_renderbuffer.h   |  3 +-
> >  src/mesa/swrast/s_stencil.c|  3 +-
> >  29 files changed, 241 insertions(+), 57 deletions(-)
> >  create mode 100644 docs/specs/MESA_framebuffer_flip_y.spec
> >
> > diff --git a/docs/specs/MESA_framebuffer_flip_y.spec 
> > b/docs/specs/MESA_framebuffer_flip_y.spec
> > new file mode 100644
> > index 00..dca77a9541
> > --- /dev/null
> > +++ b/docs/specs/MESA_framebuffer_flip_y.spec
> > @@ -0,0 +1,84 @@
> > +Name
> > +
> > +MESA_framebuffer_flip_y
> > +
> > +Name Strings
> > +
> > +GL_MESA_framebuffer_flip_y
> > +
> > +Contact
> > +
> > +Fritz Koenig 
> > +
> > +Contributors
> > +
> > +Fritz Koenig, Google
> > +Kristian Høgsberg, Google
> > +Chad Versace, Google
> > +
> > +Status
> > +
> > +Proposal
> > +
> > +Version
> > +
> > +Version 1, June 7, 2018
> > +
> > +Number
> > +
> > +TBD
> > +
> > +Dependencies
> > +
> > +OpenGL ES 3.1 is required, for FramebufferParameteri.
> > +
> > +Overview
> > +
> > +Rendered buffers are normally returned right side up, as accessed
> > +top to bottom.  This extension allows those buffers to be upside down
> > +when accessed top to bottom.
> > +
> > +This extension defines a new framebuffer parameter,
> > +GL_FRAMEBUFFER_FLIP_Y_MESA, that changes the behavior of the reads and
> > +writes to the framebuffer attachment points. When 
> > GL_FRAMEBUFFER_FLIP_Y_MESA
> > +is GL_TRUE, render commands and pixel transfer operations access the
> > +backing store of each attachment point with an y-inverted coordinate
> > +system. This y-inversion is relative to the coordinate system set when
> > +GL_FRAMEBUFFER_FLIP_Y_MESA is GL_FALSE.
> > +
> > +Access through TexSubImage2D and similar calls will notice the effect 
> > of
> > +the flip when they are not attached to framebuffer objects because
> > +GL_FRAMEBUFFER_FLIP_Y_MESA is associated with the framebuffer object 
> > and
> > +not the attachment points.
> > +
> > +IP Status
> > +
> > +None
> > +
> > +Issues
> > +
> > +None
> > +
> > +New Procedures and Functions
> > +
> > +None
> > +
> > +New Types
> > +
> > +None
> > +
> > +New Tokens
> > +
> > +Accepted by the  argument of FramebufferParameteri and
> > +GetFramebufferParameteriv:
> > +
> > +GL_FRAMEBUFFER_FLIP_Y_MESA  0x8BBB
> > +
> > +Errors
> > +GL_INVALID_OPERATION is returned from  GetFramebufferParameteriv if 
> > this
> > +is called on a winsys 

Re: [Mesa-dev] [PATCH 1/2] mesa: MESA_framebuffer_flip_y extension [v3]

2018-07-11 Thread Chad Versace
+Ken, I had a question about GLboolean. I call you by name in the
comments below.

On Fri 29 Jun 2018, Fritz Koenig wrote:
> Adds an extension to glFramebufferParameteri
> that will specify if the framebuffer is vertically
> flipped. Historically system framebuffers are
> vertically flipped and user framebuffers are not.
> Checking to see the state was done by looking at
> the name field.  This adds an explicit field.
> 
> v2:
> * updated spec language [for chadv]
> * correctly specifying ES 3.1 [for chadv]
> * refactor access to rb->Name [for jason]
> * handle GetFramebufferParameteriv [for chadv]
> v3:
> * correct _mesa_GetMultisamplefv [for kusmabite]
> ---

>  docs/specs/MESA_framebuffer_flip_y.spec| 84 ++

Use file extension '.txt'. Khronos no longer uses the '.spec' extension.

File docs/specs/enums.txt needs an update too.

>  include/GLES2/gl2ext.h |  5 ++
>  src/mapi/glapi/registry/gl.xml |  6 ++
>  src/mesa/drivers/dri/i915/intel_fbo.c  |  7 +-
>  src/mesa/drivers/dri/i965/intel_fbo.c  |  7 +-
>  src/mesa/drivers/dri/nouveau/nouveau_fbo.c |  7 +-
>  src/mesa/drivers/dri/radeon/radeon_fbo.c   |  7 +-
>  src/mesa/drivers/dri/radeon/radeon_span.c  |  9 ++-
>  src/mesa/drivers/dri/swrast/swrast.c   |  7 +-
>  src/mesa/drivers/osmesa/osmesa.c   |  5 +-
>  src/mesa/drivers/x11/xm_buffer.c   |  3 +-
>  src/mesa/drivers/x11/xmesaP.h  |  3 +-
>  src/mesa/main/accum.c  | 17 +++--
>  src/mesa/main/dd.h |  3 +-
>  src/mesa/main/extensions_table.h   |  1 +
>  src/mesa/main/fbobject.c   | 18 -
>  src/mesa/main/framebuffer.c|  1 +
>  src/mesa/main/glheader.h   |  3 +
>  src/mesa/main/mtypes.h |  3 +
>  src/mesa/main/readpix.c| 20 +++---
>  src/mesa/state_tracker/st_cb_fbo.c |  7 +-
>  src/mesa/swrast/s_blit.c   | 17 +++--
>  src/mesa/swrast/s_clear.c  |  3 +-
>  src/mesa/swrast/s_copypix.c| 11 +--
>  src/mesa/swrast/s_depth.c  |  6 +-
>  src/mesa/swrast/s_drawpix.c| 26 ---
>  src/mesa/swrast/s_renderbuffer.c   |  6 +-
>  src/mesa/swrast/s_renderbuffer.h   |  3 +-
>  src/mesa/swrast/s_stencil.c|  3 +-
>  29 files changed, 241 insertions(+), 57 deletions(-)
>  create mode 100644 docs/specs/MESA_framebuffer_flip_y.spec
> 
> diff --git a/docs/specs/MESA_framebuffer_flip_y.spec 
> b/docs/specs/MESA_framebuffer_flip_y.spec
> new file mode 100644
> index 00..dca77a9541
> --- /dev/null
> +++ b/docs/specs/MESA_framebuffer_flip_y.spec
> @@ -0,0 +1,84 @@
> +Name
> +
> +MESA_framebuffer_flip_y
> +
> +Name Strings
> +
> +GL_MESA_framebuffer_flip_y
> +
> +Contact
> +
> +Fritz Koenig 
> +
> +Contributors
> +
> +Fritz Koenig, Google
> +Kristian Høgsberg, Google
> +Chad Versace, Google
> +
> +Status
> +
> +Proposal
> +
> +Version
> +
> +Version 1, June 7, 2018
> +
> +Number
> +
> +TBD
> +
> +Dependencies
> +
> +OpenGL ES 3.1 is required, for FramebufferParameteri.
> +
> +Overview
> +
> +Rendered buffers are normally returned right side up, as accessed
> +top to bottom.  This extension allows those buffers to be upside down
> +when accessed top to bottom.
> +
> +This extension defines a new framebuffer parameter,
> +GL_FRAMEBUFFER_FLIP_Y_MESA, that changes the behavior of the reads and
> +writes to the framebuffer attachment points. When 
> GL_FRAMEBUFFER_FLIP_Y_MESA
> +is GL_TRUE, render commands and pixel transfer operations access the
> +backing store of each attachment point with an y-inverted coordinate
> +system. This y-inversion is relative to the coordinate system set when
> +GL_FRAMEBUFFER_FLIP_Y_MESA is GL_FALSE.
> +
> +Access through TexSubImage2D and similar calls will notice the effect of
> +the flip when they are not attached to framebuffer objects because
> +GL_FRAMEBUFFER_FLIP_Y_MESA is associated with the framebuffer object and
> +not the attachment points.
> +
> +IP Status
> +
> +None
> +
> +Issues
> +
> +None
> +
> +New Procedures and Functions
> +
> +None
> +
> +New Types
> +
> +None
> +
> +New Tokens
> +
> +Accepted by the  argument of FramebufferParameteri and
> +GetFramebufferParameteriv:
> +
> +GL_FRAMEBUFFER_FLIP_Y_MESA  0x8BBB
> +
> +Errors
> +GL_INVALID_OPERATION is returned from  GetFramebufferParameteriv if this
> +is called on a winsys framebuffer.


Above, s/on a winsys framebuffer/on the default framebuffer/


> +
> +Revision History
> +
> +Version 1, June, 2018
> +Initial draft (Fritz Koenig)
> diff --git a/include/GLES2/gl2ext.h b/include/GLES2/gl2ext.h
> index a7d19a1fc8..0a93bfb865 100644
> --- a/include/GLES2/gl2ext.h
> +++ b/include/GLES2/gl2ext.h
> @@ -2334,6 

[Mesa-dev] [PATCH 1/2] mesa: MESA_framebuffer_flip_y extension [v3]

2018-06-29 Thread Fritz Koenig
Adds an extension to glFramebufferParameteri
that will specify if the framebuffer is vertically
flipped. Historically system framebuffers are
vertically flipped and user framebuffers are not.
Checking to see the state was done by looking at
the name field.  This adds an explicit field.

v2:
* updated spec language [for chadv]
* correctly specifying ES 3.1 [for chadv]
* refactor access to rb->Name [for jason]
* handle GetFramebufferParameteriv [for chadv]
v3:
* correct _mesa_GetMultisamplefv [for kusmabite]
---
 docs/specs/MESA_framebuffer_flip_y.spec| 84 ++
 include/GLES2/gl2ext.h |  5 ++
 src/mapi/glapi/registry/gl.xml |  6 ++
 src/mesa/drivers/dri/i915/intel_fbo.c  |  7 +-
 src/mesa/drivers/dri/i965/intel_fbo.c  |  7 +-
 src/mesa/drivers/dri/nouveau/nouveau_fbo.c |  7 +-
 src/mesa/drivers/dri/radeon/radeon_fbo.c   |  7 +-
 src/mesa/drivers/dri/radeon/radeon_span.c  |  9 ++-
 src/mesa/drivers/dri/swrast/swrast.c   |  7 +-
 src/mesa/drivers/osmesa/osmesa.c   |  5 +-
 src/mesa/drivers/x11/xm_buffer.c   |  3 +-
 src/mesa/drivers/x11/xmesaP.h  |  3 +-
 src/mesa/main/accum.c  | 17 +++--
 src/mesa/main/dd.h |  3 +-
 src/mesa/main/extensions_table.h   |  1 +
 src/mesa/main/fbobject.c   | 18 -
 src/mesa/main/framebuffer.c|  1 +
 src/mesa/main/glheader.h   |  3 +
 src/mesa/main/mtypes.h |  3 +
 src/mesa/main/readpix.c| 20 +++---
 src/mesa/state_tracker/st_cb_fbo.c |  7 +-
 src/mesa/swrast/s_blit.c   | 17 +++--
 src/mesa/swrast/s_clear.c  |  3 +-
 src/mesa/swrast/s_copypix.c| 11 +--
 src/mesa/swrast/s_depth.c  |  6 +-
 src/mesa/swrast/s_drawpix.c| 26 ---
 src/mesa/swrast/s_renderbuffer.c   |  6 +-
 src/mesa/swrast/s_renderbuffer.h   |  3 +-
 src/mesa/swrast/s_stencil.c|  3 +-
 29 files changed, 241 insertions(+), 57 deletions(-)
 create mode 100644 docs/specs/MESA_framebuffer_flip_y.spec

diff --git a/docs/specs/MESA_framebuffer_flip_y.spec 
b/docs/specs/MESA_framebuffer_flip_y.spec
new file mode 100644
index 00..dca77a9541
--- /dev/null
+++ b/docs/specs/MESA_framebuffer_flip_y.spec
@@ -0,0 +1,84 @@
+Name
+
+MESA_framebuffer_flip_y
+
+Name Strings
+
+GL_MESA_framebuffer_flip_y
+
+Contact
+
+Fritz Koenig 
+
+Contributors
+
+Fritz Koenig, Google
+Kristian Høgsberg, Google
+Chad Versace, Google
+
+Status
+
+Proposal
+
+Version
+
+Version 1, June 7, 2018
+
+Number
+
+TBD
+
+Dependencies
+
+OpenGL ES 3.1 is required, for FramebufferParameteri.
+
+Overview
+
+Rendered buffers are normally returned right side up, as accessed
+top to bottom.  This extension allows those buffers to be upside down
+when accessed top to bottom.
+
+This extension defines a new framebuffer parameter,
+GL_FRAMEBUFFER_FLIP_Y_MESA, that changes the behavior of the reads and
+writes to the framebuffer attachment points. When 
GL_FRAMEBUFFER_FLIP_Y_MESA
+is GL_TRUE, render commands and pixel transfer operations access the
+backing store of each attachment point with an y-inverted coordinate
+system. This y-inversion is relative to the coordinate system set when
+GL_FRAMEBUFFER_FLIP_Y_MESA is GL_FALSE.
+
+Access through TexSubImage2D and similar calls will notice the effect of
+the flip when they are not attached to framebuffer objects because
+GL_FRAMEBUFFER_FLIP_Y_MESA is associated with the framebuffer object and
+not the attachment points.
+
+IP Status
+
+None
+
+Issues
+
+None
+
+New Procedures and Functions
+
+None
+
+New Types
+
+None
+
+New Tokens
+
+Accepted by the  argument of FramebufferParameteri and
+GetFramebufferParameteriv:
+
+GL_FRAMEBUFFER_FLIP_Y_MESA  0x8BBB
+
+Errors
+GL_INVALID_OPERATION is returned from  GetFramebufferParameteriv if this
+is called on a winsys framebuffer.
+
+Revision History
+
+Version 1, June, 2018
+Initial draft (Fritz Koenig)
diff --git a/include/GLES2/gl2ext.h b/include/GLES2/gl2ext.h
index a7d19a1fc8..0a93bfb865 100644
--- a/include/GLES2/gl2ext.h
+++ b/include/GLES2/gl2ext.h
@@ -2334,6 +2334,11 @@ GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL 
(GLuint queryId, GLuint quer
 #endif
 #endif /* GL_INTEL_performance_query */
 
+#ifndef GL_MESA_framebuffer_flip_y
+#define GL_MESA_framebuffer_flip_y 1
+#define GL_FRAMEBUFFER_FLIP_Y_MESA0x8BBB
+#endif /* GL_MESA_framebuffer_flip_y */
+
 #ifndef GL_MESA_program_binary_formats
 #define GL_MESA_program_binary_formats 1
 #define GL_PROGRAM_BINARY_FORMAT_MESA 0x875F
diff --git a/src/mapi/glapi/registry/gl.xml b/src/mapi/glapi/registry/gl.xml
index 833478aa51..13882eff7b 100644
--- a/src/mapi/glapi/registry/gl.xml
+++ 

Re: [Mesa-dev] [PATCH 1/2] mesa: MESA_framebuffer_flip_y extension [v2]

2018-06-29 Thread Fritz Koenig
On Fri, Jun 29, 2018 at 1:50 AM Erik Faye-Lund  wrote:
>
> On Thu, Jun 28, 2018 at 11:12 PM Fritz Koenig  wrote:
> >
> > Adds an extension to glFramebufferParameteri
> > that will specify if the framebuffer is vertically
> > flipped. Historically system framebuffers are
> > vertically flipped and user framebuffers are not.
> > Checking to see the state was done by looking at
> > the name field.  This adds an explicit field.
> >
> > v2:
> > * updated spec language [for chadv]
> > * correctly specifying ES 3.1 [for chadv]
> > * refactor access to rb->Name [for jason]
> > * handle GetFramebufferParameteriv [for chadv]
> > ---
> >  docs/specs/MESA_framebuffer_flip_y.spec| 84 ++
> >  include/GLES2/gl2ext.h |  5 ++
> >  src/mapi/glapi/registry/gl.xml |  6 ++
> >  src/mesa/drivers/dri/i915/intel_fbo.c  |  7 +-
> >  src/mesa/drivers/dri/i965/intel_fbo.c  |  7 +-
> >  src/mesa/drivers/dri/nouveau/nouveau_fbo.c |  7 +-
> >  src/mesa/drivers/dri/radeon/radeon_fbo.c   |  7 +-
> >  src/mesa/drivers/dri/radeon/radeon_span.c  |  9 ++-
> >  src/mesa/drivers/dri/swrast/swrast.c   |  7 +-
> >  src/mesa/drivers/osmesa/osmesa.c   |  5 +-
> >  src/mesa/drivers/x11/xm_buffer.c   |  3 +-
> >  src/mesa/drivers/x11/xmesaP.h  |  3 +-
> >  src/mesa/main/accum.c  | 17 +++--
> >  src/mesa/main/dd.h |  3 +-
> >  src/mesa/main/extensions_table.h   |  1 +
> >  src/mesa/main/fbobject.c   | 18 -
> >  src/mesa/main/framebuffer.c|  1 +
> >  src/mesa/main/glheader.h   |  3 +
> >  src/mesa/main/mtypes.h |  3 +
> >  src/mesa/main/readpix.c| 20 +++---
> >  src/mesa/state_tracker/st_cb_fbo.c |  7 +-
> >  src/mesa/swrast/s_blit.c   | 17 +++--
> >  src/mesa/swrast/s_clear.c  |  3 +-
> >  src/mesa/swrast/s_copypix.c| 11 +--
> >  src/mesa/swrast/s_depth.c  |  6 +-
> >  src/mesa/swrast/s_drawpix.c| 26 ---
> >  src/mesa/swrast/s_renderbuffer.c   |  6 +-
> >  src/mesa/swrast/s_renderbuffer.h   |  3 +-
> >  src/mesa/swrast/s_stencil.c|  3 +-
> >  29 files changed, 241 insertions(+), 57 deletions(-)
> >  create mode 100644 docs/specs/MESA_framebuffer_flip_y.spec
> >
>
> I think this needs to update the _mesa_is_winsys_fbo-check in
> _mesa_GetMultisamplefv in src/mesa/main/multisample.c to flip the
> sample-positions as well...

Thanks for pointing that one out, will add it.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] mesa: MESA_framebuffer_flip_y extension [v2]

2018-06-29 Thread Erik Faye-Lund
On Thu, Jun 28, 2018 at 11:12 PM Fritz Koenig  wrote:
>
> Adds an extension to glFramebufferParameteri
> that will specify if the framebuffer is vertically
> flipped. Historically system framebuffers are
> vertically flipped and user framebuffers are not.
> Checking to see the state was done by looking at
> the name field.  This adds an explicit field.
>
> v2:
> * updated spec language [for chadv]
> * correctly specifying ES 3.1 [for chadv]
> * refactor access to rb->Name [for jason]
> * handle GetFramebufferParameteriv [for chadv]
> ---
>  docs/specs/MESA_framebuffer_flip_y.spec| 84 ++
>  include/GLES2/gl2ext.h |  5 ++
>  src/mapi/glapi/registry/gl.xml |  6 ++
>  src/mesa/drivers/dri/i915/intel_fbo.c  |  7 +-
>  src/mesa/drivers/dri/i965/intel_fbo.c  |  7 +-
>  src/mesa/drivers/dri/nouveau/nouveau_fbo.c |  7 +-
>  src/mesa/drivers/dri/radeon/radeon_fbo.c   |  7 +-
>  src/mesa/drivers/dri/radeon/radeon_span.c  |  9 ++-
>  src/mesa/drivers/dri/swrast/swrast.c   |  7 +-
>  src/mesa/drivers/osmesa/osmesa.c   |  5 +-
>  src/mesa/drivers/x11/xm_buffer.c   |  3 +-
>  src/mesa/drivers/x11/xmesaP.h  |  3 +-
>  src/mesa/main/accum.c  | 17 +++--
>  src/mesa/main/dd.h |  3 +-
>  src/mesa/main/extensions_table.h   |  1 +
>  src/mesa/main/fbobject.c   | 18 -
>  src/mesa/main/framebuffer.c|  1 +
>  src/mesa/main/glheader.h   |  3 +
>  src/mesa/main/mtypes.h |  3 +
>  src/mesa/main/readpix.c| 20 +++---
>  src/mesa/state_tracker/st_cb_fbo.c |  7 +-
>  src/mesa/swrast/s_blit.c   | 17 +++--
>  src/mesa/swrast/s_clear.c  |  3 +-
>  src/mesa/swrast/s_copypix.c| 11 +--
>  src/mesa/swrast/s_depth.c  |  6 +-
>  src/mesa/swrast/s_drawpix.c| 26 ---
>  src/mesa/swrast/s_renderbuffer.c   |  6 +-
>  src/mesa/swrast/s_renderbuffer.h   |  3 +-
>  src/mesa/swrast/s_stencil.c|  3 +-
>  29 files changed, 241 insertions(+), 57 deletions(-)
>  create mode 100644 docs/specs/MESA_framebuffer_flip_y.spec
>

I think this needs to update the _mesa_is_winsys_fbo-check in
_mesa_GetMultisamplefv in src/mesa/main/multisample.c to flip the
sample-positions as well...
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] mesa: MESA_framebuffer_flip_y extension [v2]

2018-06-28 Thread Fritz Koenig
Adds an extension to glFramebufferParameteri
that will specify if the framebuffer is vertically
flipped. Historically system framebuffers are
vertically flipped and user framebuffers are not.
Checking to see the state was done by looking at
the name field.  This adds an explicit field.

v2:
* updated spec language [for chadv]
* correctly specifying ES 3.1 [for chadv]
* refactor access to rb->Name [for jason]
* handle GetFramebufferParameteriv [for chadv]
---
 docs/specs/MESA_framebuffer_flip_y.spec| 84 ++
 include/GLES2/gl2ext.h |  5 ++
 src/mapi/glapi/registry/gl.xml |  6 ++
 src/mesa/drivers/dri/i915/intel_fbo.c  |  7 +-
 src/mesa/drivers/dri/i965/intel_fbo.c  |  7 +-
 src/mesa/drivers/dri/nouveau/nouveau_fbo.c |  7 +-
 src/mesa/drivers/dri/radeon/radeon_fbo.c   |  7 +-
 src/mesa/drivers/dri/radeon/radeon_span.c  |  9 ++-
 src/mesa/drivers/dri/swrast/swrast.c   |  7 +-
 src/mesa/drivers/osmesa/osmesa.c   |  5 +-
 src/mesa/drivers/x11/xm_buffer.c   |  3 +-
 src/mesa/drivers/x11/xmesaP.h  |  3 +-
 src/mesa/main/accum.c  | 17 +++--
 src/mesa/main/dd.h |  3 +-
 src/mesa/main/extensions_table.h   |  1 +
 src/mesa/main/fbobject.c   | 18 -
 src/mesa/main/framebuffer.c|  1 +
 src/mesa/main/glheader.h   |  3 +
 src/mesa/main/mtypes.h |  3 +
 src/mesa/main/readpix.c| 20 +++---
 src/mesa/state_tracker/st_cb_fbo.c |  7 +-
 src/mesa/swrast/s_blit.c   | 17 +++--
 src/mesa/swrast/s_clear.c  |  3 +-
 src/mesa/swrast/s_copypix.c| 11 +--
 src/mesa/swrast/s_depth.c  |  6 +-
 src/mesa/swrast/s_drawpix.c| 26 ---
 src/mesa/swrast/s_renderbuffer.c   |  6 +-
 src/mesa/swrast/s_renderbuffer.h   |  3 +-
 src/mesa/swrast/s_stencil.c|  3 +-
 29 files changed, 241 insertions(+), 57 deletions(-)
 create mode 100644 docs/specs/MESA_framebuffer_flip_y.spec

diff --git a/docs/specs/MESA_framebuffer_flip_y.spec 
b/docs/specs/MESA_framebuffer_flip_y.spec
new file mode 100644
index 00..dca77a9541
--- /dev/null
+++ b/docs/specs/MESA_framebuffer_flip_y.spec
@@ -0,0 +1,84 @@
+Name
+
+MESA_framebuffer_flip_y
+
+Name Strings
+
+GL_MESA_framebuffer_flip_y
+
+Contact
+
+Fritz Koenig 
+
+Contributors
+
+Fritz Koenig, Google
+Kristian Høgsberg, Google
+Chad Versace, Google
+
+Status
+
+Proposal
+
+Version
+
+Version 1, June 7, 2018
+
+Number
+
+TBD
+
+Dependencies
+
+OpenGL ES 3.1 is required, for FramebufferParameteri.
+
+Overview
+
+Rendered buffers are normally returned right side up, as accessed
+top to bottom.  This extension allows those buffers to be upside down
+when accessed top to bottom.
+
+This extension defines a new framebuffer parameter,
+GL_FRAMEBUFFER_FLIP_Y_MESA, that changes the behavior of the reads and
+writes to the framebuffer attachment points. When 
GL_FRAMEBUFFER_FLIP_Y_MESA
+is GL_TRUE, render commands and pixel transfer operations access the
+backing store of each attachment point with an y-inverted coordinate
+system. This y-inversion is relative to the coordinate system set when
+GL_FRAMEBUFFER_FLIP_Y_MESA is GL_FALSE.
+
+Access through TexSubImage2D and similar calls will notice the effect of
+the flip when they are not attached to framebuffer objects because
+GL_FRAMEBUFFER_FLIP_Y_MESA is associated with the framebuffer object and
+not the attachment points.
+
+IP Status
+
+None
+
+Issues
+
+None
+
+New Procedures and Functions
+
+None
+
+New Types
+
+None
+
+New Tokens
+
+Accepted by the  argument of FramebufferParameteri and
+GetFramebufferParameteriv:
+
+GL_FRAMEBUFFER_FLIP_Y_MESA  0x8BBB
+
+Errors
+GL_INVALID_OPERATION is returned from  GetFramebufferParameteriv if this
+is called on a winsys framebuffer.
+
+Revision History
+
+Version 1, June, 2018
+Initial draft (Fritz Koenig)
diff --git a/include/GLES2/gl2ext.h b/include/GLES2/gl2ext.h
index a7d19a1fc8..0a93bfb865 100644
--- a/include/GLES2/gl2ext.h
+++ b/include/GLES2/gl2ext.h
@@ -2334,6 +2334,11 @@ GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL 
(GLuint queryId, GLuint quer
 #endif
 #endif /* GL_INTEL_performance_query */
 
+#ifndef GL_MESA_framebuffer_flip_y
+#define GL_MESA_framebuffer_flip_y 1
+#define GL_FRAMEBUFFER_FLIP_Y_MESA0x8BBB
+#endif /* GL_MESA_framebuffer_flip_y */
+
 #ifndef GL_MESA_program_binary_formats
 #define GL_MESA_program_binary_formats 1
 #define GL_PROGRAM_BINARY_FORMAT_MESA 0x875F
diff --git a/src/mapi/glapi/registry/gl.xml b/src/mapi/glapi/registry/gl.xml
index 833478aa51..13882eff7b 100644
--- a/src/mapi/glapi/registry/gl.xml
+++ b/src/mapi/glapi/registry/gl.xml
@@ -6568,6 +6568,7 @@ 

Re: [Mesa-dev] [PATCH 1/2] mesa : MESA_framebuffer_flip_y extension

2018-06-27 Thread Chad Versace
On Wed 27 Jun 2018, Chad Versace wrote:
> On Fri 15 Jun 2018, Fritz Koenig wrote:
> > On Tue, Jun 12, 2018 at 12:28 PM Chad Versace  
> > wrote:
> > >
> > > On Thu 07 Jun 2018, Fritz Koenig wrote:
> 
> > > > --- a/src/mesa/main/extensions_table.h
> > > > +++ b/src/mesa/main/extensions_table.h
> > > > @@ -322,6 +322,7 @@ EXT(KHR_texture_compression_astc_hdr, 
> > > > KHR_texture_compression_astc_hdr
> > > >  EXT(KHR_texture_compression_astc_ldr, 
> > > > KHR_texture_compression_astc_ldr   , GLL, GLC,  x , ES2, 2012)
> > > >  EXT(KHR_texture_compression_astc_sliced_3d  , 
> > > > KHR_texture_compression_astc_sliced_3d , GLL, GLC,  x , ES2, 2015)
> > > >
> > > > +EXT(MESA_framebuffer_flip_y , MESA_framebuffer_flip_y  
> > > >   ,   x,   x,  x , ES2, 2018)
> > >
> > > Since the extension requires GLES 3.1, this row should have s/ES2/31/.
> > >
> > 
> > I don't see the option for an ES31 extension, only ES2 in that file.
> 
> It's non-obvious, but placing a literal 31 in that column does the right
> thing. Search the table, and you will find entries in this column with
> literal values 30 and 31 in addition to ES2.
> 
> A little bit of poorly documented tribal knowledge... In the taxonomy of
> OpenGL (and ES) contexts, there currently exist four top-level branches.
> It took multiple years of API specification experiments, some good and
> other mistakes, to create the top-level taxonomy. Surprisingly, old man
> GLX is the only API to get this correct, in extension
> GLX_EXT_create_context_es2_profile. (GLX got it right probably because
> GLX_EXT_create_context_es2_profile was the last extension to be written
> in the group of "context taxonomy" extensions, and so was written after
> everyone learned from the past mistakes).
> 
> The term used by GLX_EXT_create_context_es2_profile for this hiearchy in
> the taxonomy is "profile". Here are the 4:
> 
>   ES1 := { OpenGL ES x.y where x = 1 }
>= { OpenGL ES 1.0
>  , OpenGL ES 1.1,
>  , and minor variants of which no one remembers the name
>  }
> 
>   ES2 := { OpenGL ES x.y where 2 <= x <= 3 }
> 
>   CORE := { OpenGL x.y where x.y >= 3.2
>  and glGetIntegerv(GL_CONTEXT_PROFILE_MASK) contains 
> GL_CONTEXT_PROFILE_CORE_BIT
>   }
> 
>   COMPATIBILITY := { OpenGL x.y where x.y <= 3.0
>or (x.y >= 3.2
>and 
> glGetIntegerv(GL_CONTEXT_PROFILE_MASK) contains 
> GL_CONTEXT_PROFILE_COMPATIBILITY_BIT)
>}

Correction:

OpenGL (not-ES) 3.1 belongs to no class as I've defined them above.
And OpenGL ES 3.0 is not defined correctly. Their weird, existing the
zone of API experimentation.

Here are the corrected definitions:

  CORE := { OpenGL x.y where (x.y >= 3.2 and GL_CONTEXT_PROFILE_CORE_BIT in 
glGetIntegerv(GL_CONTEXT_PROFILE_MASK))
  or (x.y == 3.1 and GL_ARB_compatibility not in 
glGetString(GL_EXTENSIONS))
  or (x.y == 3.0 and 
GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT in glGetIntegerv(GL_CONTEXT_FLAGS))
  }

  COMPATIBILITY := { OpenGL x.y where (x.y >= 3.2 and 
GL_CONTEXT_PROFILE_COMPATIBILITY_BIT in glGetIntegerv(GL_CONTEXT_PROFILE_MASK))
   or (x.y == 3.1 and GL_ARB_compatibility in 
glGetString(GL_EXTENSIONS))
   or (x.y == 3.0 and 
GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT not in glGetIntegerv(GL_CONTEXT_FLAGS))
   or (x.y < 3.0)
   }

There exist differences in opinion on how to classify the variants of
GL 3.0 and GL 3.1. The above is Mesa's classification.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] mesa : MESA_framebuffer_flip_y extension

2018-06-27 Thread Chad Versace
On Fri 15 Jun 2018, Fritz Koenig wrote:
> On Tue, Jun 12, 2018 at 12:28 PM Chad Versace  
> wrote:
> >
> > On Thu 07 Jun 2018, Fritz Koenig wrote:

> > > --- a/src/mesa/main/extensions_table.h
> > > +++ b/src/mesa/main/extensions_table.h
> > > @@ -322,6 +322,7 @@ EXT(KHR_texture_compression_astc_hdr, 
> > > KHR_texture_compression_astc_hdr
> > >  EXT(KHR_texture_compression_astc_ldr, 
> > > KHR_texture_compression_astc_ldr   , GLL, GLC,  x , ES2, 2012)
> > >  EXT(KHR_texture_compression_astc_sliced_3d  , 
> > > KHR_texture_compression_astc_sliced_3d , GLL, GLC,  x , ES2, 2015)
> > >
> > > +EXT(MESA_framebuffer_flip_y , MESA_framebuffer_flip_y
> > > ,   x,   x,  x , ES2, 2018)
> >
> > Since the extension requires GLES 3.1, this row should have s/ES2/31/.
> >
> 
> I don't see the option for an ES31 extension, only ES2 in that file.

It's non-obvious, but placing a literal 31 in that column does the right
thing. Search the table, and you will find entries in this column with
literal values 30 and 31 in addition to ES2.

A little bit of poorly documented tribal knowledge... In the taxonomy of
OpenGL (and ES) contexts, there currently exist four top-level branches.
It took multiple years of API specification experiments, some good and
other mistakes, to create the top-level taxonomy. Surprisingly, old man
GLX is the only API to get this correct, in extension
GLX_EXT_create_context_es2_profile. (GLX got it right probably because
GLX_EXT_create_context_es2_profile was the last extension to be written
in the group of "context taxonomy" extensions, and so was written after
everyone learned from the past mistakes).

The term used by GLX_EXT_create_context_es2_profile for this hiearchy in
the taxonomy is "profile". Here are the 4:

  ES1 := { OpenGL ES x.y where x = 1 }
   = { OpenGL ES 1.0
 , OpenGL ES 1.1,
 , and minor variants of which no one remembers the name
 }

  ES2 := { OpenGL ES x.y where 2 <= x <= 3 }

  CORE := { OpenGL x.y where x.y >= 3.2
 and glGetIntegerv(GL_CONTEXT_PROFILE_MASK) contains 
GL_CONTEXT_PROFILE_CORE_BIT
  }

  COMPATIBILITY := { OpenGL x.y where x.y <= 3.0
   or (x.y >= 3.2
   and 
glGetIntegerv(GL_CONTEXT_PROFILE_MASK) contains 
GL_CONTEXT_PROFILE_COMPATIBILITY_BIT)
   }


That's why the file defines no token for ES31. It's a subclass of ES2.


The file defines ES2 = 0, and x = ~0.

When Mesa examines this
table in reponse glGetString(GL_EXTENSIONS), it scans the column for the
current context's profile. For each row it compares
(context_version >= column_value). That's why inserting 31 in the column
magically works. Instead of the macro ES2, we could equivalently insert
20 into the column, or even 0, since no context versions < 2.0 exist in
the ES2 class. (In fact, ES2 is 0).
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] mesa : MESA_framebuffer_flip_y extension

2018-06-15 Thread Fritz Koenig
On Tue, Jun 12, 2018 at 12:28 PM Chad Versace  wrote:
>
> On Thu 07 Jun 2018, Fritz Koenig wrote:
> > Adds an extension to glFramebufferParameteri
> > that will specify if the framebuffer is vertically
> > flipped. Historically system framebuffers are
> > vertically flipped and user framebuffers are not.
> > Checking to see the state was done by looking at
> > the name field.  This adds an explicit field.
> > ---
> >  docs/specs/MESA_framebuffer_flip_y.spec | 59 +
> >  include/GLES2/gl2ext.h  |  5 +++
> >  src/mapi/glapi/registry/gl.xml  |  6 +++
> >  src/mesa/main/extensions_table.h|  1 +
> >  src/mesa/main/fbobject.c|  8 
> >  src/mesa/main/framebuffer.c |  1 +
> >  src/mesa/main/glheader.h|  3 ++
> >  src/mesa/main/mtypes.h  |  4 ++
> >  8 files changed, 87 insertions(+)
> >  create mode 100644 docs/specs/MESA_framebuffer_flip_y.spec
> >
> > diff --git a/docs/specs/MESA_framebuffer_flip_y.spec 
> > b/docs/specs/MESA_framebuffer_flip_y.spec
> > new file mode 100644
> > index 00..b9867e0683
> > --- /dev/null
> > +++ b/docs/specs/MESA_framebuffer_flip_y.spec
> > @@ -0,0 +1,59 @@
> > +Name
> > +
> > +MESA_framebuffer_flip_y
> > +
> > +Name Strings
> > +
> > +GL_MESA_framebuffer_flip_y
> > +
> > +Contact
> > +
> > +Fritz Koenig 
> > +
> > +Status
> > +
> > +Proposal
> > +
> > +Version
> > +
> > +Version 1, June 7, 2018
> > +
> > +Number
> > +
> > +TBD
> > +
> > +Dependencies
> > +
> > +OpenGLES 3.1 is required.
>
> In specs, s/OpenGLES/OpenGL ES/.
>
> > +
> > +Overview
> > +
> > +This extension adds the ability to specify that the internal 
> > framebuffer
> > +object is vertically flipped.
>
> Questions:
>
>   a. Is it legal to set and/or query GL_FRAMEBUFFER_FLIP_Y_MESA on the
>  default framebuffer (that is, the winsys framebuffer)?

no, this is for user framebuffers only, FramebufferParameteri can not
be called on a winsys framebuffer

>   b. If (a) is legal, then the default framebuffer's initial value of
>  GL_FRAMEBUFFER_FLIP_Y_MESA is ambiguous. Does the spec define it
>  to be GL_TRUE or GL_FALSE? (I assume the answer is GL_TRUE based on
>  the patch's code).
>
> The patch seems to allow toggling the state of winsys framebuffers,
> but I was unsure if that decision was intentional.
>
> > +New Tokens
> > +
> > +Accepted by the  argument of FramebufferParameteri:
> > +
> > +GL_FRAMEBUFFER_FLIP_Y_EXT   0x8BBB
>
> ... and GetFramebufferParameteriv.
>
> > +
> > +Revision History
> > +
> > +Version 1, June, 2018
> > +Initial draft (Fritz Koenig)
> > diff --git a/include/GLES2/gl2ext.h b/include/GLES2/gl2ext.h
> > index a7d19a1fc8..7fb5e9ca5f 100644
> > --- a/include/GLES2/gl2ext.h
> > +++ b/include/GLES2/gl2ext.h
> > @@ -2334,6 +2334,11 @@ GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL 
> > (GLuint queryId, GLuint quer
> >  #endif
> >  #endif /* GL_INTEL_performance_query */
> >
> > +#ifndef GL_MESA_framebuffer_flip_y
> > +#define GL_MESA_framebuffer_flip_y 1
> > +#define GL_FRAMEBUFFER_FLIP_Y_EXT 0x8BBB
> > +#endif /* GL_MESA_framebuffer_flip_y */
> > +
> >  #ifndef GL_MESA_program_binary_formats
> >  #define GL_MESA_program_binary_formats 1
> >  #define GL_PROGRAM_BINARY_FORMAT_MESA 0x875F
> > diff --git a/src/mapi/glapi/registry/gl.xml b/src/mapi/glapi/registry/gl.xml
> > index 833478aa51..3a3d4f3d81 100644
> > --- a/src/mapi/glapi/registry/gl.xml
> > +++ b/src/mapi/glapi/registry/gl.xml
> > @@ -6568,6 +6568,7 @@ typedef unsigned int GLhandleARB;
> >  
> >  
> >  
> > +
> >  
> >
> >   > comment="Reassigned from AMD to QCOM">
> > @@ -44356,6 +44357,11 @@ typedef unsigned int GLhandleARB;
> >  
> >  
> >  
> > +
> > +
> > +
> > +
> > +
> >  
> >  
> >  
> > diff --git a/src/mesa/main/extensions_table.h 
> > b/src/mesa/main/extensions_table.h
> > index 79ef228b69..03a5c7b345 100644
> > --- a/src/mesa/main/extensions_table.h
> > +++ b/src/mesa/main/extensions_table.h
> > @@ -322,6 +322,7 @@ EXT(KHR_texture_compression_astc_hdr, 
> > KHR_texture_compression_astc_hdr
> >  EXT(KHR_texture_compression_astc_ldr, 
> > KHR_texture_compression_astc_ldr   , GLL, GLC,  x , ES2, 2012)
> >  EXT(KHR_texture_compression_astc_sliced_3d  , 
> > KHR_texture_compression_astc_sliced_3d , GLL, GLC,  x , ES2, 2015)
> >
> > +EXT(MESA_framebuffer_flip_y , MESA_framebuffer_flip_y  
> >   ,   x,   x,  x , ES2, 2018)
>
> Since the extension requires GLES 3.1, this row should have s/ES2/31/.
>

I don't see the option for an ES31 extension, only ES2 in that file.

> >  EXT(MESA_pack_invert, MESA_pack_invert 
> >   , GLL, GLC,  x ,  x , 

Re: [Mesa-dev] [PATCH 1/2] mesa : MESA_framebuffer_flip_y extension

2018-06-12 Thread Chad Versace
On Thu 07 Jun 2018, Fritz Koenig wrote:
> Adds an extension to glFramebufferParameteri
> that will specify if the framebuffer is vertically
> flipped. Historically system framebuffers are
> vertically flipped and user framebuffers are not.
> Checking to see the state was done by looking at
> the name field.  This adds an explicit field.
> ---
>  docs/specs/MESA_framebuffer_flip_y.spec | 59 +
>  include/GLES2/gl2ext.h  |  5 +++
>  src/mapi/glapi/registry/gl.xml  |  6 +++
>  src/mesa/main/extensions_table.h|  1 +
>  src/mesa/main/fbobject.c|  8 
>  src/mesa/main/framebuffer.c |  1 +
>  src/mesa/main/glheader.h|  3 ++
>  src/mesa/main/mtypes.h  |  4 ++
>  8 files changed, 87 insertions(+)
>  create mode 100644 docs/specs/MESA_framebuffer_flip_y.spec
> 
> diff --git a/docs/specs/MESA_framebuffer_flip_y.spec 
> b/docs/specs/MESA_framebuffer_flip_y.spec
> new file mode 100644
> index 00..b9867e0683
> --- /dev/null
> +++ b/docs/specs/MESA_framebuffer_flip_y.spec
> @@ -0,0 +1,59 @@
> +Name
> +
> +MESA_framebuffer_flip_y
> +
> +Name Strings
> +
> +GL_MESA_framebuffer_flip_y
> +
> +Contact
> +
> +Fritz Koenig 
> +
> +Status
> +
> +Proposal
> +
> +Version
> +
> +Version 1, June 7, 2018
> +
> +Number
> +
> +TBD
> +
> +Dependencies
> +
> +OpenGLES 3.1 is required.

In specs, s/OpenGLES/OpenGL ES/.

> +
> +Overview
> +
> +This extension adds the ability to specify that the internal framebuffer
> +object is vertically flipped.

Questions:

  a. Is it legal to set and/or query GL_FRAMEBUFFER_FLIP_Y_MESA on the
 default framebuffer (that is, the winsys framebuffer)?
  b. If (a) is legal, then the default framebuffer's initial value of
 GL_FRAMEBUFFER_FLIP_Y_MESA is ambiguous. Does the spec define it
 to be GL_TRUE or GL_FALSE? (I assume the answer is GL_TRUE based on
 the patch's code).

The patch seems to allow toggling the state of winsys framebuffers,
but I was unsure if that decision was intentional.

> +New Tokens
> +
> +Accepted by the  argument of FramebufferParameteri:
> +
> +GL_FRAMEBUFFER_FLIP_Y_EXT   0x8BBB

... and GetFramebufferParameteriv.

> +
> +Revision History
> +
> +Version 1, June, 2018
> +Initial draft (Fritz Koenig)
> diff --git a/include/GLES2/gl2ext.h b/include/GLES2/gl2ext.h
> index a7d19a1fc8..7fb5e9ca5f 100644
> --- a/include/GLES2/gl2ext.h
> +++ b/include/GLES2/gl2ext.h
> @@ -2334,6 +2334,11 @@ GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL 
> (GLuint queryId, GLuint quer
>  #endif
>  #endif /* GL_INTEL_performance_query */
>  
> +#ifndef GL_MESA_framebuffer_flip_y
> +#define GL_MESA_framebuffer_flip_y 1
> +#define GL_FRAMEBUFFER_FLIP_Y_EXT 0x8BBB
> +#endif /* GL_MESA_framebuffer_flip_y */
> +
>  #ifndef GL_MESA_program_binary_formats
>  #define GL_MESA_program_binary_formats 1
>  #define GL_PROGRAM_BINARY_FORMAT_MESA 0x875F
> diff --git a/src/mapi/glapi/registry/gl.xml b/src/mapi/glapi/registry/gl.xml
> index 833478aa51..3a3d4f3d81 100644
> --- a/src/mapi/glapi/registry/gl.xml
> +++ b/src/mapi/glapi/registry/gl.xml
> @@ -6568,6 +6568,7 @@ typedef unsigned int GLhandleARB;
>  
>  
>  
> +
>  
>  
>   comment="Reassigned from AMD to QCOM">
> @@ -44356,6 +44357,11 @@ typedef unsigned int GLhandleARB;
>  
>  
>  
> +
> +
> +
> +
> +
>  
>  
>  
> diff --git a/src/mesa/main/extensions_table.h 
> b/src/mesa/main/extensions_table.h
> index 79ef228b69..03a5c7b345 100644
> --- a/src/mesa/main/extensions_table.h
> +++ b/src/mesa/main/extensions_table.h
> @@ -322,6 +322,7 @@ EXT(KHR_texture_compression_astc_hdr, 
> KHR_texture_compression_astc_hdr
>  EXT(KHR_texture_compression_astc_ldr, 
> KHR_texture_compression_astc_ldr   , GLL, GLC,  x , ES2, 2012)
>  EXT(KHR_texture_compression_astc_sliced_3d  , 
> KHR_texture_compression_astc_sliced_3d , GLL, GLC,  x , ES2, 2015)
>  
> +EXT(MESA_framebuffer_flip_y , MESA_framebuffer_flip_y
> ,   x,   x,  x , ES2, 2018)

Since the extension requires GLES 3.1, this row should have s/ES2/31/.

>  EXT(MESA_pack_invert, MESA_pack_invert   
> , GLL, GLC,  x ,  x , 2002)
>  EXT(MESA_shader_integer_functions   , MESA_shader_integer_functions  
> , GLL, GLC,  x ,  30, 2016)
>  EXT(MESA_texture_signed_rgba, EXT_texture_snorm  
> , GLL, GLC,  x ,  x , 2009)
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index a63e8b8de5..efa000ede7 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -1448,6 +1448,14 @@ framebuffer_parameteri(struct gl_context *ctx, struct 
> gl_framebuffer *fb,
>

Re: [Mesa-dev] [PATCH 1/2] mesa : MESA_framebuffer_flip_y extension

2018-06-07 Thread Kristian Høgsberg
On Thu, Jun 7, 2018 at 6:02 PM Jason Ekstrand  wrote:
>
> On June 7, 2018 16:47:17 Ilia Mirkin  wrote:
>
> > On Thu, Jun 7, 2018 at 7:31 PM, Fritz Koenig  wrote:
> >> On Thu, Jun 7, 2018 at 4:10 PM Ilia Mirkin  wrote:
> >>>
> >>> It's slightly different than what you've specified, but can't you
> >>> achieve this with GL_ARB_clip_control / GL_EXT_clip_control ?
> >>
> >> It can be, but there is a lot of extra work that needs to be done to
> >> get ReadPixels to work correctly.  It would be preferable to have the
> >> driver handle all of that work.
> >
> > A bit more prior art research:
> >
> > GL_MESA_pack_invert - specifies this precisely for glReadPixels.
> >
> > Your version of the spec needs more information. What does "flipped"
> > mean? Does it affect gl_FragCoord / gl_SamplePosition /
> > interpolateAtOffset? Does it affect the winding?

The effect of this extension is mostly not visible from GL - the
corner case where it is is if you take a texture from a flipped fbo
and bind to a non-flipped FBO. I think it makes more sense to specify
as not affecting anything, except for the pixels in the buffer ending
up upside down. That's more robust than listing all the state that it
does modify under the hood to achieve that and is more future proof
wrt extensions that add state that depends on coordinate system
polarity.

The use case in question is WebGL rendering in Chrome, which renders
to an FBO with the normal GL orientation. The end result is a buffer
that is upside down as far as KMS is concerned. We want to use the
buffer on a KMS plane, but not all display controllers support
y-flipping. We could (and tried) use all the extensions listed above
to flip the rendering, but got stuck on glReadPixels. If we have to
use a mesa extension to achieve this, I'd much rather depend on this
simple extension that just activates functionality already present
(and tested on each CI run). We also don't have to rewrite WebGL
visible state (viewports, scissor etc), which make this all much
simpler.

> > Might help to say that this is designed to undo the winsys flipping
> > relative to fbo rendering.
>
> More designed to emulate winsys flipping on a texture that isn't flipped.
> Basically, everything is "like normal" except that the result of your
> rendering is flipped vertically in the texture.  It's a bit wired but
> that's the idea.

It's kinda interesting how we ended up in this situation... mesa has
always flipped winsys FBOs and not user FBOs, but there's no overhead
in just flipping all FBOs, and back before we started importing X
pixmaps and EGLImages and binding to FBOs, there was no way to know
which way the user FBO was oriented in memory. So I don't think it was
ever necessary to distinguish between user and winsys FBOs, at least
not for coordinate orientation. Then we started rendering to external
buffers, and the non-flippedness of user FBOs leaked out and became de
facto convention, which we probably can't change now.

So today we have this situation where applications that render to a
winsys FBO work as they've always done, compositors or other apps that
knowingly render to a user FBO and then present the result externally
(eg KMS) just render upside down. And then WebGL, which has the
traditional GL orientation but render through an FBO to an EGLImage.

Kristian
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] mesa : MESA_framebuffer_flip_y extension

2018-06-07 Thread Jason Ekstrand

On June 7, 2018 16:47:17 Ilia Mirkin  wrote:


On Thu, Jun 7, 2018 at 7:31 PM, Fritz Koenig  wrote:

On Thu, Jun 7, 2018 at 4:10 PM Ilia Mirkin  wrote:


It's slightly different than what you've specified, but can't you
achieve this with GL_ARB_clip_control / GL_EXT_clip_control ?


It can be, but there is a lot of extra work that needs to be done to
get ReadPixels to work correctly.  It would be preferable to have the
driver handle all of that work.


A bit more prior art research:

GL_MESA_pack_invert - specifies this precisely for glReadPixels.

Your version of the spec needs more information. What does "flipped"
mean? Does it affect gl_FragCoord / gl_SamplePosition /
interpolateAtOffset? Does it affect the winding?

Might help to say that this is designed to undo the winsys flipping
relative to fbo rendering.


More designed to emulate winsys flipping on a texture that isn't flipped.  
Basically, everything is "like normal" except that the result of your 
rendering is flipped vertically in the texture.  It's a bit wired but 
that's the idea.


--Jason


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] mesa : MESA_framebuffer_flip_y extension

2018-06-07 Thread Kristian Høgsberg
On Thu, Jun 7, 2018 at 4:02 PM Fritz Koenig  wrote:
>
> Adds an extension to glFramebufferParameteri
> that will specify if the framebuffer is vertically
> flipped. Historically system framebuffers are
> vertically flipped and user framebuffers are not.
> Checking to see the state was done by looking at
> the name field.  This adds an explicit field.
> ---
>  docs/specs/MESA_framebuffer_flip_y.spec | 59 +
>  include/GLES2/gl2ext.h  |  5 +++
>  src/mapi/glapi/registry/gl.xml  |  6 +++
>  src/mesa/main/extensions_table.h|  1 +
>  src/mesa/main/fbobject.c|  8 
>  src/mesa/main/framebuffer.c |  1 +
>  src/mesa/main/glheader.h|  3 ++
>  src/mesa/main/mtypes.h  |  4 ++
>  8 files changed, 87 insertions(+)
>  create mode 100644 docs/specs/MESA_framebuffer_flip_y.spec
>
> diff --git a/docs/specs/MESA_framebuffer_flip_y.spec 
> b/docs/specs/MESA_framebuffer_flip_y.spec
> new file mode 100644
> index 00..b9867e0683
> --- /dev/null
> +++ b/docs/specs/MESA_framebuffer_flip_y.spec
> @@ -0,0 +1,59 @@
> +Name
> +
> +MESA_framebuffer_flip_y
> +
> +Name Strings
> +
> +GL_MESA_framebuffer_flip_y
> +
> +Contact
> +
> +Fritz Koenig 
> +
> +Status
> +
> +Proposal
> +
> +Version
> +
> +Version 1, June 7, 2018
> +
> +Number
> +
> +TBD
> +
> +Dependencies
> +
> +OpenGLES 3.1 is required.
> +
> +Overview
> +
> +This extension adds the ability to specify that the internal framebuffer
> +object is vertically flipped.
> +
> +IP Status
> +
> +None
> +
> +Issues
> +
> +None
> +
> +New Procedures and Functions
> +
> +None
> +
> +New Types
> +
> +None
> +
> +New Tokens
> +
> +Accepted by the  argument of FramebufferParameteri:
> +
> +GL_FRAMEBUFFER_FLIP_Y_EXT   0x8BBB

The name of the token should use the same prefix/suffix as the
extension, that is: GL_FRAMEBUFFER_FLIP_Y_MESA

> +
> +Revision History
> +
> +Version 1, June, 2018
> +Initial draft (Fritz Koenig)
> diff --git a/include/GLES2/gl2ext.h b/include/GLES2/gl2ext.h
> index a7d19a1fc8..7fb5e9ca5f 100644
> --- a/include/GLES2/gl2ext.h
> +++ b/include/GLES2/gl2ext.h
> @@ -2334,6 +2334,11 @@ GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL 
> (GLuint queryId, GLuint quer
>  #endif
>  #endif /* GL_INTEL_performance_query */
>
> +#ifndef GL_MESA_framebuffer_flip_y
> +#define GL_MESA_framebuffer_flip_y 1
> +#define GL_FRAMEBUFFER_FLIP_Y_EXT 0x8BBB
> +#endif /* GL_MESA_framebuffer_flip_y */
> +
>  #ifndef GL_MESA_program_binary_formats
>  #define GL_MESA_program_binary_formats 1
>  #define GL_PROGRAM_BINARY_FORMAT_MESA 0x875F
> diff --git a/src/mapi/glapi/registry/gl.xml b/src/mapi/glapi/registry/gl.xml
> index 833478aa51..3a3d4f3d81 100644
> --- a/src/mapi/glapi/registry/gl.xml
> +++ b/src/mapi/glapi/registry/gl.xml
> @@ -6568,6 +6568,7 @@ typedef unsigned int GLhandleARB;
>  
>  
>  
> +
>  
>
>   comment="Reassigned from AMD to QCOM">
> @@ -44356,6 +44357,11 @@ typedef unsigned int GLhandleARB;
>  
>  
>  
> +
> +
> +
> +
> +
>  
>  
>  
> diff --git a/src/mesa/main/extensions_table.h 
> b/src/mesa/main/extensions_table.h
> index 79ef228b69..03a5c7b345 100644
> --- a/src/mesa/main/extensions_table.h
> +++ b/src/mesa/main/extensions_table.h
> @@ -322,6 +322,7 @@ EXT(KHR_texture_compression_astc_hdr, 
> KHR_texture_compression_astc_hdr
>  EXT(KHR_texture_compression_astc_ldr, 
> KHR_texture_compression_astc_ldr   , GLL, GLC,  x , ES2, 2012)
>  EXT(KHR_texture_compression_astc_sliced_3d  , 
> KHR_texture_compression_astc_sliced_3d , GLL, GLC,  x , ES2, 2015)
>
> +EXT(MESA_framebuffer_flip_y , MESA_framebuffer_flip_y
> ,   x,   x,  x , ES2, 2018)
>  EXT(MESA_pack_invert, MESA_pack_invert   
> , GLL, GLC,  x ,  x , 2002)
>  EXT(MESA_shader_integer_functions   , MESA_shader_integer_functions  
> , GLL, GLC,  x ,  30, 2016)
>  EXT(MESA_texture_signed_rgba, EXT_texture_snorm  
> , GLL, GLC,  x ,  x , 2009)
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index a63e8b8de5..efa000ede7 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -1448,6 +1448,14 @@ framebuffer_parameteri(struct gl_context *ctx, struct 
> gl_framebuffer *fb,
> case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS:
>fb->DefaultGeometry.FixedSampleLocations = param;
>break;
> +   case GL_FRAMEBUFFER_FLIP_Y_EXT:
> +  if (!ctx->Extensions.MESA_framebuffer_flip_y) {
> + _mesa_error(ctx, GL_INVALID_OPERATION,
> +  "%s(MESA_framebuffer_flip_y not implemented)", func);
> + break;
> + 

Re: [Mesa-dev] [PATCH 1/2] mesa : MESA_framebuffer_flip_y extension

2018-06-07 Thread Ilia Mirkin
On Thu, Jun 7, 2018 at 7:31 PM, Fritz Koenig  wrote:
> On Thu, Jun 7, 2018 at 4:10 PM Ilia Mirkin  wrote:
>>
>> It's slightly different than what you've specified, but can't you
>> achieve this with GL_ARB_clip_control / GL_EXT_clip_control ?
>>
>
> It can be, but there is a lot of extra work that needs to be done to
> get ReadPixels to work correctly.  It would be preferable to have the
> driver handle all of that work.

A bit more prior art research:

GL_MESA_pack_invert - specifies this precisely for glReadPixels.

Your version of the spec needs more information. What does "flipped"
mean? Does it affect gl_FragCoord / gl_SamplePosition /
interpolateAtOffset? Does it affect the winding?

Might help to say that this is designed to undo the winsys flipping
relative to fbo rendering.

I'd also encourage you to write it such that this is also available on
desktop - no real reason to restrict this sort of thing to GLES.

Cheers,

  -ilia
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] mesa : MESA_framebuffer_flip_y extension

2018-06-07 Thread Fritz Koenig
On Thu, Jun 7, 2018 at 4:10 PM Ilia Mirkin  wrote:
>
> It's slightly different than what you've specified, but can't you
> achieve this with GL_ARB_clip_control / GL_EXT_clip_control ?
>

It can be, but there is a lot of extra work that needs to be done to
get ReadPixels to work correctly.  It would be preferable to have the
driver handle all of that work.

> On Thu, Jun 7, 2018 at 7:01 PM, Fritz Koenig  wrote:
> > Adds an extension to glFramebufferParameteri
> > that will specify if the framebuffer is vertically
> > flipped. Historically system framebuffers are
> > vertically flipped and user framebuffers are not.
> > Checking to see the state was done by looking at
> > the name field.  This adds an explicit field.
> > ---
> >  docs/specs/MESA_framebuffer_flip_y.spec | 59 +
> >  include/GLES2/gl2ext.h  |  5 +++
> >  src/mapi/glapi/registry/gl.xml  |  6 +++
> >  src/mesa/main/extensions_table.h|  1 +
> >  src/mesa/main/fbobject.c|  8 
> >  src/mesa/main/framebuffer.c |  1 +
> >  src/mesa/main/glheader.h|  3 ++
> >  src/mesa/main/mtypes.h  |  4 ++
> >  8 files changed, 87 insertions(+)
> >  create mode 100644 docs/specs/MESA_framebuffer_flip_y.spec
> >
> > diff --git a/docs/specs/MESA_framebuffer_flip_y.spec 
> > b/docs/specs/MESA_framebuffer_flip_y.spec
> > new file mode 100644
> > index 00..b9867e0683
> > --- /dev/null
> > +++ b/docs/specs/MESA_framebuffer_flip_y.spec
> > @@ -0,0 +1,59 @@
> > +Name
> > +
> > +MESA_framebuffer_flip_y
> > +
> > +Name Strings
> > +
> > +GL_MESA_framebuffer_flip_y
> > +
> > +Contact
> > +
> > +Fritz Koenig 
> > +
> > +Status
> > +
> > +Proposal
> > +
> > +Version
> > +
> > +Version 1, June 7, 2018
> > +
> > +Number
> > +
> > +TBD
> > +
> > +Dependencies
> > +
> > +OpenGLES 3.1 is required.
> > +
> > +Overview
> > +
> > +This extension adds the ability to specify that the internal 
> > framebuffer
> > +object is vertically flipped.
> > +
> > +IP Status
> > +
> > +None
> > +
> > +Issues
> > +
> > +None
> > +
> > +New Procedures and Functions
> > +
> > +None
> > +
> > +New Types
> > +
> > +None
> > +
> > +New Tokens
> > +
> > +Accepted by the  argument of FramebufferParameteri:
> > +
> > +GL_FRAMEBUFFER_FLIP_Y_EXT   0x8BBB
> > +
> > +Revision History
> > +
> > +Version 1, June, 2018
> > +Initial draft (Fritz Koenig)
> > diff --git a/include/GLES2/gl2ext.h b/include/GLES2/gl2ext.h
> > index a7d19a1fc8..7fb5e9ca5f 100644
> > --- a/include/GLES2/gl2ext.h
> > +++ b/include/GLES2/gl2ext.h
> > @@ -2334,6 +2334,11 @@ GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL 
> > (GLuint queryId, GLuint quer
> >  #endif
> >  #endif /* GL_INTEL_performance_query */
> >
> > +#ifndef GL_MESA_framebuffer_flip_y
> > +#define GL_MESA_framebuffer_flip_y 1
> > +#define GL_FRAMEBUFFER_FLIP_Y_EXT 0x8BBB
> > +#endif /* GL_MESA_framebuffer_flip_y */
> > +
> >  #ifndef GL_MESA_program_binary_formats
> >  #define GL_MESA_program_binary_formats 1
> >  #define GL_PROGRAM_BINARY_FORMAT_MESA 0x875F
> > diff --git a/src/mapi/glapi/registry/gl.xml b/src/mapi/glapi/registry/gl.xml
> > index 833478aa51..3a3d4f3d81 100644
> > --- a/src/mapi/glapi/registry/gl.xml
> > +++ b/src/mapi/glapi/registry/gl.xml
> > @@ -6568,6 +6568,7 @@ typedef unsigned int GLhandleARB;
> >  
> >  
> >  
> > +
> >  
> >
> >   > comment="Reassigned from AMD to QCOM">
> > @@ -44356,6 +44357,11 @@ typedef unsigned int GLhandleARB;
> >  
> >  
> >  
> > +
> > +
> > +
> > +
> > +
> >  
> >  
> >  
> > diff --git a/src/mesa/main/extensions_table.h 
> > b/src/mesa/main/extensions_table.h
> > index 79ef228b69..03a5c7b345 100644
> > --- a/src/mesa/main/extensions_table.h
> > +++ b/src/mesa/main/extensions_table.h
> > @@ -322,6 +322,7 @@ EXT(KHR_texture_compression_astc_hdr, 
> > KHR_texture_compression_astc_hdr
> >  EXT(KHR_texture_compression_astc_ldr, 
> > KHR_texture_compression_astc_ldr   , GLL, GLC,  x , ES2, 2012)
> >  EXT(KHR_texture_compression_astc_sliced_3d  , 
> > KHR_texture_compression_astc_sliced_3d , GLL, GLC,  x , ES2, 2015)
> >
> > +EXT(MESA_framebuffer_flip_y , MESA_framebuffer_flip_y  
> >   ,   x,   x,  x , ES2, 2018)
> >  EXT(MESA_pack_invert, MESA_pack_invert 
> >   , GLL, GLC,  x ,  x , 2002)
> >  EXT(MESA_shader_integer_functions   , 
> > MESA_shader_integer_functions  , GLL, GLC,  x ,  30, 2016)
> >  EXT(MESA_texture_signed_rgba, EXT_texture_snorm
> >   , GLL, GLC,  x ,  x , 2009)
> > diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> > index a63e8b8de5..efa000ede7 

Re: [Mesa-dev] [PATCH 1/2] mesa : MESA_framebuffer_flip_y extension

2018-06-07 Thread Ilia Mirkin
It's slightly different than what you've specified, but can't you
achieve this with GL_ARB_clip_control / GL_EXT_clip_control ?

On Thu, Jun 7, 2018 at 7:01 PM, Fritz Koenig  wrote:
> Adds an extension to glFramebufferParameteri
> that will specify if the framebuffer is vertically
> flipped. Historically system framebuffers are
> vertically flipped and user framebuffers are not.
> Checking to see the state was done by looking at
> the name field.  This adds an explicit field.
> ---
>  docs/specs/MESA_framebuffer_flip_y.spec | 59 +
>  include/GLES2/gl2ext.h  |  5 +++
>  src/mapi/glapi/registry/gl.xml  |  6 +++
>  src/mesa/main/extensions_table.h|  1 +
>  src/mesa/main/fbobject.c|  8 
>  src/mesa/main/framebuffer.c |  1 +
>  src/mesa/main/glheader.h|  3 ++
>  src/mesa/main/mtypes.h  |  4 ++
>  8 files changed, 87 insertions(+)
>  create mode 100644 docs/specs/MESA_framebuffer_flip_y.spec
>
> diff --git a/docs/specs/MESA_framebuffer_flip_y.spec 
> b/docs/specs/MESA_framebuffer_flip_y.spec
> new file mode 100644
> index 00..b9867e0683
> --- /dev/null
> +++ b/docs/specs/MESA_framebuffer_flip_y.spec
> @@ -0,0 +1,59 @@
> +Name
> +
> +MESA_framebuffer_flip_y
> +
> +Name Strings
> +
> +GL_MESA_framebuffer_flip_y
> +
> +Contact
> +
> +Fritz Koenig 
> +
> +Status
> +
> +Proposal
> +
> +Version
> +
> +Version 1, June 7, 2018
> +
> +Number
> +
> +TBD
> +
> +Dependencies
> +
> +OpenGLES 3.1 is required.
> +
> +Overview
> +
> +This extension adds the ability to specify that the internal framebuffer
> +object is vertically flipped.
> +
> +IP Status
> +
> +None
> +
> +Issues
> +
> +None
> +
> +New Procedures and Functions
> +
> +None
> +
> +New Types
> +
> +None
> +
> +New Tokens
> +
> +Accepted by the  argument of FramebufferParameteri:
> +
> +GL_FRAMEBUFFER_FLIP_Y_EXT   0x8BBB
> +
> +Revision History
> +
> +Version 1, June, 2018
> +Initial draft (Fritz Koenig)
> diff --git a/include/GLES2/gl2ext.h b/include/GLES2/gl2ext.h
> index a7d19a1fc8..7fb5e9ca5f 100644
> --- a/include/GLES2/gl2ext.h
> +++ b/include/GLES2/gl2ext.h
> @@ -2334,6 +2334,11 @@ GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL 
> (GLuint queryId, GLuint quer
>  #endif
>  #endif /* GL_INTEL_performance_query */
>
> +#ifndef GL_MESA_framebuffer_flip_y
> +#define GL_MESA_framebuffer_flip_y 1
> +#define GL_FRAMEBUFFER_FLIP_Y_EXT 0x8BBB
> +#endif /* GL_MESA_framebuffer_flip_y */
> +
>  #ifndef GL_MESA_program_binary_formats
>  #define GL_MESA_program_binary_formats 1
>  #define GL_PROGRAM_BINARY_FORMAT_MESA 0x875F
> diff --git a/src/mapi/glapi/registry/gl.xml b/src/mapi/glapi/registry/gl.xml
> index 833478aa51..3a3d4f3d81 100644
> --- a/src/mapi/glapi/registry/gl.xml
> +++ b/src/mapi/glapi/registry/gl.xml
> @@ -6568,6 +6568,7 @@ typedef unsigned int GLhandleARB;
>  
>  
>  
> +
>  
>
>   comment="Reassigned from AMD to QCOM">
> @@ -44356,6 +44357,11 @@ typedef unsigned int GLhandleARB;
>  
>  
>  
> +
> +
> +
> +
> +
>  
>  
>  
> diff --git a/src/mesa/main/extensions_table.h 
> b/src/mesa/main/extensions_table.h
> index 79ef228b69..03a5c7b345 100644
> --- a/src/mesa/main/extensions_table.h
> +++ b/src/mesa/main/extensions_table.h
> @@ -322,6 +322,7 @@ EXT(KHR_texture_compression_astc_hdr, 
> KHR_texture_compression_astc_hdr
>  EXT(KHR_texture_compression_astc_ldr, 
> KHR_texture_compression_astc_ldr   , GLL, GLC,  x , ES2, 2012)
>  EXT(KHR_texture_compression_astc_sliced_3d  , 
> KHR_texture_compression_astc_sliced_3d , GLL, GLC,  x , ES2, 2015)
>
> +EXT(MESA_framebuffer_flip_y , MESA_framebuffer_flip_y
> ,   x,   x,  x , ES2, 2018)
>  EXT(MESA_pack_invert, MESA_pack_invert   
> , GLL, GLC,  x ,  x , 2002)
>  EXT(MESA_shader_integer_functions   , MESA_shader_integer_functions  
> , GLL, GLC,  x ,  30, 2016)
>  EXT(MESA_texture_signed_rgba, EXT_texture_snorm  
> , GLL, GLC,  x ,  x , 2009)
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index a63e8b8de5..efa000ede7 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -1448,6 +1448,14 @@ framebuffer_parameteri(struct gl_context *ctx, struct 
> gl_framebuffer *fb,
> case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS:
>fb->DefaultGeometry.FixedSampleLocations = param;
>break;
> +   case GL_FRAMEBUFFER_FLIP_Y_EXT:
> +  if (!ctx->Extensions.MESA_framebuffer_flip_y) {
> + _mesa_error(ctx, GL_INVALID_OPERATION,
> +  "%s(MESA_framebuffer_flip_y not implemented)", func);
> +

[Mesa-dev] [PATCH 1/2] mesa : MESA_framebuffer_flip_y extension

2018-06-07 Thread Fritz Koenig
Adds an extension to glFramebufferParameteri
that will specify if the framebuffer is vertically
flipped. Historically system framebuffers are
vertically flipped and user framebuffers are not.
Checking to see the state was done by looking at
the name field.  This adds an explicit field.
---
 docs/specs/MESA_framebuffer_flip_y.spec | 59 +
 include/GLES2/gl2ext.h  |  5 +++
 src/mapi/glapi/registry/gl.xml  |  6 +++
 src/mesa/main/extensions_table.h|  1 +
 src/mesa/main/fbobject.c|  8 
 src/mesa/main/framebuffer.c |  1 +
 src/mesa/main/glheader.h|  3 ++
 src/mesa/main/mtypes.h  |  4 ++
 8 files changed, 87 insertions(+)
 create mode 100644 docs/specs/MESA_framebuffer_flip_y.spec

diff --git a/docs/specs/MESA_framebuffer_flip_y.spec 
b/docs/specs/MESA_framebuffer_flip_y.spec
new file mode 100644
index 00..b9867e0683
--- /dev/null
+++ b/docs/specs/MESA_framebuffer_flip_y.spec
@@ -0,0 +1,59 @@
+Name
+
+MESA_framebuffer_flip_y
+
+Name Strings
+
+GL_MESA_framebuffer_flip_y
+
+Contact
+
+Fritz Koenig 
+
+Status
+
+Proposal
+
+Version
+
+Version 1, June 7, 2018
+
+Number
+
+TBD
+
+Dependencies
+
+OpenGLES 3.1 is required.
+
+Overview
+
+This extension adds the ability to specify that the internal framebuffer
+object is vertically flipped.
+
+IP Status
+
+None
+
+Issues
+
+None
+
+New Procedures and Functions
+
+None
+
+New Types
+
+None
+
+New Tokens
+
+Accepted by the  argument of FramebufferParameteri:
+
+GL_FRAMEBUFFER_FLIP_Y_EXT   0x8BBB
+
+Revision History
+
+Version 1, June, 2018
+Initial draft (Fritz Koenig)
diff --git a/include/GLES2/gl2ext.h b/include/GLES2/gl2ext.h
index a7d19a1fc8..7fb5e9ca5f 100644
--- a/include/GLES2/gl2ext.h
+++ b/include/GLES2/gl2ext.h
@@ -2334,6 +2334,11 @@ GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL 
(GLuint queryId, GLuint quer
 #endif
 #endif /* GL_INTEL_performance_query */
 
+#ifndef GL_MESA_framebuffer_flip_y
+#define GL_MESA_framebuffer_flip_y 1
+#define GL_FRAMEBUFFER_FLIP_Y_EXT 0x8BBB
+#endif /* GL_MESA_framebuffer_flip_y */
+
 #ifndef GL_MESA_program_binary_formats
 #define GL_MESA_program_binary_formats 1
 #define GL_PROGRAM_BINARY_FORMAT_MESA 0x875F
diff --git a/src/mapi/glapi/registry/gl.xml b/src/mapi/glapi/registry/gl.xml
index 833478aa51..3a3d4f3d81 100644
--- a/src/mapi/glapi/registry/gl.xml
+++ b/src/mapi/glapi/registry/gl.xml
@@ -6568,6 +6568,7 @@ typedef unsigned int GLhandleARB;
 
 
 
+
 
 
 
@@ -44356,6 +44357,11 @@ typedef unsigned int GLhandleARB;
 
 
 
+
+
+
+
+
 
 
 
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 79ef228b69..03a5c7b345 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -322,6 +322,7 @@ EXT(KHR_texture_compression_astc_hdr, 
KHR_texture_compression_astc_hdr
 EXT(KHR_texture_compression_astc_ldr, KHR_texture_compression_astc_ldr 
  , GLL, GLC,  x , ES2, 2012)
 EXT(KHR_texture_compression_astc_sliced_3d  , 
KHR_texture_compression_astc_sliced_3d , GLL, GLC,  x , ES2, 2015)
 
+EXT(MESA_framebuffer_flip_y , MESA_framebuffer_flip_y  
  ,   x,   x,  x , ES2, 2018)
 EXT(MESA_pack_invert, MESA_pack_invert 
  , GLL, GLC,  x ,  x , 2002)
 EXT(MESA_shader_integer_functions   , MESA_shader_integer_functions
  , GLL, GLC,  x ,  30, 2016)
 EXT(MESA_texture_signed_rgba, EXT_texture_snorm
  , GLL, GLC,  x ,  x , 2009)
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index a63e8b8de5..efa000ede7 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1448,6 +1448,14 @@ framebuffer_parameteri(struct gl_context *ctx, struct 
gl_framebuffer *fb,
case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS:
   fb->DefaultGeometry.FixedSampleLocations = param;
   break;
+   case GL_FRAMEBUFFER_FLIP_Y_EXT:
+  if (!ctx->Extensions.MESA_framebuffer_flip_y) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+  "%s(MESA_framebuffer_flip_y not implemented)", func);
+ break;
+  }
+  fb->InvertedY = param;
+  break;
default:
   _mesa_error(ctx, GL_INVALID_ENUM,
   "%s(pname=0x%x)", func, pname);
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 8e751b453b..d0c51da1ef 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -159,6 +159,7 @@ _mesa_initialize_window_framebuffer(struct gl_framebuffer 
*fb,
fb->_AllColorBuffersFixedPoint = !visual->floatMode;
fb->_HasSNormOrFloatColorBuffer =