[Mesa-dev] [Mesa-stable] [PATCH] meta/generate_mipmap: Work-around GLES 1.x problem with GL_DRAW_FRAMEBUFFER

Emil Velikov emil.l.velikov at gmail.com
Sat Dec 12 10:50:34 PST 2015


On 3 December 2015 at 23:52, Anuj Phogat <anuj.phogat at gmail.com> wrote:
> On Thu, Dec 3, 2015 at 2:43 PM, Ian Romanick <idr at freedesktop.org> wrote:
>> From: Ian Romanick <ian.d.romanick at intel.com>
>>
>> GL_DRAW_FRAMEBUFFER does not exist in OpenGL ES 1.x, and since
>> _mesa_meta_begin hasn't been called yet, we have to work-around API
>> difficulties.  The whole reason that GL_DRAW_FRAMEBUFFER is used instead
>> of GL_FRAMEBUFFER is that the read framebuffer may be different.  This
>> is moot in OpenGL ES 1.x.
>>
>> I have another patch series that would also fix this (by removing the
>> calls to _mesa_BindFramebuffer and friends), but it's not quite ready
>> yet... and I think it may be a bit heavy for some stable branches.
>> Consider this a stop-gap fix.
>>
>> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93215
>> Cc: "11.0 11.1" <mesa-stable at lists.freedesktop.org>
>> ---
>>  src/mesa/drivers/common/meta_generate_mipmap.c | 17 +++++++++++++----
>>  1 file changed, 13 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c b/src/mesa/drivers/common/meta_generate_mipmap.c
>> index d38e6b8..2b942d6 100644
>> --- a/src/mesa/drivers/common/meta_generate_mipmap.c
>> +++ b/src/mesa/drivers/common/meta_generate_mipmap.c
>> @@ -62,6 +62,15 @@ fallback_required(struct gl_context *ctx, GLenum target,
>>     GLuint srcLevel;
>>     GLenum status;
>>
>> +   /* GL_DRAW_FRAMEBUFFER does not exist in OpenGL ES 1.x, and since
>> +    * _mesa_meta_begin hasn't been called yet, we have to work-around API
>> +    * difficulties.  The whole reason that GL_DRAW_FRAMEBUFFER is used instead
>> +    * of GL_FRAMEBUFFER is that the read framebuffer may be different.  This
>> +    * is moot in OpenGL ES 1.x.
>> +    */
>> +   const GLenum fbo_target = ctx->API == API_OPENGLES
>> +      ? GL_FRAMEBUFFER : GL_DRAW_FRAMEBUFFER;
>> +
>>     /* check for fallbacks */
>>     if (target == GL_TEXTURE_3D) {
>>        _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH,
>> @@ -102,13 +111,13 @@ fallback_required(struct gl_context *ctx, GLenum target,
>>      */
>>     if (!mipmap->FBO)
>>        _mesa_GenFramebuffers(1, &mipmap->FBO);
>> -   _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, mipmap->FBO);
>> +   _mesa_BindFramebuffer(fbo_target, mipmap->FBO);
>>
>> -   _mesa_meta_bind_fbo_image(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, baseImage, 0);
>> +   _mesa_meta_bind_fbo_image(fbo_target, GL_COLOR_ATTACHMENT0, baseImage, 0);
>>
>> -   status = _mesa_CheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
>> +   status = _mesa_CheckFramebufferStatus(fbo_target);
>>
>> -   _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fboSave);
>> +   _mesa_BindFramebuffer(fbo_target, fboSave);
>>
>>     if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
>>        _mesa_perf_debug(ctx, MESA_DEBUG_SEVERITY_HIGH,
>> --
>> 2.5.0
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
> Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>
Am I missing something or this patch hasn't landed in master ? Is
there another work that makes it obsolete or anything ?

Thanks
Emil


More information about the mesa-dev mailing list