Re: [Mesa-dev] Extension help
On Fri, Aug 2, 2019 at 3:03 PM Ian Romanick wrote: > > On 8/2/19 1:13 PM, Fritz Koenig wrote: > > Hi, > > > > I would like to be able to use the MESA_framebuffer_flip_y extension > > in GLES 3.0. The blocker is that FramebufferParameteri is not part of > > GLES 3.0. I have explored a couple of ways of achieving this. > > > > 1. FramebufferParameteri was first provided by the GL extension > > ARB_framebuffer_no_attachments. However, > > ARB_framebuffer_no_attachments was never a GLES extension. An option > > would be to modify the ARB_framebuffer_no_attachments spec to make it > > an extension for GLES. > > > > 2. Change the MESA_framebuffer_flip_y spec to allow the extension to > > implement FramebufferParameteri. > > GLES has more strict rules about what functions can be advertised than > desktop OpenGL. Since glFramebufferParameteri is part of the reserved > namespace, I'm not 100% sure that it's legal to expose it in pre-3.1. I > would suggest making a PR to the registry first. > I have opened a pr with Khronos. https://github.com/KhronosGroup/OpenGL-Registry/pull/289 > My gut tells me you're going to have to add a FramebufferParameteriMESA > function that is an alias of FramebufferParameteri. > Thanks for the feedback. I was hoping to be able to drop in FramebufferParameteri, but I believe you are correct that I need FramebufferParameteriMESA. > Has this extension already shipped in a Mesa release? > Yes, it has was present in Mesa 19 > > I choose the 2nd option and put together a pr for it[1]. > > > > I didn't get the implementation quite right, and I'm looking for some > > help. My change is failing the DispatchSanity_test.GLES3 test: > > > > [ RUN ] DispatchSanity_test.GLES3 > > ../src/mesa/main/tests/dispatch_sanity.cpp:174: Failure > > Expected: nop_table[i] > > Which is: 0x563d50d6fa01 > > To be equal to: table[i] > > Which is: 0x563d50db158a > > i = 888 (FramebufferParameteri) > > ../src/mesa/main/tests/dispatch_sanity.cpp:174: Failure > > Expected: nop_table[i] > > Which is: 0x563d50d6fa01 > > To be equal to: table[i] > > Which is: 0x563d50db1add > > i = 889 (GetFramebufferParameteriv) > > [ FAILED ] DispatchSanity_test.GLES3 (1 ms) > > > > It appears there is a problem with the way that I'm > > defining/redefining FramebufferParameteri. I've tried adding it to > > src/mapi/glapi/gen/es_EXT.xml, but the only way I was able to achieve > > that was to give it a different function name and an alias. > > > > Does anyone have experience with this sort of backporting of > > extensions that could offer some insight on what I might be doing > > wrong? > > > > Thanks. > > > > -Fritz > > > > [1]: https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1560 > > ___ > > 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
Re: [Mesa-dev] Extension help
I made another pass and I think I solved it in the correct way. I think the problem was that the test needed to be updated to take into consideration that the extension can apply to GLES 3.0 and not just GLES 3.1. On Fri, Aug 2, 2019 at 1:13 PM Fritz Koenig wrote: > > Hi, > > I would like to be able to use the MESA_framebuffer_flip_y extension > in GLES 3.0. The blocker is that FramebufferParameteri is not part of > GLES 3.0. I have explored a couple of ways of achieving this. > > 1. FramebufferParameteri was first provided by the GL extension > ARB_framebuffer_no_attachments. However, > ARB_framebuffer_no_attachments was never a GLES extension. An option > would be to modify the ARB_framebuffer_no_attachments spec to make it > an extension for GLES. > > 2. Change the MESA_framebuffer_flip_y spec to allow the extension to > implement FramebufferParameteri. > > I choose the 2nd option and put together a pr for it[1]. > > I didn't get the implementation quite right, and I'm looking for some > help. My change is failing the DispatchSanity_test.GLES3 test: > > [ RUN ] DispatchSanity_test.GLES3 > ../src/mesa/main/tests/dispatch_sanity.cpp:174: Failure > Expected: nop_table[i] > Which is: 0x563d50d6fa01 > To be equal to: table[i] > Which is: 0x563d50db158a > i = 888 (FramebufferParameteri) > ../src/mesa/main/tests/dispatch_sanity.cpp:174: Failure > Expected: nop_table[i] > Which is: 0x563d50d6fa01 > To be equal to: table[i] > Which is: 0x563d50db1add > i = 889 (GetFramebufferParameteriv) > [ FAILED ] DispatchSanity_test.GLES3 (1 ms) > > It appears there is a problem with the way that I'm > defining/redefining FramebufferParameteri. I've tried adding it to > src/mapi/glapi/gen/es_EXT.xml, but the only way I was able to achieve > that was to give it a different function name and an alias. > > Does anyone have experience with this sort of backporting of > extensions that could offer some insight on what I might be doing > wrong? > > Thanks. > > -Fritz > > [1]: https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1560 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] Extension help
Hi, I would like to be able to use the MESA_framebuffer_flip_y extension in GLES 3.0. The blocker is that FramebufferParameteri is not part of GLES 3.0. I have explored a couple of ways of achieving this. 1. FramebufferParameteri was first provided by the GL extension ARB_framebuffer_no_attachments. However, ARB_framebuffer_no_attachments was never a GLES extension. An option would be to modify the ARB_framebuffer_no_attachments spec to make it an extension for GLES. 2. Change the MESA_framebuffer_flip_y spec to allow the extension to implement FramebufferParameteri. I choose the 2nd option and put together a pr for it[1]. I didn't get the implementation quite right, and I'm looking for some help. My change is failing the DispatchSanity_test.GLES3 test: [ RUN ] DispatchSanity_test.GLES3 ../src/mesa/main/tests/dispatch_sanity.cpp:174: Failure Expected: nop_table[i] Which is: 0x563d50d6fa01 To be equal to: table[i] Which is: 0x563d50db158a i = 888 (FramebufferParameteri) ../src/mesa/main/tests/dispatch_sanity.cpp:174: Failure Expected: nop_table[i] Which is: 0x563d50d6fa01 To be equal to: table[i] Which is: 0x563d50db1add i = 889 (GetFramebufferParameteriv) [ FAILED ] DispatchSanity_test.GLES3 (1 ms) It appears there is a problem with the way that I'm defining/redefining FramebufferParameteri. I've tried adding it to src/mapi/glapi/gen/es_EXT.xml, but the only way I was able to achieve that was to give it a different function name and an alias. Does anyone have experience with this sort of backporting of extensions that could offer some insight on what I might be doing wrong? Thanks. -Fritz [1]: https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1560 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Replace checks for rb->Name with FlipY (v2)
On Mon, Sep 17, 2018 at 1:51 PM Fritz Koenig wrote: > > In the GL_MESA_framebuffer_flip_y implementation > _mesa_is_winsys_fbo checks were replaced with > FlipY checks. rb->Name is also used to determine > if a buffer is winsys. > > v2: Fixes annotation [for emil] > > Fixes: ab05dd183cc ("i965: implement GL_MESA_framebuffer_flip_y [v3]") > --- > src/mesa/drivers/dri/i965/brw_blorp.c| 20 +--- > src/mesa/drivers/dri/i965/intel_pixel_read.c | 4 ++-- > 2 files changed, 11 insertions(+), 13 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c > b/src/mesa/drivers/dri/i965/brw_blorp.c > index ad747e0766..ad3a47ef03 100644 > --- a/src/mesa/drivers/dri/i965/brw_blorp.c > +++ b/src/mesa/drivers/dri/i965/brw_blorp.c > @@ -1224,12 +1224,12 @@ do_single_blorp_clear(struct brw_context *brw, struct > gl_framebuffer *fb, > > x0 = fb->_Xmin; > x1 = fb->_Xmax; > - if (rb->Name != 0) { > - y0 = fb->_Ymin; > - y1 = fb->_Ymax; > - } else { > + if (fb->FlipY) { >y0 = rb->Height - fb->_Ymax; >y1 = rb->Height - fb->_Ymin; > + } else { > + y0 = fb->_Ymin; > + y1 = fb->_Ymax; > } > > /* If the clear region is empty, just return. */ > @@ -1415,9 +1415,8 @@ brw_blorp_clear_depth_stencil(struct brw_context *brw, > if (!(mask & (BUFFER_BITS_DEPTH_STENCIL))) >return; > > - uint32_t x0, x1, y0, y1, rb_name, rb_height; > + uint32_t x0, x1, y0, y1, rb_height; > if (depth_rb) { > - rb_name = depth_rb->Name; >rb_height = depth_rb->Height; >if (stencil_rb) { > assert(depth_rb->Width == stencil_rb->Width); > @@ -1425,18 +1424,17 @@ brw_blorp_clear_depth_stencil(struct brw_context *brw, >} > } else { >assert(stencil_rb); > - rb_name = stencil_rb->Name; >rb_height = stencil_rb->Height; > } > > x0 = fb->_Xmin; > x1 = fb->_Xmax; > - if (rb_name != 0) { > - y0 = fb->_Ymin; > - y1 = fb->_Ymax; > - } else { > + if (fb->FlipY) { >y0 = rb_height - fb->_Ymax; >y1 = rb_height - fb->_Ymin; > + } else { > + y0 = fb->_Ymin; > + y1 = fb->_Ymax; > } > > /* If the clear region is empty, just return. */ > diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c > b/src/mesa/drivers/dri/i965/intel_pixel_read.c > index 6ed7895bc7..8a90b207ad 100644 > --- a/src/mesa/drivers/dri/i965/intel_pixel_read.c > +++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c > @@ -181,7 +181,7 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx, > * tiled_to_linear a negative pitch so that it walks through the > * client's data backwards as it walks through the renderbufer forwards. > */ > - if (rb->Name == 0) { > + if (ctx->ReadBuffer->FlipY) { >yoffset = rb->Height - yoffset - height; >pixels += (ptrdiff_t) (height - 1) * dst_pitch; >dst_pitch = -dst_pitch; > @@ -249,7 +249,7 @@ intel_readpixels_blorp(struct gl_context *ctx, > return brw_blorp_download_miptree(brw, irb->mt, rb->Format, swizzle, > irb->mt_level, x, y, irb->mt_layer, > w, h, 1, GL_TEXTURE_2D, format, type, > - rb->Name == 0, pixels, packing); > + ctx->ReadBuffer->FlipY, pixels, > packing); > } > > void > -- > 2.19.0.397.gdd90340f6a-goog > Any other comments? Or can this go in? The relevant piglit test are: https://lists.freedesktop.org/archives/piglit/2018-September/025060.html https://lists.freedesktop.org/archives/piglit/2018-September/025090.html I spoke with Jason offline about testing this better by using the fbo option in piglit, but no progress on that yet. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Replace checks for rb->Name with FlipY
On Wed, Aug 22, 2018 at 3:41 PM Jason Ekstrand wrote: > > On Wed, Aug 22, 2018 at 5:35 PM Fritz Koenig wrote: >> >> On Wed, Aug 22, 2018 at 3:09 PM Jason Ekstrand wrote: >> > >> > Two questions: >> > >> > 1) Have you grep'd through the rest of i965 looking for Name to make sure >> > you got them all? >> >> Yes, I have. I believe that I got them all now. >> >> > 2) Have you had a chance to run it through our CI system? >> >> No I haven't. How do I kick that off? > > > It looks like Chad still has CI access; he can do it. > It has passed the CI. There are also piglit tests up for review that cover the functionality of the GL_MESA_framebuffer_flip_y feature > --Jason > >> >> > >> > On Wed, Aug 22, 2018 at 5:00 PM Fritz Koenig wrote: >> >> >> >> In the GL_MESA_framebuffer_flip_y implementation >> >> _mesa_is_winsys_fbo checks were replaced with >> >> FlipY checks. rb->Name is also used to determine >> >> if a buffer is winsys. >> >> --- >> >> src/mesa/drivers/dri/i965/brw_blorp.c| 20 +--- >> >> src/mesa/drivers/dri/i965/intel_pixel_read.c | 4 ++-- >> >> 2 files changed, 11 insertions(+), 13 deletions(-) >> >> >> >> diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c >> >> b/src/mesa/drivers/dri/i965/brw_blorp.c >> >> index 7476cee43a..7c232f6ba9 100644 >> >> --- a/src/mesa/drivers/dri/i965/brw_blorp.c >> >> +++ b/src/mesa/drivers/dri/i965/brw_blorp.c >> >> @@ -1220,12 +1220,12 @@ do_single_blorp_clear(struct brw_context *brw, >> >> struct gl_framebuffer *fb, >> >> >> >> x0 = fb->_Xmin; >> >> x1 = fb->_Xmax; >> >> - if (rb->Name != 0) { >> >> - y0 = fb->_Ymin; >> >> - y1 = fb->_Ymax; >> >> - } else { >> >> + if (fb->FlipY) { >> >>y0 = rb->Height - fb->_Ymax; >> >>y1 = rb->Height - fb->_Ymin; >> >> + } else { >> >> + y0 = fb->_Ymin; >> >> + y1 = fb->_Ymax; >> >> } >> >> >> >> /* If the clear region is empty, just return. */ >> >> @@ -1411,9 +1411,8 @@ brw_blorp_clear_depth_stencil(struct brw_context >> >> *brw, >> >> if (!(mask & (BUFFER_BITS_DEPTH_STENCIL))) >> >>return; >> >> >> >> - uint32_t x0, x1, y0, y1, rb_name, rb_height; >> >> + uint32_t x0, x1, y0, y1, rb_height; >> >> if (depth_rb) { >> >> - rb_name = depth_rb->Name; >> >>rb_height = depth_rb->Height; >> >>if (stencil_rb) { >> >> assert(depth_rb->Width == stencil_rb->Width); >> >> @@ -1421,18 +1420,17 @@ brw_blorp_clear_depth_stencil(struct brw_context >> >> *brw, >> >>} >> >> } else { >> >>assert(stencil_rb); >> >> - rb_name = stencil_rb->Name; >> >>rb_height = stencil_rb->Height; >> >> } >> >> >> >> x0 = fb->_Xmin; >> >> x1 = fb->_Xmax; >> >> - if (rb_name != 0) { >> >> - y0 = fb->_Ymin; >> >> - y1 = fb->_Ymax; >> >> - } else { >> >> + if (fb->FlipY) { >> >>y0 = rb_height - fb->_Ymax; >> >>y1 = rb_height - fb->_Ymin; >> >> + } else { >> >> + y0 = fb->_Ymin; >> >> + y1 = fb->_Ymax; >> >> } >> >> >> >> /* If the clear region is empty, just return. */ >> >> diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c >> >> b/src/mesa/drivers/dri/i965/intel_pixel_read.c >> >> index 6ed7895bc7..8a90b207ad 100644 >> >> --- a/src/mesa/drivers/dri/i965/intel_pixel_read.c >> >> +++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c >> >> @@ -181,7 +181,7 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx, >> >> * tiled_to_linear a negative pitch so that it walks through the >> >> * client's data backwards as it walks through the renderbufer >> >> forwards. >> >> */ >> >> - if (rb->Name == 0) { >> >> + if (ctx->ReadBuffer->FlipY) { >> >>yoffset = rb->Height - yoffset - height; >> >>pixels += (ptrdiff_t) (height - 1) * dst_pitch; >> >>dst_pitch = -dst_pitch; >> >> @@ -249,7 +249,7 @@ intel_readpixels_blorp(struct gl_context *ctx, >> >> return brw_blorp_download_miptree(brw, irb->mt, rb->Format, swizzle, >> >> irb->mt_level, x, y, irb->mt_layer, >> >> w, h, 1, GL_TEXTURE_2D, format, >> >> type, >> >> - rb->Name == 0, pixels, packing); >> >> + ctx->ReadBuffer->FlipY, pixels, >> >> packing); >> >> } >> >> >> >> void >> >> -- >> >> 2.18.0.1017.ga543ac7ca45-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
[Mesa-dev] [PATCH] i965: Replace checks for rb->Name with FlipY (v2)
In the GL_MESA_framebuffer_flip_y implementation _mesa_is_winsys_fbo checks were replaced with FlipY checks. rb->Name is also used to determine if a buffer is winsys. v2: Fixes annotation [for emil] Fixes: ab05dd183cc ("i965: implement GL_MESA_framebuffer_flip_y [v3]") --- src/mesa/drivers/dri/i965/brw_blorp.c| 20 +--- src/mesa/drivers/dri/i965/intel_pixel_read.c | 4 ++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c index ad747e0766..ad3a47ef03 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.c +++ b/src/mesa/drivers/dri/i965/brw_blorp.c @@ -1224,12 +1224,12 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb, x0 = fb->_Xmin; x1 = fb->_Xmax; - if (rb->Name != 0) { - y0 = fb->_Ymin; - y1 = fb->_Ymax; - } else { + if (fb->FlipY) { y0 = rb->Height - fb->_Ymax; y1 = rb->Height - fb->_Ymin; + } else { + y0 = fb->_Ymin; + y1 = fb->_Ymax; } /* If the clear region is empty, just return. */ @@ -1415,9 +1415,8 @@ brw_blorp_clear_depth_stencil(struct brw_context *brw, if (!(mask & (BUFFER_BITS_DEPTH_STENCIL))) return; - uint32_t x0, x1, y0, y1, rb_name, rb_height; + uint32_t x0, x1, y0, y1, rb_height; if (depth_rb) { - rb_name = depth_rb->Name; rb_height = depth_rb->Height; if (stencil_rb) { assert(depth_rb->Width == stencil_rb->Width); @@ -1425,18 +1424,17 @@ brw_blorp_clear_depth_stencil(struct brw_context *brw, } } else { assert(stencil_rb); - rb_name = stencil_rb->Name; rb_height = stencil_rb->Height; } x0 = fb->_Xmin; x1 = fb->_Xmax; - if (rb_name != 0) { - y0 = fb->_Ymin; - y1 = fb->_Ymax; - } else { + if (fb->FlipY) { y0 = rb_height - fb->_Ymax; y1 = rb_height - fb->_Ymin; + } else { + y0 = fb->_Ymin; + y1 = fb->_Ymax; } /* If the clear region is empty, just return. */ diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c b/src/mesa/drivers/dri/i965/intel_pixel_read.c index 6ed7895bc7..8a90b207ad 100644 --- a/src/mesa/drivers/dri/i965/intel_pixel_read.c +++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c @@ -181,7 +181,7 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx, * tiled_to_linear a negative pitch so that it walks through the * client's data backwards as it walks through the renderbufer forwards. */ - if (rb->Name == 0) { + if (ctx->ReadBuffer->FlipY) { yoffset = rb->Height - yoffset - height; pixels += (ptrdiff_t) (height - 1) * dst_pitch; dst_pitch = -dst_pitch; @@ -249,7 +249,7 @@ intel_readpixels_blorp(struct gl_context *ctx, return brw_blorp_download_miptree(brw, irb->mt, rb->Format, swizzle, irb->mt_level, x, y, irb->mt_layer, w, h, 1, GL_TEXTURE_2D, format, type, - rb->Name == 0, pixels, packing); + ctx->ReadBuffer->FlipY, pixels, packing); } void -- 2.19.0.397.gdd90340f6a-goog ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Replace checks for rb->Name with FlipY
On Thu, Aug 23, 2018 at 11:01 AM Emil Velikov wrote: > > On Thu, 23 Aug 2018 at 18:41, Emil Velikov wrote: > > > > Hi Fritz, > > > > On Wed, 22 Aug 2018 at 23:01, Fritz Koenig wrote: > > > > > > In the GL_MESA_framebuffer_flip_y implementation > > > _mesa_is_winsys_fbo checks were replaced with > > > FlipY checks. rb->Name is also used to determine > > > if a buffer is winsys. > > > > This seems like it fixes your earlier patch, so you normally want a > > fixes tag. Something like the following should be fine. > > It adds nice reference tracking, allowing the release manager to track > > and land in the correct stable branches. > > > > Fixes: ab05dd183cc ("i965: implement GL_MESA_framebuffer_flip_y [v3]") > > Thanks for the heads up on this, I'll work on getting a changed commit message out. > Quick grep shows a number of rb->Name instances in intel_fbo.c - DBG > and assert statements. > If they should stay as-is, perhaps it'll be better to add some comments? > The one assert I see is in intel_alloc_window_storage and that one should stay. That function should only be called with a windows system framebuffer. The debug statements are a little trickier. In intel_map_renderbuffer it is trivial to change to printing the flip_y out, but in intel_unmap_renderbuffer it's harder to do because flip_y is not present. It's associated with a framebuffer, not a renderbuffer. I don't think adding flip_y and removing rb->Name is desired here. rb->Name is an integer, those two statements usefulness appears to come from correlating mapping and unmapping of buffers. So I don't think removing rb->Name would be worthwhile. > Just a fly-by idea. > -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] mesa: Additional FlipY applications
Instances where direction was determined based on winsys or user fbo and should be determined based on FlipY. Key STATE_FB_WPOS_Y_TRANSFORM for of FlipY instead of _mesa_is_user_fbo. This corrects gl_FragCoord usage when applying GL_MESA_framebuffer_flip_y. Fixes: ab05dd183cc ("i965: implement GL_MESA_framebuffer_flip_y [v3]") --- src/mesa/main/multisample.c | 4 ++-- src/mesa/program/prog_statevars.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c index 8beb1d839e..d494a43ac7 100644 --- a/src/mesa/main/multisample.c +++ b/src/mesa/main/multisample.c @@ -94,8 +94,8 @@ _mesa_GetMultisamplefv(GLenum pname, GLuint index, GLfloat * val) ctx->Driver.GetSamplePosition(ctx, ctx->DrawBuffer, index, val); - /* winsys FBOs are upside down */ - if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) + /* FBOs can be upside down (winsys always are)*/ + if (ctx->DrawBuffer->FlipY) val[1] = 1.0f - val[1]; return; diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c index 4d7f388cfb..3bbe451399 100644 --- a/src/mesa/program/prog_statevars.c +++ b/src/mesa/program/prog_statevars.c @@ -571,7 +571,7 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index16 state[], case STATE_FB_WPOS_Y_TRANSFORM: /* A driver may negate this conditional by using ZW swizzle * instead of XY (based on e.g. some other state). */ - if (_mesa_is_user_fbo(ctx->DrawBuffer)) { + if (!ctx->DrawBuffer->FlipY) { /* Identity (XY) followed by flipping Y upside down (ZW). */ value[0] = 1.0F; value[1] = 0.0F; -- 2.19.0.397.gdd90340f6a-goog ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] mesa: FramebufferParameteri parameter checking
Missing break; causes parameter checking to never pass GL_FRAMEBUFFER_FLIP_Y_MESA paramers. Fixes: 318c265160 ("mesa: GL_MESA_framebuffer_flip_y extension [v4]") --- src/mesa/main/fbobject.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index edb86438e3..3263fce845 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1503,6 +1503,7 @@ framebuffer_parameteri(struct gl_context *ctx, struct gl_framebuffer *fb, if (!ctx->Extensions.MESA_framebuffer_flip_y) goto invalid_pname_enum; cannot_be_winsys_fbo = true; + break; default: goto invalid_pname_enum; } -- 2.19.0.397.gdd90340f6a-goog ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i965: Replace checks for rb->Name with FlipY (v2)
In the GL_MESA_framebuffer_flip_y implementation _mesa_is_winsys_fbo checks were replaced with FlipY checks. rb->Name is also used to determine if a buffer is winsys. v2: Fixes annotation [for emil] Fixes: ab05dd183cc ("i965: implement GL_MESA_framebuffer_flip_y [v3]") --- src/mesa/drivers/dri/i965/brw_blorp.c| 20 +--- src/mesa/drivers/dri/i965/intel_pixel_read.c | 4 ++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c index 7476cee43a..7c232f6ba9 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.c +++ b/src/mesa/drivers/dri/i965/brw_blorp.c @@ -1220,12 +1220,12 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb, x0 = fb->_Xmin; x1 = fb->_Xmax; - if (rb->Name != 0) { - y0 = fb->_Ymin; - y1 = fb->_Ymax; - } else { + if (fb->FlipY) { y0 = rb->Height - fb->_Ymax; y1 = rb->Height - fb->_Ymin; + } else { + y0 = fb->_Ymin; + y1 = fb->_Ymax; } /* If the clear region is empty, just return. */ @@ -1411,9 +1411,8 @@ brw_blorp_clear_depth_stencil(struct brw_context *brw, if (!(mask & (BUFFER_BITS_DEPTH_STENCIL))) return; - uint32_t x0, x1, y0, y1, rb_name, rb_height; + uint32_t x0, x1, y0, y1, rb_height; if (depth_rb) { - rb_name = depth_rb->Name; rb_height = depth_rb->Height; if (stencil_rb) { assert(depth_rb->Width == stencil_rb->Width); @@ -1421,18 +1420,17 @@ brw_blorp_clear_depth_stencil(struct brw_context *brw, } } else { assert(stencil_rb); - rb_name = stencil_rb->Name; rb_height = stencil_rb->Height; } x0 = fb->_Xmin; x1 = fb->_Xmax; - if (rb_name != 0) { - y0 = fb->_Ymin; - y1 = fb->_Ymax; - } else { + if (fb->FlipY) { y0 = rb_height - fb->_Ymax; y1 = rb_height - fb->_Ymin; + } else { + y0 = fb->_Ymin; + y1 = fb->_Ymax; } /* If the clear region is empty, just return. */ diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c b/src/mesa/drivers/dri/i965/intel_pixel_read.c index 6ed7895bc7..8a90b207ad 100644 --- a/src/mesa/drivers/dri/i965/intel_pixel_read.c +++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c @@ -181,7 +181,7 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx, * tiled_to_linear a negative pitch so that it walks through the * client's data backwards as it walks through the renderbufer forwards. */ - if (rb->Name == 0) { + if (ctx->ReadBuffer->FlipY) { yoffset = rb->Height - yoffset - height; pixels += (ptrdiff_t) (height - 1) * dst_pitch; dst_pitch = -dst_pitch; @@ -249,7 +249,7 @@ intel_readpixels_blorp(struct gl_context *ctx, return brw_blorp_download_miptree(brw, irb->mt, rb->Format, swizzle, irb->mt_level, x, y, irb->mt_layer, w, h, 1, GL_TEXTURE_2D, format, type, - rb->Name == 0, pixels, packing); + ctx->ReadBuffer->FlipY, pixels, packing); } void -- 2.18.0.1017.ga543ac7ca45-goog ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Replace checks for rb->Name with FlipY
On Thu, Aug 23, 2018 at 11:01 AM Emil Velikov wrote: > > On Thu, 23 Aug 2018 at 18:41, Emil Velikov wrote: > > > > Hi Fritz, > > > > On Wed, 22 Aug 2018 at 23:01, Fritz Koenig wrote: > > > > > > In the GL_MESA_framebuffer_flip_y implementation > > > _mesa_is_winsys_fbo checks were replaced with > > > FlipY checks. rb->Name is also used to determine > > > if a buffer is winsys. > > > > This seems like it fixes your earlier patch, so you normally want a > > fixes tag. Something like the following should be fine. > > It adds nice reference tracking, allowing the release manager to track > > and land in the correct stable branches. > > > > Fixes: ab05dd183cc ("i965: implement GL_MESA_framebuffer_flip_y [v3]") Thanks for the heads up on this, I'll work on getting a changed commit message out. > > > Quick grep shows a number of rb->Name instances in intel_fbo.c - DBG > and assert statements. > If they should stay as-is, perhaps it'll be better to add some comments? > The one assert I see is in intel_alloc_window_storage and that one should stay. That function should only be called with a windows system framebuffer. The debug statements are a little trickier. In intel_map_renderbuffer it is trivial to change to printing the flip_y out, but in intel_unmap_renderbuffer it's harder to do because flip_y is not present. It's associated with a framebuffer, not a renderbuffer. I don't think adding flip_y and removing rb->Name is desired here. rb->Name is an integer, those two statements usefulness appears to come from correlating mapping and unmapping of buffers. So I don't think removing rb->Name would be worthwhile. > Just a fly-by idea. > -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Replace checks for rb->Name with FlipY
On Wed, Aug 22, 2018 at 3:09 PM Jason Ekstrand wrote: > > Two questions: > > 1) Have you grep'd through the rest of i965 looking for Name to make sure > you got them all? Yes, I have. I believe that I got them all now. > 2) Have you had a chance to run it through our CI system? No I haven't. How do I kick that off? > > On Wed, Aug 22, 2018 at 5:00 PM Fritz Koenig wrote: >> >> In the GL_MESA_framebuffer_flip_y implementation >> _mesa_is_winsys_fbo checks were replaced with >> FlipY checks. rb->Name is also used to determine >> if a buffer is winsys. >> --- >> src/mesa/drivers/dri/i965/brw_blorp.c| 20 +--- >> src/mesa/drivers/dri/i965/intel_pixel_read.c | 4 ++-- >> 2 files changed, 11 insertions(+), 13 deletions(-) >> >> diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c >> b/src/mesa/drivers/dri/i965/brw_blorp.c >> index 7476cee43a..7c232f6ba9 100644 >> --- a/src/mesa/drivers/dri/i965/brw_blorp.c >> +++ b/src/mesa/drivers/dri/i965/brw_blorp.c >> @@ -1220,12 +1220,12 @@ do_single_blorp_clear(struct brw_context *brw, >> struct gl_framebuffer *fb, >> >> x0 = fb->_Xmin; >> x1 = fb->_Xmax; >> - if (rb->Name != 0) { >> - y0 = fb->_Ymin; >> - y1 = fb->_Ymax; >> - } else { >> + if (fb->FlipY) { >>y0 = rb->Height - fb->_Ymax; >>y1 = rb->Height - fb->_Ymin; >> + } else { >> + y0 = fb->_Ymin; >> + y1 = fb->_Ymax; >> } >> >> /* If the clear region is empty, just return. */ >> @@ -1411,9 +1411,8 @@ brw_blorp_clear_depth_stencil(struct brw_context *brw, >> if (!(mask & (BUFFER_BITS_DEPTH_STENCIL))) >>return; >> >> - uint32_t x0, x1, y0, y1, rb_name, rb_height; >> + uint32_t x0, x1, y0, y1, rb_height; >> if (depth_rb) { >> - rb_name = depth_rb->Name; >>rb_height = depth_rb->Height; >>if (stencil_rb) { >> assert(depth_rb->Width == stencil_rb->Width); >> @@ -1421,18 +1420,17 @@ brw_blorp_clear_depth_stencil(struct brw_context >> *brw, >>} >> } else { >>assert(stencil_rb); >> - rb_name = stencil_rb->Name; >>rb_height = stencil_rb->Height; >> } >> >> x0 = fb->_Xmin; >> x1 = fb->_Xmax; >> - if (rb_name != 0) { >> - y0 = fb->_Ymin; >> - y1 = fb->_Ymax; >> - } else { >> + if (fb->FlipY) { >>y0 = rb_height - fb->_Ymax; >>y1 = rb_height - fb->_Ymin; >> + } else { >> + y0 = fb->_Ymin; >> + y1 = fb->_Ymax; >> } >> >> /* If the clear region is empty, just return. */ >> diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c >> b/src/mesa/drivers/dri/i965/intel_pixel_read.c >> index 6ed7895bc7..8a90b207ad 100644 >> --- a/src/mesa/drivers/dri/i965/intel_pixel_read.c >> +++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c >> @@ -181,7 +181,7 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx, >> * tiled_to_linear a negative pitch so that it walks through the >> * client's data backwards as it walks through the renderbufer forwards. >> */ >> - if (rb->Name == 0) { >> + if (ctx->ReadBuffer->FlipY) { >>yoffset = rb->Height - yoffset - height; >>pixels += (ptrdiff_t) (height - 1) * dst_pitch; >>dst_pitch = -dst_pitch; >> @@ -249,7 +249,7 @@ intel_readpixels_blorp(struct gl_context *ctx, >> return brw_blorp_download_miptree(brw, irb->mt, rb->Format, swizzle, >> irb->mt_level, x, y, irb->mt_layer, >> w, h, 1, GL_TEXTURE_2D, format, type, >> - rb->Name == 0, pixels, packing); >> + ctx->ReadBuffer->FlipY, pixels, >> packing); >> } >> >> void >> -- >> 2.18.0.1017.ga543ac7ca45-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
[Mesa-dev] [PATCH] i965: Replace checks for rb->Name with FlipY
In the GL_MESA_framebuffer_flip_y implementation _mesa_is_winsys_fbo checks were replaced with FlipY checks. rb->Name is also used to determine if a buffer is winsys. --- src/mesa/drivers/dri/i965/brw_blorp.c| 20 +--- src/mesa/drivers/dri/i965/intel_pixel_read.c | 4 ++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c index 7476cee43a..7c232f6ba9 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.c +++ b/src/mesa/drivers/dri/i965/brw_blorp.c @@ -1220,12 +1220,12 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb, x0 = fb->_Xmin; x1 = fb->_Xmax; - if (rb->Name != 0) { - y0 = fb->_Ymin; - y1 = fb->_Ymax; - } else { + if (fb->FlipY) { y0 = rb->Height - fb->_Ymax; y1 = rb->Height - fb->_Ymin; + } else { + y0 = fb->_Ymin; + y1 = fb->_Ymax; } /* If the clear region is empty, just return. */ @@ -1411,9 +1411,8 @@ brw_blorp_clear_depth_stencil(struct brw_context *brw, if (!(mask & (BUFFER_BITS_DEPTH_STENCIL))) return; - uint32_t x0, x1, y0, y1, rb_name, rb_height; + uint32_t x0, x1, y0, y1, rb_height; if (depth_rb) { - rb_name = depth_rb->Name; rb_height = depth_rb->Height; if (stencil_rb) { assert(depth_rb->Width == stencil_rb->Width); @@ -1421,18 +1420,17 @@ brw_blorp_clear_depth_stencil(struct brw_context *brw, } } else { assert(stencil_rb); - rb_name = stencil_rb->Name; rb_height = stencil_rb->Height; } x0 = fb->_Xmin; x1 = fb->_Xmax; - if (rb_name != 0) { - y0 = fb->_Ymin; - y1 = fb->_Ymax; - } else { + if (fb->FlipY) { y0 = rb_height - fb->_Ymax; y1 = rb_height - fb->_Ymin; + } else { + y0 = fb->_Ymin; + y1 = fb->_Ymax; } /* If the clear region is empty, just return. */ diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c b/src/mesa/drivers/dri/i965/intel_pixel_read.c index 6ed7895bc7..8a90b207ad 100644 --- a/src/mesa/drivers/dri/i965/intel_pixel_read.c +++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c @@ -181,7 +181,7 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx, * tiled_to_linear a negative pitch so that it walks through the * client's data backwards as it walks through the renderbufer forwards. */ - if (rb->Name == 0) { + if (ctx->ReadBuffer->FlipY) { yoffset = rb->Height - yoffset - height; pixels += (ptrdiff_t) (height - 1) * dst_pitch; dst_pitch = -dst_pitch; @@ -249,7 +249,7 @@ intel_readpixels_blorp(struct gl_context *ctx, return brw_blorp_download_miptree(brw, irb->mt, rb->Format, swizzle, irb->mt_level, x, y, irb->mt_layer, w, h, 1, GL_TEXTURE_2D, format, type, - rb->Name == 0, pixels, packing); + ctx->ReadBuffer->FlipY, pixels, packing); } void -- 2.18.0.1017.ga543ac7ca45-goog ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] i965: implement MESA_framebuffer_flip_y [v3]
Instead of using _mesa_is_winsys_fbo or _mesa_is_user_fbo to infer if an fbo is flipped use the InvertedY flag. v2: * additional window-system framebuffer checks [for jason] v3: * s/inverted_y/flip_y/g [for chadv] * s/InvertedY/FlipY/g [for chadv] --- src/mesa/drivers/dri/i965/brw_blorp.c | 2 +- src/mesa/drivers/dri/i965/brw_meta_util.c | 4 +- src/mesa/drivers/dri/i965/brw_sf.c| 6 +-- src/mesa/drivers/dri/i965/genX_state_upload.c | 50 +-- src/mesa/drivers/dri/i965/intel_extensions.c | 1 + src/mesa/drivers/dri/i965/intel_fbo.c | 11 ++-- .../drivers/dri/i965/intel_pixel_bitmap.c | 8 +-- src/mesa/drivers/dri/i965/intel_pixel_copy.c | 4 +- src/mesa/drivers/dri/i965/intel_pixel_draw.c | 2 +- 9 files changed, 43 insertions(+), 45 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c index b66ee18ba4..7476cee43a 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.c +++ b/src/mesa/drivers/dri/i965/brw_blorp.c @@ -740,7 +740,7 @@ brw_blorp_copytexsubimage(struct brw_context *brw, /* Account for the fact that in the system framebuffer, the origin is at * the lower left. */ - bool mirror_y = _mesa_is_winsys_fbo(ctx->ReadBuffer); + bool mirror_y = ctx->ReadBuffer->FlipY; if (mirror_y) apply_y_flip(, , src_rb->Height); diff --git a/src/mesa/drivers/dri/i965/brw_meta_util.c b/src/mesa/drivers/dri/i965/brw_meta_util.c index d292f5a8e2..908b098976 100644 --- a/src/mesa/drivers/dri/i965/brw_meta_util.c +++ b/src/mesa/drivers/dri/i965/brw_meta_util.c @@ -250,13 +250,13 @@ brw_meta_mirror_clip_and_scissor(const struct gl_context *ctx, /* Account for the fact that in the system framebuffer, the origin is at * the lower left. */ - if (_mesa_is_winsys_fbo(read_fb)) { + if (read_fb->FlipY) { GLint tmp = read_fb->Height - *srcY0; *srcY0 = read_fb->Height - *srcY1; *srcY1 = tmp; *mirror_y = !*mirror_y; } - if (_mesa_is_winsys_fbo(draw_fb)) { + if (draw_fb->FlipY) { GLint tmp = draw_fb->Height - *dstY0; *dstY0 = draw_fb->Height - *dstY1; *dstY1 = tmp; diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c index 73bc663f29..f4073fa6cf 100644 --- a/src/mesa/drivers/dri/i965/brw_sf.c +++ b/src/mesa/drivers/dri/i965/brw_sf.c @@ -90,7 +90,7 @@ brw_upload_sf_prog(struct brw_context *brw) return; /* _NEW_BUFFERS */ - bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer); + bool flip_y = ctx->DrawBuffer->FlipY; memset(, 0, sizeof(key)); @@ -137,7 +137,7 @@ brw_upload_sf_prog(struct brw_context *brw) * Window coordinates in a FBO are inverted, which means point * sprite origin must be inverted, too. */ - if ((ctx->Point.SpriteOrigin == GL_LOWER_LEFT) != render_to_fbo) + if ((ctx->Point.SpriteOrigin == GL_LOWER_LEFT) == flip_y) key.sprite_origin_lower_left = true; /* BRW_NEW_FS_PROG_DATA */ @@ -161,7 +161,7 @@ brw_upload_sf_prog(struct brw_context *brw) * face orientation, just as we invert the viewport in * sf_unit_create_from_key(). */ - key.frontface_ccw = brw->polygon_front_bit == render_to_fbo; + key.frontface_ccw = brw->polygon_front_bit != flip_y; } if (!brw_search_cache(>cache, BRW_CACHE_SF_PROG, , sizeof(key), diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c index 9e0a17b9d9..cfafbb0c37 100644 --- a/src/mesa/drivers/dri/i965/genX_state_upload.c +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c @@ -217,7 +217,7 @@ genX(upload_polygon_stipple)(struct brw_context *brw) * to a FBO (i.e. any named frame buffer object), we *don't* * need to invert - we already match the layout. */ - if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { + if (ctx->DrawBuffer->FlipY) { for (unsigned i = 0; i < 32; i++) poly.PatternRow[i] = ctx->PolygonStipple[31 - i]; /* invert */ } else { @@ -257,7 +257,7 @@ genX(upload_polygon_stipple_offset)(struct brw_context *brw) * to a user-created FBO then our native pixel coordinate system * works just fine, and there's no window system to worry about. */ - if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { + if (ctx->DrawBuffer->FlipY) { poly.PolygonStippleYOffset = (32 - (_mesa_geometric_height(ctx->DrawBuffer) & 31)) & 31; } @@ -1468,7 +1468,7 @@ genX(upload_clip_state)(struct brw_context *brw) #endif #if GEN_GEN == 7 - clip.FrontWinding = brw->polygon_front_bit == _mesa_is_user_fbo(fb); + clip.FrontWinding = brw->polygon_front_bit != fb->FlipY; if (ctx->Polygon.CullFlag) { switch (ctx->Polygon.CullFaceMode) { @@ -1583,7 +1583,7 @@ genX(upload_sf)(struct brw_context *brw) #if GEN_GEN <= 7 /* _NEW_BUFFERS */ - bool render_to_fbo =
[Mesa-dev] [PATCH 1/2] mesa: MESA_framebuffer_flip_y extension [v4]
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 @@ -233
Re: [Mesa-dev] [PATCH 1/2] mesa: MESA_framebuffer_flip_y extension [v3]
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
Re: [Mesa-dev] [PATCH 1/2] mesa: MESA_framebuffer_flip_y extension [v3]
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
[Mesa-dev] [PATCH 1/2] mesa: MESA_framebuffer_flip_y extension [v3]
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]
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
[Mesa-dev] [PATCH 1/2] mesa: MESA_framebuffer_flip_y extension [v2]
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 +656
[Mesa-dev] [PATCH 2/2] i965: implement MESA_framebuffer_flip_yv [v2]
Instead of using _mesa_is_winsys_fbo or _mesa_is_user_fbo to infer if an fbo is flipped use the InvertedY flag. --- src/mesa/drivers/dri/i965/brw_blorp.c | 2 +- src/mesa/drivers/dri/i965/brw_meta_util.c | 4 +- src/mesa/drivers/dri/i965/brw_sf.c| 6 +-- src/mesa/drivers/dri/i965/genX_state_upload.c | 50 +-- src/mesa/drivers/dri/i965/intel_extensions.c | 1 + src/mesa/drivers/dri/i965/intel_fbo.c | 12 ++--- .../drivers/dri/i965/intel_pixel_bitmap.c | 8 +-- src/mesa/drivers/dri/i965/intel_pixel_copy.c | 4 +- src/mesa/drivers/dri/i965/intel_pixel_draw.c | 2 +- 9 files changed, 43 insertions(+), 46 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c index 5f99e51bc2..9fe3873291 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.c +++ b/src/mesa/drivers/dri/i965/brw_blorp.c @@ -685,7 +685,7 @@ brw_blorp_copytexsubimage(struct brw_context *brw, /* Account for the fact that in the system framebuffer, the origin is at * the lower left. */ - bool mirror_y = _mesa_is_winsys_fbo(ctx->ReadBuffer); + bool mirror_y = ctx->ReadBuffer->InvertedY; if (mirror_y) apply_y_flip(, , src_rb->Height); diff --git a/src/mesa/drivers/dri/i965/brw_meta_util.c b/src/mesa/drivers/dri/i965/brw_meta_util.c index d292f5a8e2..ad671f600d 100644 --- a/src/mesa/drivers/dri/i965/brw_meta_util.c +++ b/src/mesa/drivers/dri/i965/brw_meta_util.c @@ -250,13 +250,13 @@ brw_meta_mirror_clip_and_scissor(const struct gl_context *ctx, /* Account for the fact that in the system framebuffer, the origin is at * the lower left. */ - if (_mesa_is_winsys_fbo(read_fb)) { + if (read_fb->InvertedY) { GLint tmp = read_fb->Height - *srcY0; *srcY0 = read_fb->Height - *srcY1; *srcY1 = tmp; *mirror_y = !*mirror_y; } - if (_mesa_is_winsys_fbo(draw_fb)) { + if (draw_fb->InvertedY) { GLint tmp = draw_fb->Height - *dstY0; *dstY0 = draw_fb->Height - *dstY1; *dstY1 = tmp; diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c index 37ce999dc0..25fe9b3dfe 100644 --- a/src/mesa/drivers/dri/i965/brw_sf.c +++ b/src/mesa/drivers/dri/i965/brw_sf.c @@ -90,7 +90,7 @@ brw_upload_sf_prog(struct brw_context *brw) return; /* _NEW_BUFFERS */ - bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer); + bool inverted_y = ctx->DrawBuffer->InvertedY; memset(, 0, sizeof(key)); @@ -137,7 +137,7 @@ brw_upload_sf_prog(struct brw_context *brw) * Window coordinates in a FBO are inverted, which means point * sprite origin must be inverted, too. */ - if ((ctx->Point.SpriteOrigin == GL_LOWER_LEFT) != render_to_fbo) + if ((ctx->Point.SpriteOrigin == GL_LOWER_LEFT) == inverted_y) key.sprite_origin_lower_left = true; /* BRW_NEW_FS_PROG_DATA */ @@ -161,7 +161,7 @@ brw_upload_sf_prog(struct brw_context *brw) * face orientation, just as we invert the viewport in * sf_unit_create_from_key(). */ - key.frontface_ccw = brw->polygon_front_bit == render_to_fbo; + key.frontface_ccw = brw->polygon_front_bit != inverted_y; } if (!brw_search_cache(>cache, BRW_CACHE_SF_PROG, diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c index 88fde9d12f..b5f3b6c92a 100644 --- a/src/mesa/drivers/dri/i965/genX_state_upload.c +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c @@ -217,7 +217,7 @@ genX(upload_polygon_stipple)(struct brw_context *brw) * to a FBO (i.e. any named frame buffer object), we *don't* * need to invert - we already match the layout. */ - if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { + if (ctx->DrawBuffer->InvertedY) { for (unsigned i = 0; i < 32; i++) poly.PatternRow[i] = ctx->PolygonStipple[31 - i]; /* invert */ } else { @@ -257,7 +257,7 @@ genX(upload_polygon_stipple_offset)(struct brw_context *brw) * to a user-created FBO then our native pixel coordinate system * works just fine, and there's no window system to worry about. */ - if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { + if (ctx->DrawBuffer->InvertedY) { poly.PolygonStippleYOffset = (32 - (_mesa_geometric_height(ctx->DrawBuffer) & 31)) & 31; } @@ -1468,7 +1468,7 @@ genX(upload_clip_state)(struct brw_context *brw) #endif #if GEN_GEN == 7 - clip.FrontWinding = brw->polygon_front_bit == _mesa_is_user_fbo(fb); + clip.FrontWinding = brw->polygon_front_bit != fb->InvertedY; if (ctx->Polygon.CullFlag) { switch (ctx->Polygon.CullFaceMode) { @@ -1583,7 +1583,7 @@ genX(upload_sf)(struct brw_context *brw) #if GEN_GEN <= 7 /* _NEW_BUFFERS */ - bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer); + bool inverted_y = ctx->DrawBuffer->InvertedY; UNUSED const bool multisampled_fbo
Re: [Mesa-dev] [PATCH 1/2] mesa : MESA_framebuffer_flip_y extension
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/extens
Re: [Mesa-dev] [PATCH 1/2] mesa : MESA_framebuffer_flip_y extension
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
[Mesa-dev] [PATCH 1/2] mesa : MESA_framebuffer_flip_y extension
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-&g
[Mesa-dev] [PATCH 2/2] i965: implement MESA_framebuffer_flip_y
Instead of using _mesa_is_winsys_fbo or _mesa_is_user_fbo to infer if an fbo is flipped use the InvertedY flag. --- src/mesa/drivers/dri/i965/brw_blorp.c | 2 +- src/mesa/drivers/dri/i965/brw_meta_util.c | 4 +- src/mesa/drivers/dri/i965/brw_sf.c| 6 +-- src/mesa/drivers/dri/i965/genX_state_upload.c | 50 +-- src/mesa/drivers/dri/i965/intel_extensions.c | 1 + .../drivers/dri/i965/intel_pixel_bitmap.c | 8 +-- src/mesa/drivers/dri/i965/intel_pixel_copy.c | 4 +- src/mesa/drivers/dri/i965/intel_pixel_draw.c | 2 +- 8 files changed, 39 insertions(+), 38 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c index 8c6d77e1b7..bc32c7b39c 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.c +++ b/src/mesa/drivers/dri/i965/brw_blorp.c @@ -685,7 +685,7 @@ brw_blorp_copytexsubimage(struct brw_context *brw, /* Account for the fact that in the system framebuffer, the origin is at * the lower left. */ - bool mirror_y = _mesa_is_winsys_fbo(ctx->ReadBuffer); + bool mirror_y = ctx->ReadBuffer->InvertedY; if (mirror_y) apply_y_flip(, , src_rb->Height); diff --git a/src/mesa/drivers/dri/i965/brw_meta_util.c b/src/mesa/drivers/dri/i965/brw_meta_util.c index d292f5a8e2..ad671f600d 100644 --- a/src/mesa/drivers/dri/i965/brw_meta_util.c +++ b/src/mesa/drivers/dri/i965/brw_meta_util.c @@ -250,13 +250,13 @@ brw_meta_mirror_clip_and_scissor(const struct gl_context *ctx, /* Account for the fact that in the system framebuffer, the origin is at * the lower left. */ - if (_mesa_is_winsys_fbo(read_fb)) { + if (read_fb->InvertedY) { GLint tmp = read_fb->Height - *srcY0; *srcY0 = read_fb->Height - *srcY1; *srcY1 = tmp; *mirror_y = !*mirror_y; } - if (_mesa_is_winsys_fbo(draw_fb)) { + if (draw_fb->InvertedY) { GLint tmp = draw_fb->Height - *dstY0; *dstY0 = draw_fb->Height - *dstY1; *dstY1 = tmp; diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c index 37ce999dc0..25fe9b3dfe 100644 --- a/src/mesa/drivers/dri/i965/brw_sf.c +++ b/src/mesa/drivers/dri/i965/brw_sf.c @@ -90,7 +90,7 @@ brw_upload_sf_prog(struct brw_context *brw) return; /* _NEW_BUFFERS */ - bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer); + bool inverted_y = ctx->DrawBuffer->InvertedY; memset(, 0, sizeof(key)); @@ -137,7 +137,7 @@ brw_upload_sf_prog(struct brw_context *brw) * Window coordinates in a FBO are inverted, which means point * sprite origin must be inverted, too. */ - if ((ctx->Point.SpriteOrigin == GL_LOWER_LEFT) != render_to_fbo) + if ((ctx->Point.SpriteOrigin == GL_LOWER_LEFT) == inverted_y) key.sprite_origin_lower_left = true; /* BRW_NEW_FS_PROG_DATA */ @@ -161,7 +161,7 @@ brw_upload_sf_prog(struct brw_context *brw) * face orientation, just as we invert the viewport in * sf_unit_create_from_key(). */ - key.frontface_ccw = brw->polygon_front_bit == render_to_fbo; + key.frontface_ccw = brw->polygon_front_bit != inverted_y; } if (!brw_search_cache(>cache, BRW_CACHE_SF_PROG, diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c index 88fde9d12f..b5f3b6c92a 100644 --- a/src/mesa/drivers/dri/i965/genX_state_upload.c +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c @@ -217,7 +217,7 @@ genX(upload_polygon_stipple)(struct brw_context *brw) * to a FBO (i.e. any named frame buffer object), we *don't* * need to invert - we already match the layout. */ - if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { + if (ctx->DrawBuffer->InvertedY) { for (unsigned i = 0; i < 32; i++) poly.PatternRow[i] = ctx->PolygonStipple[31 - i]; /* invert */ } else { @@ -257,7 +257,7 @@ genX(upload_polygon_stipple_offset)(struct brw_context *brw) * to a user-created FBO then our native pixel coordinate system * works just fine, and there's no window system to worry about. */ - if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { + if (ctx->DrawBuffer->InvertedY) { poly.PolygonStippleYOffset = (32 - (_mesa_geometric_height(ctx->DrawBuffer) & 31)) & 31; } @@ -1468,7 +1468,7 @@ genX(upload_clip_state)(struct brw_context *brw) #endif #if GEN_GEN == 7 - clip.FrontWinding = brw->polygon_front_bit == _mesa_is_user_fbo(fb); + clip.FrontWinding = brw->polygon_front_bit != fb->InvertedY; if (ctx->Polygon.CullFlag) { switch (ctx->Polygon.CullFaceMode) { @@ -1583,7 +1583,7 @@ genX(upload_sf)(struct brw_context *brw) #if GEN_GEN <= 7 /* _NEW_BUFFERS */ - bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer); + bool inverted_y = ctx->DrawBuffer->InvertedY; UNUSED const bool multisampled_fbo = _mesa_geometric_samples(ctx->DrawBuffer) > 1;