[Mesa-dev] [PATCH 03/40] mesa: Eliminate parameters to dd_function_table::Viewport

Brian Paul brianp at vmware.com
Wed Mar 19 06:07:40 PDT 2014


On 03/18/2014 06:56 PM, Alexander von Gluck IV wrote:
> On 03/17/2014 10:15 AM, Brian Paul wrote:
>> On 03/16/2014 02:52 PM, Alexander von Gluck IV wrote:
>>> On 01/10/2014 07:40 PM, Ian Romanick wrote:
>>>> From: Ian Romanick <ian.d.romanick at intel.com>
>>>>
>>>> No driver uses them.  They will just be annoying in future patches.
>>>>
>>>> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
>>>> ---
>>>>    src/mesa/drivers/dri/i915/intel_context.c  | 15 ++-------------
>>>>    src/mesa/drivers/dri/i965/brw_context.c    |  7 +------
>>>>    src/mesa/drivers/dri/r200/r200_state.c     |  8 +-------
>>>>    src/mesa/drivers/dri/radeon/radeon_state.c |  8 +-------
>>>>    src/mesa/drivers/dri/swrast/swrast.c       |  6 +-----
>>>>    src/mesa/drivers/windows/gdi/wmesa.c       |  4 +---
>>>>    src/mesa/drivers/x11/xm_dd.c               |  6 +-----
>>>>    src/mesa/main/dd.h                         |  2 +-
>>>>    src/mesa/main/viewport.c                   |  2 +-
>>>>    src/mesa/state_tracker/st_cb_viewport.c    |  3 +--
>>>>    10 files changed, 11 insertions(+), 50 deletions(-)
>>>>
>>>
>>>> diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
>>>> index 6e73691..f438278 100644
>>>> --- a/src/mesa/main/dd.h
>>>> +++ b/src/mesa/main/dd.h
>>>> @@ -546,7 +546,7 @@ struct dd_function_table {
>>>>                            struct gl_texture_object *texObj,
>>>>                            GLenum pname, const GLfloat *params);
>>>>       /** Set the viewport */
>>>> -   void (*Viewport)(struct gl_context *ctx, GLint x, GLint y,
>>>> GLsizei w, GLsizei h);
>>>> +   void (*Viewport)(struct gl_context *ctx);
>>>>       /*@}*/
>>>>
>>>>
>>>> diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
>>>> index 91578ba..7ea1d5f 100644
>>>> --- a/src/mesa/main/viewport.c
>>>> +++ b/src/mesa/main/viewport.c
>>>> @@ -99,7 +99,7 @@ _mesa_set_viewport(struct gl_context *ctx, GLint x,
>>>> GLint y,
>>>>          /* Many drivers will use this call to check for window size
>>>> changes
>>>>           * and reallocate the z/stencil/accum/etc buffers if needed.
>>>>           */
>>>> -      ctx->Driver.Viewport(ctx, x, y, width, height);
>>>> +      ctx->Driver.Viewport(ctx);
>>>>       }
>>>>    }
>>>
>>>
>>> *cough* just realized that Haiku uses these arguments while compiling
>>> 10.1 :-)
>>>
>>> https://urldefense.proofpoint.com/v1/url?u=http://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/targets/haiku-softpipe/GalliumContext.cpp%23n46&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=lGQMzzTgII0I7jefp2FHq7WtZ%2BTLs8wadB%2BiIj9xpBY%3D%0A&m=FUUWgsVWn2uSKA2anEYrFUz1AAFGwBsHlviyFxD4P2Y%3D%0A&s=448fac8302d6466285b0fa7c314b9ac6af1bbf3f416f3c01f253e0cc06058048
>>>
>>>
>>> https://urldefense.proofpoint.com/v1/url?u=http://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/targets/haiku-softpipe/GalliumContext.cpp%23n346&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=lGQMzzTgII0I7jefp2FHq7WtZ%2BTLs8wadB%2BiIj9xpBY%3D%0A&m=FUUWgsVWn2uSKA2anEYrFUz1AAFGwBsHlviyFxD4P2Y%3D%0A&s=6a77c1ecbe298d1535e63c6205d966d36b6c7dc60e08f7c586e5e9705160fc94
>>>
>>>
>>> Anyone know any easy alternatives off the top of their head?
>>
>> I think you can just grab the new viewport dims from
>> ctx->ViewportArray[0].X/Y/Width/Height.
>>
>> -Brian
>
> Thanks!  That solved it.   I actually think we could drop the Viewport
> function as the renderer is notified on window size changes (and we
> don't have to continuously poll the window size)

Yes, I would like to get rid of the glViewport-based polling of the 
window size.  I would have to review all the drivers to see if that's 
feasible.

-Brian



More information about the mesa-dev mailing list