<div dir="ltr"><div><br></div><div class="gmail_extra"><div class="gmail_quote">On Fri, Nov 1, 2013 at 1:51 PM, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">On 10/31/2013 08:55 AM, Courtney Goeltzenleuchter wrote:<br>

> Add the index parameter to the Scissor, Viewport and<br>
> DepthRange driver methods. Update i965 and Gallium<br>
> to the change. Index always 0.<br>
<br>
</div>I just sent out a patch series that cleans up a bunch of the driver<br>
implementations of dd_function_table::Viewport.  One thing is worth<br>
noting... no driver uses any of the x, y, width, or height parameters<br>
passed to Viewport.  I think we should just eliminate those parameters<br>
altogether.<br>
<br>
It also appears that every driver that implements<br>
dd_function_table::DepthRange uses the same (or nearly the same)<br>
implementation as dd_function_table::Viewport... and the parameters to<br>
it are also unused.  We should eliminate those parameters as well.<br>
<br>
For dd_function_table::Scissor, it looks like i830 and i915 both use the<br>
parameters passed.  I'm on the fence whether those should be modified to<br>
just look in the context (like other drivers do).  Do you think that<br>
would simplify later patches?<br></blockquote><div> </div><div>When I was writing this it troubled me that I was having to change driver code beyond the actual dd interface. It gets uglier when I extend the Viewport and Scissor attributes to be arrays. There are a lot of driver files touched. </div>
<div>Isn't the dd interface supposed to help shield the driver from such changes? It would make future patches for ARB_viewport_array simpler if the drivers <u>did</u> use the parameters from the dd interface. Then I wouldn't have to change driver elements as I extend the Mesa side to support viewport_arrays and only drivers that supported viewport_arrays would have to worry about an array index other than 0. I'd be curious to hear what the philosophy is around the dd interface. What would be right? Why?</div>
<div><br></div><div>It would appear that it's common practice to grab the viewport, scissor and depth data right out of the gl_context structure. If all the drivers are going to get the data straight from the gl_context structure then removing the unused parameters seems like a good idea to me. I'll put that into the next round.</div>
<div><br></div><div>Appreciate the feedback.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<br>
Also... since this is modifying three separate functions, it should be<br>
three patches.<br>
<div class=""><div class="h5"><br>
> ---<br>
>  src/mesa/drivers/common/driverfuncs.c   |  2 +-<br>
>  src/mesa/drivers/dri/i965/brw_context.c |  4 ++--<br>
>  src/mesa/drivers/dri/i965/brw_context.h |  2 +-<br>
>  src/mesa/drivers/dri/swrast/swrast.c    |  3 ++-<br>
>  src/mesa/main/dd.h                      | 10 +++++++---<br>
>  src/mesa/main/scissor.c                 |  2 +-<br>
>  src/mesa/main/viewport.c                |  4 ++--<br>
>  src/mesa/state_tracker/st_cb_viewport.c |  3 ++-<br>
>  8 files changed, 18 insertions(+), 12 deletions(-)<br>
><br>
> diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c<br>
> index 5faa98a..e45dc0e 100644<br>
> --- a/src/mesa/drivers/common/driverfuncs.c<br>
> +++ b/src/mesa/drivers/common/driverfuncs.c<br>
> @@ -299,7 +299,7 @@ _mesa_init_driver_state(struct gl_context *ctx)<br>
>     ctx->Driver.LogicOpcode(ctx, ctx->Color.LogicOp);<br>
>     ctx->Driver.PointSize(ctx, ctx->Point.Size);<br>
>     ctx->Driver.PolygonStipple(ctx, (const GLubyte *) ctx->PolygonStipple);<br>
> -   ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,<br>
> +   ctx->Driver.Scissor(ctx, 0, ctx->Scissor.X, ctx->Scissor.Y,<br>
>                         ctx->Scissor.Width, ctx->Scissor.Height);<br>
>     ctx->Driver.ShadeModel(ctx, ctx->Light.ShadeModel);<br>
>     ctx->Driver.StencilFuncSeparate(ctx, GL_FRONT,<br>
> diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c<br>
> index 3880e18..5b4d662d 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_context.c<br>
> +++ b/src/mesa/drivers/dri/i965/brw_context.c<br>
> @@ -125,13 +125,13 @@ intelGetString(struct gl_context * ctx, GLenum name)<br>
>  }<br>
><br>
>  static void<br>
> -intel_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h)<br>
> +intel_viewport(struct gl_context *ctx, GLuint idx, GLint x, GLint y, GLsizei w, GLsizei h)<br>
>  {<br>
>     struct brw_context *brw = brw_context(ctx);<br>
>     __DRIcontext *driContext = brw->driContext;<br>
><br>
>     if (brw->saved_viewport)<br>
> -      brw->saved_viewport(ctx, x, y, w, h);<br>
> +      brw->saved_viewport(ctx, idx, x, y, w, h);<br>
><br>
>     if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {<br>
>        dri2InvalidateDrawable(driContext->driDrawablePriv);<br>
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h<br>
> index 3be2138..c261ae8 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_context.h<br>
> +++ b/src/mesa/drivers/dri/i965/brw_context.h<br>
> @@ -1411,7 +1411,7 @@ struct brw_context<br>
><br>
>     __DRIcontext *driContext;<br>
>     struct intel_screen *intelScreen;<br>
> -   void (*saved_viewport)(struct gl_context *ctx,<br>
> +   void (*saved_viewport)(struct gl_context *ctx, GLuint idx,<br>
>                            GLint x, GLint y, GLsizei width, GLsizei height);<br>
>  };<br>
><br>
> diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c<br>
> index bfa2efd..ffb1fa0 100644<br>
> --- a/src/mesa/drivers/dri/swrast/swrast.c<br>
> +++ b/src/mesa/drivers/dri/swrast/swrast.c<br>
> @@ -618,7 +618,8 @@ update_state( struct gl_context *ctx, GLuint new_state )<br>
>  }<br>
><br>
>  static void<br>
> -viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h)<br>
> +viewport(struct gl_context *ctx, GLuint idx,<br>
> +         GLint x, GLint y, GLsizei w, GLsizei h)<br>
>  {<br>
>      struct gl_framebuffer *draw = ctx->WinSysDrawBuffer;<br>
>      struct gl_framebuffer *read = ctx->WinSysReadBuffer;<br>
> diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h<br>
> index 5011921..7f57a39 100644<br>
> --- a/src/mesa/main/dd.h<br>
> +++ b/src/mesa/main/dd.h<br>
> @@ -479,7 +479,8 @@ struct dd_function_table {<br>
>     /** Enable or disable writing into the depth buffer */<br>
>     void (*DepthMask)(struct gl_context *ctx, GLboolean flag);<br>
>     /** Specify mapping of depth values from NDC to window coordinates */<br>
> -   void (*DepthRange)(struct gl_context *ctx, GLclampd nearval, GLclampd farval);<br>
> +   void (*DepthRange)(struct gl_context *ctx, GLuint idx,<br>
> +                      GLclampd nearval, GLclampd farval);<br>
>     /** Specify the current buffer for writing */<br>
>     void (*DrawBuffer)( struct gl_context *ctx, GLenum buffer );<br>
>     /** Specify the buffers for writing for fragment programs*/<br>
> @@ -519,7 +520,9 @@ struct dd_function_table {<br>
>     /** Set rasterization mode */<br>
>     void (*RenderMode)(struct gl_context *ctx, GLenum mode );<br>
>     /** Define the scissor box */<br>
> -   void (*Scissor)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h);<br>
> +   void (*Scissor)(struct gl_context *ctx, GLuint idx,<br>
> +                   GLint x, GLint y,<br>
> +                   GLsizei width, GLsizei height);<br>
>     /** Select flat or smooth shading */<br>
>     void (*ShadeModel)(struct gl_context *ctx, GLenum mode);<br>
>     /** OpenGL 2.0 two-sided StencilFunc */<br>
> @@ -541,7 +544,8 @@ struct dd_function_table {<br>
>                          struct gl_texture_object *texObj,<br>
>                          GLenum pname, const GLfloat *params);<br>
>     /** Set the viewport */<br>
> -   void (*Viewport)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h);<br>
> +   void (*Viewport)(struct gl_context *ctx, GLuint idx,<br>
> +                    GLint x, GLint y, GLsizei w, GLsizei h);<br>
>     /*@}*/<br>
><br>
><br>
> diff --git a/src/mesa/main/scissor.c b/src/mesa/main/scissor.c<br>
> index 0eddaa6..4eb6337 100644<br>
> --- a/src/mesa/main/scissor.c<br>
> +++ b/src/mesa/main/scissor.c<br>
> @@ -79,7 +79,7 @@ _mesa_set_scissor(struct gl_context *ctx,<br>
>     ctx->Scissor.Height = height;<br>
><br>
>     if (ctx->Driver.Scissor)<br>
> -      ctx->Driver.Scissor( ctx, x, y, width, height );<br>
> +      ctx->Driver.Scissor( ctx, 0, x, y, width, height );<br>
>  }<br>
><br>
><br>
> diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c<br>
> index 91578ba..5da10ba 100644<br>
> --- a/src/mesa/main/viewport.c<br>
> +++ b/src/mesa/main/viewport.c<br>
> @@ -99,7 +99,7 @@ _mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y,<br>
>        /* Many drivers will use this call to check for window size changes<br>
>         * and reallocate the z/stencil/accum/etc buffers if needed.<br>
>         */<br>
> -      ctx->Driver.Viewport(ctx, x, y, width, height);<br>
> +      ctx->Driver.Viewport(ctx, 0, x, y, width, height);<br>
>     }<br>
>  }<br>
><br>
> @@ -143,7 +143,7 @@ _mesa_DepthRange(GLclampd nearval, GLclampd farval)<br>
>  #endif<br>
><br>
>     if (ctx->Driver.DepthRange) {<br>
> -      ctx->Driver.DepthRange(ctx, nearval, farval);<br>
> +      ctx->Driver.DepthRange(ctx, 0, nearval, farval);<br>
>     }<br>
>  }<br>
><br>
> diff --git a/src/mesa/state_tracker/st_cb_viewport.c b/src/mesa/state_tracker/st_cb_viewport.c<br>
> index d654ed6..d48127e 100644<br>
> --- a/src/mesa/state_tracker/st_cb_viewport.c<br>
> +++ b/src/mesa/state_tracker/st_cb_viewport.c<br>
> @@ -48,7 +48,8 @@ st_ws_framebuffer(struct gl_framebuffer *fb)<br>
>     return NULL;<br>
>  }<br>
><br>
> -static void st_viewport(struct gl_context * ctx, GLint x, GLint y,<br>
> +static void st_viewport(struct gl_context * ctx, GLuint idx,<br>
> +                        GLint x, GLint y,<br>
>                          GLsizei width, GLsizei height)<br>
>  {<br>
>     struct st_context *st = ctx->st;<br>
><br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Courtney Goeltzenleuchter<br><div>LunarG</div><div><img src="http://media.lunarg.com/wp-content/themes/LunarG/images/logo.png" width="96" height="65"><br>
</div></div>
</div></div>