[Mesa-dev] [PATCH] mesa: Change driver interface for ARB_viewport_array

Jordan Justen jljusten at gmail.com
Fri Nov 1 00:00:02 PDT 2013


On Thu, Oct 31, 2013 at 8:55 AM, Courtney Goeltzenleuchter
<courtney at lunarg.com> wrote:
> Add the index parameter to the Scissor, Viewport and
> DepthRange driver methods. Update i965 and Gallium
> to the change. Index always 0.
> ---
>  src/mesa/drivers/common/driverfuncs.c   |  2 +-
>  src/mesa/drivers/dri/i965/brw_context.c |  4 ++--
>  src/mesa/drivers/dri/i965/brw_context.h |  2 +-

git grep "ctx->Driver.Scissor"

Shows that some code in
src/mesa/drivers/dri/(i915|nouveau|radeon)
needs to be changed too.

-Jordan

>  src/mesa/drivers/dri/swrast/swrast.c    |  3 ++-
>  src/mesa/main/dd.h                      | 10 +++++++---
>  src/mesa/main/scissor.c                 |  2 +-
>  src/mesa/main/viewport.c                |  4 ++--
>  src/mesa/state_tracker/st_cb_viewport.c |  3 ++-
>  8 files changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
> index 5faa98a..e45dc0e 100644
> --- a/src/mesa/drivers/common/driverfuncs.c
> +++ b/src/mesa/drivers/common/driverfuncs.c
> @@ -299,7 +299,7 @@ _mesa_init_driver_state(struct gl_context *ctx)
>     ctx->Driver.LogicOpcode(ctx, ctx->Color.LogicOp);
>     ctx->Driver.PointSize(ctx, ctx->Point.Size);
>     ctx->Driver.PolygonStipple(ctx, (const GLubyte *) ctx->PolygonStipple);
> -   ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
> +   ctx->Driver.Scissor(ctx, 0, ctx->Scissor.X, ctx->Scissor.Y,
>                         ctx->Scissor.Width, ctx->Scissor.Height);
>     ctx->Driver.ShadeModel(ctx, ctx->Light.ShadeModel);
>     ctx->Driver.StencilFuncSeparate(ctx, GL_FRONT,
> diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
> index 3880e18..5b4d662d 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.c
> +++ b/src/mesa/drivers/dri/i965/brw_context.c
> @@ -125,13 +125,13 @@ intelGetString(struct gl_context * ctx, GLenum name)
>  }
>
>  static void
> -intel_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
> +intel_viewport(struct gl_context *ctx, GLuint idx, GLint x, GLint y, GLsizei w, GLsizei h)
>  {
>     struct brw_context *brw = brw_context(ctx);
>     __DRIcontext *driContext = brw->driContext;
>
>     if (brw->saved_viewport)
> -      brw->saved_viewport(ctx, x, y, w, h);
> +      brw->saved_viewport(ctx, idx, x, y, w, h);
>
>     if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
>        dri2InvalidateDrawable(driContext->driDrawablePriv);
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
> index 3be2138..c261ae8 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -1411,7 +1411,7 @@ struct brw_context
>
>     __DRIcontext *driContext;
>     struct intel_screen *intelScreen;
> -   void (*saved_viewport)(struct gl_context *ctx,
> +   void (*saved_viewport)(struct gl_context *ctx, GLuint idx,
>                            GLint x, GLint y, GLsizei width, GLsizei height);
>  };
>
> diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
> index bfa2efd..ffb1fa0 100644
> --- a/src/mesa/drivers/dri/swrast/swrast.c
> +++ b/src/mesa/drivers/dri/swrast/swrast.c
> @@ -618,7 +618,8 @@ update_state( struct gl_context *ctx, GLuint new_state )
>  }
>
>  static void
> -viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
> +viewport(struct gl_context *ctx, GLuint idx,
> +         GLint x, GLint y, GLsizei w, GLsizei h)
>  {
>      struct gl_framebuffer *draw = ctx->WinSysDrawBuffer;
>      struct gl_framebuffer *read = ctx->WinSysReadBuffer;
> diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
> index 5011921..7f57a39 100644
> --- a/src/mesa/main/dd.h
> +++ b/src/mesa/main/dd.h
> @@ -479,7 +479,8 @@ struct dd_function_table {
>     /** Enable or disable writing into the depth buffer */
>     void (*DepthMask)(struct gl_context *ctx, GLboolean flag);
>     /** Specify mapping of depth values from NDC to window coordinates */
> -   void (*DepthRange)(struct gl_context *ctx, GLclampd nearval, GLclampd farval);
> +   void (*DepthRange)(struct gl_context *ctx, GLuint idx,
> +                      GLclampd nearval, GLclampd farval);
>     /** Specify the current buffer for writing */
>     void (*DrawBuffer)( struct gl_context *ctx, GLenum buffer );
>     /** Specify the buffers for writing for fragment programs*/
> @@ -519,7 +520,9 @@ struct dd_function_table {
>     /** Set rasterization mode */
>     void (*RenderMode)(struct gl_context *ctx, GLenum mode );
>     /** Define the scissor box */
> -   void (*Scissor)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
> +   void (*Scissor)(struct gl_context *ctx, GLuint idx,
> +                   GLint x, GLint y,
> +                   GLsizei width, GLsizei height);
>     /** Select flat or smooth shading */
>     void (*ShadeModel)(struct gl_context *ctx, GLenum mode);
>     /** OpenGL 2.0 two-sided StencilFunc */
> @@ -541,7 +544,8 @@ 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, GLuint idx,
> +                    GLint x, GLint y, GLsizei w, GLsizei h);
>     /*@}*/
>
>
> diff --git a/src/mesa/main/scissor.c b/src/mesa/main/scissor.c
> index 0eddaa6..4eb6337 100644
> --- a/src/mesa/main/scissor.c
> +++ b/src/mesa/main/scissor.c
> @@ -79,7 +79,7 @@ _mesa_set_scissor(struct gl_context *ctx,
>     ctx->Scissor.Height = height;
>
>     if (ctx->Driver.Scissor)
> -      ctx->Driver.Scissor( ctx, x, y, width, height );
> +      ctx->Driver.Scissor( ctx, 0, x, y, width, height );
>  }
>
>
> diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
> index 91578ba..5da10ba 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, 0, x, y, width, height);
>     }
>  }
>
> @@ -143,7 +143,7 @@ _mesa_DepthRange(GLclampd nearval, GLclampd farval)
>  #endif
>
>     if (ctx->Driver.DepthRange) {
> -      ctx->Driver.DepthRange(ctx, nearval, farval);
> +      ctx->Driver.DepthRange(ctx, 0, nearval, farval);
>     }
>  }
>
> diff --git a/src/mesa/state_tracker/st_cb_viewport.c b/src/mesa/state_tracker/st_cb_viewport.c
> index d654ed6..d48127e 100644
> --- a/src/mesa/state_tracker/st_cb_viewport.c
> +++ b/src/mesa/state_tracker/st_cb_viewport.c
> @@ -48,7 +48,8 @@ st_ws_framebuffer(struct gl_framebuffer *fb)
>     return NULL;
>  }
>
> -static void st_viewport(struct gl_context * ctx, GLint x, GLint y,
> +static void st_viewport(struct gl_context * ctx, GLuint idx,
> +                        GLint x, GLint y,
>                          GLsizei width, GLsizei height)
>  {
>     struct st_context *st = ctx->st;
> --
> 1.8.1.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list