Another option would be to provide (no-op) implementations for all drivers. But I think generally we indeed check if the function is available in the state tracker before calling it for such things.
Roland Am 23.06.2015 um 06:11 schrieb Ilia Mirkin: > This needs to be guarded on availability of tessellation. I'm guessing > that something ends up setting st.dirty to ~0, and this gets called > even when the driver doesn't support tess. Just hit this playing back > a trace with llvmpipe but with the tess patches: > > #1 0x00007ffff37dcf49 in update_tess (st=0x7fffe8116530) > at state_tracker/st_atom_tess.c:46 > #2 0x00007ffff37d7afb in st_validate_state (st=0x7fffe8116530) > at state_tracker/st_atom.c:223 > #3 0x00007ffff37e4291 in st_Clear (ctx=0x7fffe80e1f10, mask=2) > at state_tracker/st_cb_clear.c:469 > #4 0x00007ffff35f5c48 in _mesa_Clear (mask=16384) at main/clear.c:224 > #5 0x00007ffff57ec452 in glClear (mask=16384) at glapi/glapi_mapi_tmp.h:3064 > #6 0x00000000004d4c0f in retrace_glClear(trace::Call&) () > #7 0x000000000040f488 in retrace::Retracer::retrace(trace::Call&) () > > On Tue, Jun 16, 2015 at 7:04 PM, Marek Olšák <mar...@gmail.com> wrote: >> From: Marek Olšák <marek.ol...@amd.com> >> >> --- >> src/mesa/Makefile.sources | 1 + >> src/mesa/state_tracker/st_atom.c | 1 + >> src/mesa/state_tracker/st_atom.h | 1 + >> src/mesa/state_tracker/st_atom_tess.c | 59 >> +++++++++++++++++++++++++++++++++++ >> src/mesa/state_tracker/st_context.c | 1 + >> src/mesa/state_tracker/st_context.h | 2 +- >> 6 files changed, 64 insertions(+), 1 deletion(-) >> create mode 100644 src/mesa/state_tracker/st_atom_tess.c >> >> diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources >> index 83f500f..ed9848c 100644 >> --- a/src/mesa/Makefile.sources >> +++ b/src/mesa/Makefile.sources >> @@ -407,6 +407,7 @@ STATETRACKER_FILES = \ >> state_tracker/st_atom_shader.c \ >> state_tracker/st_atom_shader.h \ >> state_tracker/st_atom_stipple.c \ >> + state_tracker/st_atom_tess.c \ >> state_tracker/st_atom_texture.c \ >> state_tracker/st_atom_viewport.c \ >> state_tracker/st_cache.h \ >> diff --git a/src/mesa/state_tracker/st_atom.c >> b/src/mesa/state_tracker/st_atom.c >> index c97cd84..5fc1a77 100644 >> --- a/src/mesa/state_tracker/st_atom.c >> +++ b/src/mesa/state_tracker/st_atom.c >> @@ -78,6 +78,7 @@ static const struct st_tracked_state *atoms[] = >> &st_bind_fs_ubos, >> &st_bind_gs_ubos, >> &st_update_pixel_transfer, >> + &st_update_tess, >> >> /* this must be done after the vertex program update */ >> &st_update_array >> diff --git a/src/mesa/state_tracker/st_atom.h >> b/src/mesa/state_tracker/st_atom.h >> index bbfbd2d..5735ca6 100644 >> --- a/src/mesa/state_tracker/st_atom.h >> +++ b/src/mesa/state_tracker/st_atom.h >> @@ -80,6 +80,7 @@ extern const struct st_tracked_state st_bind_gs_ubos; >> extern const struct st_tracked_state st_bind_tcs_ubos; >> extern const struct st_tracked_state st_bind_tes_ubos; >> extern const struct st_tracked_state st_update_pixel_transfer; >> +extern const struct st_tracked_state st_update_tess; >> >> >> GLuint st_compare_func_to_pipe(GLenum func); >> diff --git a/src/mesa/state_tracker/st_atom_tess.c >> b/src/mesa/state_tracker/st_atom_tess.c >> new file mode 100644 >> index 0000000..f3aaaae >> --- /dev/null >> +++ b/src/mesa/state_tracker/st_atom_tess.c >> @@ -0,0 +1,59 @@ >> +/************************************************************************** >> + * >> + * Copyright 2015 Advanced Micro Devices, 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. >> + * >> + **************************************************************************/ >> + >> +/* >> + * Authors: >> + * Marek Olšák <mar...@gmail.com> >> + */ >> + >> + >> +#include "main/macros.h" >> +#include "st_context.h" >> +#include "pipe/p_context.h" >> +#include "st_atom.h" >> + >> + >> +static void >> +update_tess(struct st_context *st) >> +{ >> + const struct gl_context *ctx = st->ctx; >> + struct pipe_context *pipe = st->pipe; >> + >> + pipe->set_tess_state(pipe, >> + ctx->TessCtrlProgram.patch_default_outer_level, >> + ctx->TessCtrlProgram.patch_default_inner_level); >> +} >> + >> + >> +const struct st_tracked_state st_update_tess = { >> + "update_tess", /* name */ >> + { /* dirty */ >> + 0, /* mesa */ >> + ST_NEW_TESS_STATE, /* st */ >> + }, >> + update_tess /* update */ >> +}; >> diff --git a/src/mesa/state_tracker/st_context.c >> b/src/mesa/state_tracker/st_context.c >> index ef4ad1b..06280bc 100644 >> --- a/src/mesa/state_tracker/st_context.c >> +++ b/src/mesa/state_tracker/st_context.c >> @@ -308,6 +308,7 @@ static void st_init_driver_flags(struct gl_driver_flags >> *f) >> f->NewArray = ST_NEW_VERTEX_ARRAYS; >> f->NewRasterizerDiscard = ST_NEW_RASTERIZER; >> f->NewUniformBuffer = ST_NEW_UNIFORM_BUFFER; >> + f->NewDefaultTessLevels = ST_NEW_TESS_STATE; >> } >> >> struct st_context *st_create_context(gl_api api, struct pipe_context *pipe, >> diff --git a/src/mesa/state_tracker/st_context.h >> b/src/mesa/state_tracker/st_context.h >> index 3010727..8183412 100644 >> --- a/src/mesa/state_tracker/st_context.h >> +++ b/src/mesa/state_tracker/st_context.h >> @@ -53,7 +53,7 @@ struct u_upload_mgr; >> #define ST_NEW_FRAGMENT_PROGRAM (1 << 1) >> #define ST_NEW_VERTEX_PROGRAM (1 << 2) >> #define ST_NEW_FRAMEBUFFER (1 << 3) >> -/* gap, re-use it */ >> +#define ST_NEW_TESS_STATE (1 << 4) >> #define ST_NEW_GEOMETRY_PROGRAM (1 << 5) >> #define ST_NEW_VERTEX_ARRAYS (1 << 6) >> #define ST_NEW_RASTERIZER (1 << 7) >> -- >> 2.1.0 >> >> _______________________________________________ >> mesa-dev mailing list >> mesa-dev@lists.freedesktop.org >> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=Vnpp8mi3-mnjZlyydXaJcmHBVA0UulSpJvSzL-WSARo&s=let7qdX4x6EzIvxABUGqFVNg-rGEsWaeodjI_q7Q8Qw&e= >> > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=Vnpp8mi3-mnjZlyydXaJcmHBVA0UulSpJvSzL-WSARo&s=let7qdX4x6EzIvxABUGqFVNg-rGEsWaeodjI_q7Q8Qw&e= > > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev