From 81eae719363dfdb958bc2389c9f6cf0decf61aeb Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 7 Dec 2021 11:48:58 +1000 Subject: [PATCH] mesa/st: move viewport to direct call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Acked-by: Marek Olšák Part-of: --- src/mesa/main/attrib.c | 4 ++-- src/mesa/main/dd.h | 15 --------------- src/mesa/main/viewport.c | 11 +++++------ src/mesa/state_tracker/st_cb_viewport.c | 8 +------- src/mesa/state_tracker/st_cb_viewport.h | 5 +---- src/mesa/state_tracker/st_context.c | 2 -- 6 files changed, 9 insertions(+), 36 deletions(-) diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index ed9dc52b9a9..0c147b2e1d3 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -63,6 +63,7 @@ #include "util/u_memory.h" #include "state_tracker/st_cb_texture.h" +#include "state_tracker/st_cb_viewport.h" static inline bool copy_texture_attribs(struct gl_texture_object *dst, @@ -1100,8 +1101,7 @@ _mesa_PopAttrib(void) memcpy(&ctx->ViewportArray[i].X, &vp->X, sizeof(float) * 6); - if (ctx->Driver.Viewport) - ctx->Driver.Viewport(ctx); + st_viewport(ctx); } } diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 5616a07758a..b7fcf32e08f 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -319,21 +319,6 @@ struct dd_function_table { struct gl_buffer_object *indexbuf, uint32_t enabled_attribs); - /** - * \name State-changing functions. - * - * \note drawing functions are above. - * - * These functions are called by their corresponding OpenGL API functions. - * They are \e also called by the gl_PopAttrib() function!!! - * May add more functions like these to the device driver in the future. - */ - /*@{*/ - /** Set the viewport */ - void (*Viewport)(struct gl_context *ctx); - /*@}*/ - - /** * \name Vertex/pixel buffer object functions */ diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c index 7deefcbec0d..c3778501130 100644 --- a/src/mesa/main/viewport.c +++ b/src/mesa/main/viewport.c @@ -35,6 +35,8 @@ #include "mtypes.h" #include "viewport.h" +#include "state_tracker/st_cb_viewport.h" + static void clamp_viewport(struct gl_context *ctx, GLfloat *x, GLfloat *y, GLfloat *width, GLfloat *height) @@ -113,8 +115,7 @@ viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width, for (unsigned i = 0; i < ctx->Const.MaxViewports; i++) set_viewport_no_notify(ctx, i, input.X, input.Y, input.Width, input.Height); - if (ctx->Driver.Viewport) - ctx->Driver.Viewport(ctx); + st_viewport(ctx); } /** @@ -166,8 +167,7 @@ _mesa_set_viewport(struct gl_context *ctx, unsigned idx, GLfloat x, GLfloat y, clamp_viewport(ctx, &x, &y, &width, &height); set_viewport_no_notify(ctx, idx, x, y, width, height); - if (ctx->Driver.Viewport) - ctx->Driver.Viewport(ctx); + st_viewport(ctx); } static void @@ -182,8 +182,7 @@ viewport_array(struct gl_context *ctx, GLuint first, GLsizei count, inputs[i].Width, inputs[i].Height); } - if (ctx->Driver.Viewport) - ctx->Driver.Viewport(ctx); + st_viewport(ctx); } void GLAPIENTRY diff --git a/src/mesa/state_tracker/st_cb_viewport.c b/src/mesa/state_tracker/st_cb_viewport.c index 315564b6fca..b4596ab0fc3 100644 --- a/src/mesa/state_tracker/st_cb_viewport.c +++ b/src/mesa/state_tracker/st_cb_viewport.c @@ -34,8 +34,7 @@ #include "pipe/p_defines.h" #include "util/u_atomic.h" - -static void st_viewport(struct gl_context *ctx) +void st_viewport(struct gl_context *ctx) { struct st_context *st = ctx->st; struct st_framebuffer *stdraw; @@ -59,8 +58,3 @@ static void st_viewport(struct gl_context *ctx) if (stread && stread != stdraw) stread->iface_stamp = p_atomic_read(&stread->iface->stamp) - 1; } - -void st_init_viewport_functions(struct dd_function_table *functions) -{ - functions->Viewport = st_viewport; -} diff --git a/src/mesa/state_tracker/st_cb_viewport.h b/src/mesa/state_tracker/st_cb_viewport.h index 56e435c630c..2f8b829d468 100644 --- a/src/mesa/state_tracker/st_cb_viewport.h +++ b/src/mesa/state_tracker/st_cb_viewport.h @@ -28,9 +28,6 @@ #ifndef ST_CB_VIEWPORT_H #define ST_CB_VIEWPORT_H -struct dd_function_table; - -extern void -st_init_viewport_functions(struct dd_function_table *functions); +void st_viewport(struct gl_context *ctx); #endif /* ST_CB_VIEW_PORT_H */ diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index d9e5c82b610..4d78525304b 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -59,7 +59,6 @@ #include "st_cb_program.h" #include "st_cb_queryobj.h" #include "st_cb_flush.h" -#include "st_cb_viewport.h" #include "st_atom.h" #include "st_draw.h" #include "st_extensions.h" @@ -934,7 +933,6 @@ st_init_driver_functions(struct pipe_screen *screen, st_init_msaa_functions(functions); st_init_program_functions(functions); st_init_flush_functions(screen, functions); - st_init_viewport_functions(functions); st_init_compute_functions(functions); st_init_vdpau_functions(functions);