Module: Mesa Branch: main Commit: b6710b6549c2c9c27df02cb46b1faa47b0705237 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b6710b6549c2c9c27df02cb46b1faa47b0705237
Author: Dave Airlie <[email protected]> Date: Fri Dec 10 04:52:37 2021 +1000 mesa/st: merge condrender code from st into mesa. This merges conditional render code from state tracker into mesa. Acked-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14327> --- src/mesa/main/condrender.c | 66 ++++++++++++++++++- src/mesa/meson.build | 2 - src/mesa/state_tracker/st_cb_condrender.c | 104 ------------------------------ src/mesa/state_tracker/st_cb_condrender.h | 35 ---------- src/mesa/state_tracker/st_context.c | 1 - 5 files changed, 63 insertions(+), 145 deletions(-) diff --git a/src/mesa/main/condrender.c b/src/mesa/main/condrender.c index db4fde33732..9489aac3cee 100644 --- a/src/mesa/main/condrender.c +++ b/src/mesa/main/condrender.c @@ -36,8 +36,68 @@ #include "mtypes.h" #include "queryobj.h" -#include "state_tracker/st_cb_condrender.h" #include "api_exec_decl.h" +#include "state_tracker/st_cb_bitmap.h" +#include "state_tracker/st_context.h" + +static void +BeginConditionalRender(struct gl_context *ctx, struct gl_query_object *q, + GLenum mode) +{ + struct st_context *st = st_context(ctx); + uint m; + /* Don't invert the condition for rendering by default */ + boolean inverted = FALSE; + + st_flush_bitmap_cache(st); + + switch (mode) { + case GL_QUERY_WAIT: + m = PIPE_RENDER_COND_WAIT; + break; + case GL_QUERY_NO_WAIT: + m = PIPE_RENDER_COND_NO_WAIT; + break; + case GL_QUERY_BY_REGION_WAIT: + m = PIPE_RENDER_COND_BY_REGION_WAIT; + break; + case GL_QUERY_BY_REGION_NO_WAIT: + m = PIPE_RENDER_COND_BY_REGION_NO_WAIT; + break; + case GL_QUERY_WAIT_INVERTED: + m = PIPE_RENDER_COND_WAIT; + inverted = TRUE; + break; + case GL_QUERY_NO_WAIT_INVERTED: + m = PIPE_RENDER_COND_NO_WAIT; + inverted = TRUE; + break; + case GL_QUERY_BY_REGION_WAIT_INVERTED: + m = PIPE_RENDER_COND_BY_REGION_WAIT; + inverted = TRUE; + break; + case GL_QUERY_BY_REGION_NO_WAIT_INVERTED: + m = PIPE_RENDER_COND_BY_REGION_NO_WAIT; + inverted = TRUE; + break; + default: + assert(0 && "bad mode in st_BeginConditionalRender"); + m = PIPE_RENDER_COND_WAIT; + } + + cso_set_render_condition(st->cso_context, q->pq, inverted, m); +} + +static void +EndConditionalRender(struct gl_context *ctx, struct gl_query_object *q) +{ + struct st_context *st = st_context(ctx); + (void) q; + + st_flush_bitmap_cache(st); + + cso_set_render_condition(st->cso_context, NULL, FALSE, 0); +} static ALWAYS_INLINE void begin_conditional_render(struct gl_context *ctx, GLuint queryId, GLenum mode, @@ -101,7 +161,7 @@ begin_conditional_render(struct gl_context *ctx, GLuint queryId, GLenum mode, ctx->Query.CondRenderQuery = q; ctx->Query.CondRenderMode = mode; - st_BeginConditionalRender(ctx, q, mode); + BeginConditionalRender(ctx, q, mode); } @@ -139,7 +199,7 @@ end_conditional_render(struct gl_context *ctx) { FLUSH_VERTICES(ctx, 0, 0); - st_EndConditionalRender(ctx, ctx->Query.CondRenderQuery); + EndConditionalRender(ctx, ctx->Query.CondRenderQuery); ctx->Query.CondRenderQuery = NULL; ctx->Query.CondRenderMode = GL_NONE; diff --git a/src/mesa/meson.build b/src/mesa/meson.build index 23af754f499..d7db0842b79 100644 --- a/src/mesa/meson.build +++ b/src/mesa/meson.build @@ -327,8 +327,6 @@ files_libmesa = files( 'state_tracker/st_cb_blit.h', 'state_tracker/st_cb_clear.c', 'state_tracker/st_cb_clear.h', - 'state_tracker/st_cb_condrender.c', - 'state_tracker/st_cb_condrender.h', 'state_tracker/st_cb_copyimage.c', 'state_tracker/st_cb_copyimage.h', 'state_tracker/st_cb_drawpixels.c', diff --git a/src/mesa/state_tracker/st_cb_condrender.c b/src/mesa/state_tracker/st_cb_condrender.c deleted file mode 100644 index ed93ec81198..00000000000 --- a/src/mesa/state_tracker/st_cb_condrender.c +++ /dev/null @@ -1,104 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -/** - * glBegin/EndCondtionalRender functions - * - * \author Brian Paul - */ - - - -#include "main/context.h" - -#include "pipe/p_context.h" -#include "pipe/p_defines.h" -#include "cso_cache/cso_context.h" -#include "st_context.h" -#include "st_cb_condrender.h" -#include "st_cb_bitmap.h" - - -void -st_BeginConditionalRender(struct gl_context *ctx, struct gl_query_object *q, - GLenum mode) -{ - struct st_context *st = st_context(ctx); - uint m; - /* Don't invert the condition for rendering by default */ - boolean inverted = FALSE; - - st_flush_bitmap_cache(st); - - switch (mode) { - case GL_QUERY_WAIT: - m = PIPE_RENDER_COND_WAIT; - break; - case GL_QUERY_NO_WAIT: - m = PIPE_RENDER_COND_NO_WAIT; - break; - case GL_QUERY_BY_REGION_WAIT: - m = PIPE_RENDER_COND_BY_REGION_WAIT; - break; - case GL_QUERY_BY_REGION_NO_WAIT: - m = PIPE_RENDER_COND_BY_REGION_NO_WAIT; - break; - case GL_QUERY_WAIT_INVERTED: - m = PIPE_RENDER_COND_WAIT; - inverted = TRUE; - break; - case GL_QUERY_NO_WAIT_INVERTED: - m = PIPE_RENDER_COND_NO_WAIT; - inverted = TRUE; - break; - case GL_QUERY_BY_REGION_WAIT_INVERTED: - m = PIPE_RENDER_COND_BY_REGION_WAIT; - inverted = TRUE; - break; - case GL_QUERY_BY_REGION_NO_WAIT_INVERTED: - m = PIPE_RENDER_COND_BY_REGION_NO_WAIT; - inverted = TRUE; - break; - default: - assert(0 && "bad mode in st_BeginConditionalRender"); - m = PIPE_RENDER_COND_WAIT; - } - - cso_set_render_condition(st->cso_context, q->pq, inverted, m); -} - -void -st_EndConditionalRender(struct gl_context *ctx, struct gl_query_object *q) -{ - struct st_context *st = st_context(ctx); - (void) q; - - st_flush_bitmap_cache(st); - - cso_set_render_condition(st->cso_context, NULL, FALSE, 0); -} diff --git a/src/mesa/state_tracker/st_cb_condrender.h b/src/mesa/state_tracker/st_cb_condrender.h deleted file mode 100644 index 2a4e8e8355f..00000000000 --- a/src/mesa/state_tracker/st_cb_condrender.h +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef ST_CB_CONDRENDER_H -#define ST_CB_CONDRENDER_H - -void st_BeginConditionalRender(struct gl_context *ctx, struct gl_query_object *q, - GLenum mode); -void st_EndConditionalRender(struct gl_context *ctx, struct gl_query_object *q); - -#endif diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index b477015be3b..674c436484f 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -42,7 +42,6 @@ #include "st_debug.h" #include "st_cb_bitmap.h" #include "st_cb_clear.h" -#include "st_cb_condrender.h" #include "st_cb_drawpixels.h" #include "st_cb_drawtex.h" #include "st_cb_eglimage.h"
