mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-04 00:08:16 +02:00
mesa/st: remove redundant has_shareable_shaders from st_context
has_shareable_shaders is a direct copy of screen->caps.shareable_shaders. Read the cap from the screen directly at each call site. Fix st_format_test which was missing st_context.screen initialization, exposed by this change. Reviewed-by: Marek Olšák <maraeo@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41184>
This commit is contained in:
parent
91e4c9e33b
commit
a080330b94
7 changed files with 18 additions and 19 deletions
|
|
@ -133,7 +133,7 @@ st_update_fp( struct st_context *st )
|
|||
/* use memset, not an initializer to be sure all memory is zeroed */
|
||||
memset(&key, 0, sizeof(key));
|
||||
|
||||
key.st = st->has_shareable_shaders ? NULL : st;
|
||||
key.st = st->screen->caps.shareable_shaders ? NULL : st;
|
||||
|
||||
key.lower_flatshade = st->lower_flatshade &&
|
||||
st->ctx->Light.ShadeModel == GL_FLAT;
|
||||
|
|
@ -219,7 +219,7 @@ st_update_vp( struct st_context *st )
|
|||
|
||||
memset(&key, 0, sizeof(key));
|
||||
|
||||
key.st = st->has_shareable_shaders ? NULL : st;
|
||||
key.st = st->screen->caps.shareable_shaders ? NULL : st;
|
||||
|
||||
/* When this is true, we will add an extra input to the vertex
|
||||
* shader translation (for edgeflags), an extra output with
|
||||
|
|
@ -280,7 +280,7 @@ st_update_common_program(struct st_context *st, struct gl_program *prog,
|
|||
/* use memset, not an initializer to be sure all memory is zeroed */
|
||||
memset(&key, 0, sizeof(key));
|
||||
|
||||
key.st = st->has_shareable_shaders ? NULL : st;
|
||||
key.st = st->screen->caps.shareable_shaders ? NULL : st;
|
||||
|
||||
if (pipe_shader == MESA_SHADER_GEOMETRY ||
|
||||
pipe_shader == MESA_SHADER_TESS_EVAL) {
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ setup_render_state(struct gl_context *ctx,
|
|||
struct st_fp_variant_key key;
|
||||
|
||||
memset(&key, 0, sizeof(key));
|
||||
key.st = st->has_shareable_shaders ? NULL : st;
|
||||
key.st = st->screen->caps.shareable_shaders ? NULL : st;
|
||||
key.bitmap = GL_TRUE;
|
||||
key.clamp_color = st->clamp_frag_color_in_shader &&
|
||||
clamp_frag_color;
|
||||
|
|
|
|||
|
|
@ -1124,7 +1124,7 @@ get_color_fp_variant(struct st_context *st)
|
|||
|
||||
memset(&key, 0, sizeof(key));
|
||||
|
||||
key.st = st->has_shareable_shaders ? NULL : st;
|
||||
key.st = st->screen->caps.shareable_shaders ? NULL : st;
|
||||
key.drawpixels = 1;
|
||||
key.scaleAndBias = (ctx->Pixel.RedBias != 0.0 ||
|
||||
ctx->Pixel.RedScale != 1.0 ||
|
||||
|
|
@ -1157,7 +1157,7 @@ get_color_index_fp_variant(struct st_context *st)
|
|||
|
||||
memset(&key, 0, sizeof(key));
|
||||
|
||||
key.st = st->has_shareable_shaders ? NULL : st;
|
||||
key.st = st->screen->caps.shareable_shaders ? NULL : st;
|
||||
key.drawpixels = 1;
|
||||
/* Since GL is always in RGBA mode MapColorFlag does not
|
||||
* affect GL_COLOR_INDEX format.
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ st_save_zombie_shader(struct st_context *st,
|
|||
struct st_zombie_shader_node *entry;
|
||||
|
||||
/* we shouldn't be here if the driver supports shareable shaders */
|
||||
assert(!st->has_shareable_shaders);
|
||||
assert(!st->screen->caps.shareable_shaders);
|
||||
|
||||
entry = MALLOC_STRUCT(st_zombie_shader_node);
|
||||
if (!entry)
|
||||
|
|
@ -571,7 +571,6 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
|
|||
st->force_persample_in_shader =
|
||||
screen->caps.sample_shading &&
|
||||
!screen->caps.force_persample_interp;
|
||||
st->has_shareable_shaders = screen->caps.shareable_shaders;
|
||||
st->needs_texcoord_semantic =
|
||||
screen->caps.tgsi_texcoord;
|
||||
st->apply_texture_swizzle_to_border_color =
|
||||
|
|
@ -699,32 +698,32 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
|
|||
|
||||
/* Set which shader types can be compiled at link time. */
|
||||
st->shader_has_one_variant[MESA_SHADER_VERTEX] =
|
||||
st->has_shareable_shaders &&
|
||||
st->screen->caps.shareable_shaders &&
|
||||
!st->clamp_vert_color_in_shader &&
|
||||
!st->lower_point_size &&
|
||||
(is_gles2 || !st->lower_ucp);
|
||||
|
||||
st->shader_has_one_variant[MESA_SHADER_FRAGMENT] =
|
||||
st->has_shareable_shaders &&
|
||||
st->screen->caps.shareable_shaders &&
|
||||
!st->lower_flatshade &&
|
||||
(is_gles2 || !st->lower_alpha_test) &&
|
||||
!st->clamp_frag_color_in_shader &&
|
||||
!st->force_persample_in_shader &&
|
||||
(is_gles2 || !st->lower_two_sided_color);
|
||||
|
||||
st->shader_has_one_variant[MESA_SHADER_TESS_CTRL] = st->has_shareable_shaders;
|
||||
st->shader_has_one_variant[MESA_SHADER_TESS_CTRL] = st->screen->caps.shareable_shaders;
|
||||
st->shader_has_one_variant[MESA_SHADER_TESS_EVAL] =
|
||||
st->has_shareable_shaders &&
|
||||
st->screen->caps.shareable_shaders &&
|
||||
!st->clamp_vert_color_in_shader &&
|
||||
!st->lower_point_size &&
|
||||
(is_gles2 || !st->lower_ucp);
|
||||
|
||||
st->shader_has_one_variant[MESA_SHADER_GEOMETRY] =
|
||||
st->has_shareable_shaders &&
|
||||
st->screen->caps.shareable_shaders &&
|
||||
!st->clamp_vert_color_in_shader &&
|
||||
!st->lower_point_size &&
|
||||
(is_gles2 || !st->lower_ucp);
|
||||
st->shader_has_one_variant[MESA_SHADER_COMPUTE] = st->has_shareable_shaders;
|
||||
st->shader_has_one_variant[MESA_SHADER_COMPUTE] = st->screen->caps.shareable_shaders;
|
||||
|
||||
if (!st->pipe->set_context_param || !util_thread_scheduler_enabled())
|
||||
st->thread_scheduler_disabled = true;
|
||||
|
|
|
|||
|
|
@ -160,7 +160,6 @@ struct st_context
|
|||
bool force_compute_based_texture_transfer;
|
||||
bool force_specialized_compute_transfer;
|
||||
bool force_persample_in_shader;
|
||||
bool has_shareable_shaders;
|
||||
bool has_multi_draw_indirect;
|
||||
bool has_indirect_partial_stride;
|
||||
bool has_occlusion_query;
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ delete_variant(struct st_context *st, struct st_variant *v, unsigned stage)
|
|||
((struct st_common_variant*)v)->key.is_draw_shader) {
|
||||
/* Draw shader. */
|
||||
draw_delete_vertex_shader(st->draw, v->driver_shader);
|
||||
} else if (st->has_shareable_shaders || v->st == st) {
|
||||
} else if (st->screen->caps.shareable_shaders || v->st == st) {
|
||||
/* The shader's context matches the calling context, or we
|
||||
* don't care.
|
||||
*/
|
||||
|
|
@ -1424,7 +1424,7 @@ st_destroy_program_variants(struct st_context *st)
|
|||
/* If shaders can be shared with other contexts, the last context will
|
||||
* call DeleteProgram on all shaders, releasing everything.
|
||||
*/
|
||||
if (st->has_shareable_shaders)
|
||||
if (st->screen->caps.shareable_shaders)
|
||||
return;
|
||||
|
||||
/* ARB vert/frag program */
|
||||
|
|
@ -1467,7 +1467,7 @@ st_precompile_shader_variant(struct st_context *st,
|
|||
key.clamp_color = true;
|
||||
}
|
||||
|
||||
key.st = st->has_shareable_shaders ? NULL : st;
|
||||
key.st = st->screen->caps.shareable_shaders ? NULL : st;
|
||||
st_get_common_variant(st, prog, &key, report_compile_error, &error);
|
||||
return error;
|
||||
}
|
||||
|
|
@ -1477,7 +1477,7 @@ st_precompile_shader_variant(struct st_context *st,
|
|||
|
||||
memset(&key, 0, sizeof(key));
|
||||
|
||||
key.st = st->has_shareable_shaders ? NULL : st;
|
||||
key.st = st->screen->caps.shareable_shaders ? NULL : st;
|
||||
key.lower_alpha_func = COMPARE_FUNC_ALWAYS;
|
||||
if (prog->ati_fs) {
|
||||
for (int i = 0; i < ARRAY_SIZE(key.texture_index); i++)
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ int main(int argc, char **argv)
|
|||
};
|
||||
struct st_context local_st = {
|
||||
.pipe = &pctx,
|
||||
.screen = &screen,
|
||||
.has_etc1 = true,
|
||||
.has_etc2 = true,
|
||||
.has_astc_2d_ldr = true,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue