On Thu, Jun 7, 2018 at 4:02 PM Fritz Koenig <frkoe...@google.com> 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 0000000000..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 <frkoe...@google.com> > + > +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 <pname> 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; > <enum value="0x8BB5" name="GL_VERTEX_PROGRAM_CALLBACK_MESA"/> > <enum value="0x8BB6" name="GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA"/> > <enum value="0x8BB7" name="GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA"/> > + <enum value="0x8BBB" name="GL_FRAMEBUFFER_FLIP_Y_EXT"/> > </enums> > > <enums namespace="GL" start="0x8BC0" end="0x8BFF" vendor="QCOM" > comment="Reassigned from AMD to QCOM"> > @@ -44356,6 +44357,11 @@ typedef unsigned int GLhandleARB; > <enum name="GL_TEXTURE_2D_STACK_BINDING_MESAX"/> > </require> > </extension> > + <extension name="GL_MESA_framebuffer_flip_y" supported="gles2"> > + <require> > + <enum name="GL_FRAMEBUFFER_FLIP_Y_EXT"/> > + </require> > + </extension> > <extension name="GL_MESA_pack_invert" supported="gl"> > <require> > <enum name="GL_PACK_INVERT_MESA"/> > 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 = visual->floatMode; > fb->_HasAttachments = true; > + fb->InvertedY = true; > > compute_depth_max(fb); > } > diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h > index 16648820b1..e388fe5852 100644 > --- a/src/mesa/main/glheader.h > +++ b/src/mesa/main/glheader.h > @@ -160,6 +160,9 @@ typedef void *GLeglImageOES; > #define GL_HALF_FLOAT_OES 0x8D61 > #endif > > +#ifndef GL_MESA_framebuffer_flip_y > +#define GL_FRAMEBUFFER_FLIP_Y_EXT 0x8BBB > +#endif > > /** > * Internal token to represent a GLSL shader program (a collection of > diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h > index 482c42a4b2..5da449a7d9 100644 > --- a/src/mesa/main/mtypes.h > +++ b/src/mesa/main/mtypes.h > @@ -3498,6 +3498,9 @@ struct gl_framebuffer > > /** Delete this framebuffer */ > void (*Delete)(struct gl_framebuffer *fb); > + > + /** Is the framebuffer vertically flipped */ > + GLboolean InvertedY; > }; > > > @@ -4230,6 +4233,7 @@ struct gl_extensions > GLboolean KHR_texture_compression_astc_hdr; > GLboolean KHR_texture_compression_astc_ldr; > GLboolean KHR_texture_compression_astc_sliced_3d; > + GLboolean MESA_framebuffer_flip_y; > GLboolean MESA_tile_raster_order; > GLboolean MESA_pack_invert; > GLboolean EXT_shader_framebuffer_fetch; > -- > 2.18.0.rc1.242.g61856ae69a-goog > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev