Lines Matching refs:st
104 st_invalidate_buffers(struct st_context *st)
106 st->dirty |= ST_NEW_BLEND |
132 struct st_context *st = st_context(ctx);
135 st_invalidate_buffers(st);
141 st->dirty |= ST_NEW_RASTERIZER;
144 st->dirty |= ST_NEW_FS_STATE;
149 st->dirty |= ST_NEW_RASTERIZER;
152 (st->lower_flatshade || st->lower_two_sided_color))
153 st->dirty |= ST_NEW_FS_STATE;
157 st->dirty |= ST_NEW_CLIP_STATE;
159 if (new_state & _NEW_POINT && st->lower_texcoord_replace)
160 st->dirty |= ST_NEW_FS_STATE;
163 st->dirty |= ST_NEW_PIXEL_TRANSFER;
166 st->dirty |= ST_NEW_VERTEX_ARRAYS;
172 if (st->clamp_vert_color_in_shader && (new_state & _NEW_LIGHT_STATE)) {
173 st->dirty |= ST_NEW_VS_STATE;
174 if (st->ctx->API == API_OPENGL_COMPAT && ctx->Version >= 32) {
175 st->dirty |= ST_NEW_GS_STATE | ST_NEW_TES_STATE;
180 if (st->lower_point_size && new_state & _NEW_POINT) {
182 st->dirty |= ST_NEW_GS_STATE | ST_NEW_GS_CONSTANTS;
184 st->dirty |= ST_NEW_TES_STATE | ST_NEW_TES_CONSTANTS;
186 st->dirty |= ST_NEW_VS_STATE | ST_NEW_VS_CONSTANTS;
191 st->gfx_shaders_may_be_dirty = true;
192 st->compute_shader_may_be_dirty = true;
194 st->active_states = st_get_active_states(ctx);
198 st->dirty |= st->active_states &
206 st->dirty |= ST_NEW_FS_STATE;
222 st_save_zombie_sampler_view(struct st_context *st,
227 assert(view->context == st->pipe);
238 simple_mtx_lock(&st->zombie_sampler_views.mutex);
239 list_addtail(&entry->node, &st->zombie_sampler_views.list.node);
240 simple_mtx_unlock(&st->zombie_sampler_views.mutex);
252 st_save_zombie_shader(struct st_context *st,
259 assert(!st->has_shareable_shaders);
271 simple_mtx_lock(&st->zombie_shaders.mutex);
272 list_addtail(&entry->node, &st->zombie_shaders.list.node);
273 simple_mtx_unlock(&st->zombie_shaders.mutex);
281 free_zombie_sampler_views(struct st_context *st)
285 if (list_is_empty(&st->zombie_sampler_views.list.node)) {
289 simple_mtx_lock(&st->zombie_sampler_views.mutex);
292 &st->zombie_sampler_views.list.node, node) {
295 assert(entry->view->context == st->pipe);
301 assert(list_is_empty(&st->zombie_sampler_views.list.node));
303 simple_mtx_unlock(&st->zombie_sampler_views.mutex);
311 free_zombie_shaders(struct st_context *st)
315 if (list_is_empty(&st->zombie_shaders.list.node)) {
319 simple_mtx_lock(&st->zombie_shaders.mutex);
322 &st->zombie_shaders.list.node, node) {
327 st->pipe->bind_vs_state(st->pipe, NULL);
328 st->pipe->delete_vs_state(st->pipe, entry->shader);
331 st->pipe->bind_fs_state(st->pipe, NULL);
332 st->pipe->delete_fs_state(st->pipe, entry->shader);
335 st->pipe->bind_gs_state(st->pipe, NULL);
336 st->pipe->delete_gs_state(st->pipe, entry->shader);
339 st->pipe->bind_tcs_state(st->pipe, NULL);
340 st->pipe->delete_tcs_state(st->pipe, entry->shader);
343 st->pipe->bind_tes_state(st->pipe, NULL);
344 st->pipe->delete_tes_state(st->pipe, entry->shader);
347 st->pipe->bind_compute_state(st->pipe, NULL);
348 st->pipe->delete_compute_state(st->pipe, entry->shader);
356 assert(list_is_empty(&st->zombie_shaders.list.node));
358 simple_mtx_unlock(&st->zombie_shaders.mutex);
367 st_context_free_zombie_objects(struct st_context *st)
369 free_zombie_sampler_views(st);
370 free_zombie_shaders(st);
375 st_destroy_context_priv(struct st_context *st, bool destroy_pipe)
377 st_destroy_atoms(st);
378 st_destroy_draw(st);
379 st_destroy_clear(st);
380 st_destroy_bitmap(st);
381 st_destroy_drawpix(st);
382 st_destroy_drawtex(st);
383 st_destroy_pbo_helpers(st);
384 st_destroy_bound_texture_handles(st);
385 st_destroy_bound_image_handles(st);
388 st_invalidate_readpix_cache(st);
389 util_throttle_deinit(st->screen, &st->throttle);
391 cso_destroy_context(st->cso_context);
393 if (st->pipe && destroy_pipe)
394 st->pipe->destroy(st->pipe);
396 FREE(st);
401 st_init_driver_flags(struct st_context *st)
403 struct gl_driver_flags *f = &st->ctx->DriverFlags;
406 if (st->has_hw_atomics)
418 if (st->lower_alpha_test)
428 if (st->force_persample_in_shader) {
435 if (st->clamp_frag_color_in_shader) {
442 if (st->lower_ucp)
445 if (st->emulate_gl_clamp)
451 if (!st->has_hw_atomics && st->ctx->Const.ShaderStorageBufferOffsetAlignment > 4)
456 st_have_perfmon(struct st_context *st)
458 struct pipe_screen *screen = st->screen;
484 struct st_context *st = CALLOC_STRUCT( st_context);
486 st->options = *options;
488 ctx->st_opts = &st->options;
489 ctx->st = st;
491 st->ctx = ctx;
492 st->screen = screen;
493 st->pipe = pipe;
494 st->dirty = ST_ALL_STATES_MASK;
496 st->can_bind_const_buffer_as_vertex =
499 /* st/mesa always uploads zero-stride vertex attribs, and other user
519 st->cso_context = cso_create_context(pipe, cso_flags);
520 ctx->cso_context = st->cso_context;
522 st_init_atoms(st);
523 st_init_clear(st);
526 st->prefer_blit_based_texture_transfer = (val & PIPE_TEXTURE_TRANSFER_BLIT) != 0;
527 st->allow_compute_based_texture_transfer = (val & PIPE_TEXTURE_TRANSFER_COMPUTE) != 0;
529 st_init_pbo_helpers(st);
533 st->internal_target = PIPE_TEXTURE_2D;
535 st->internal_target = PIPE_TEXTURE_RECT;
542 memset(&st->util_velems, 0, sizeof(st->util_velems));
543 st->util_velems.velems[0].src_offset = 0;
544 st->util_velems.velems[0].vertex_buffer_index = 0;
545 st->util_velems.velems[0].src_format = PIPE_FORMAT_R32G32B32_FLOAT;
546 st->util_velems.velems[1].src_offset = 3 * sizeof(float);
547 st->util_velems.velems[1].vertex_buffer_index = 0;
548 st->util_velems.velems[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
549 st->util_velems.velems[2].src_offset = 7 * sizeof(float);
550 st->util_velems.velems[2].vertex_buffer_index = 0;
551 st->util_velems.velems[2].src_format = PIPE_FORMAT_R32G32_FLOAT;
562 st->has_stencil_export =
564 st->has_etc1 = screen->is_format_supported(screen, PIPE_FORMAT_ETC1_RGB8,
567 st->has_etc2 = screen->is_format_supported(screen, PIPE_FORMAT_ETC2_RGB8,
570 st->transcode_etc = options->transcode_etc &&
574 st->transcode_astc = options->transcode_astc &&
581 st->has_astc_2d_ldr =
584 st->has_astc_5x5_ldr =
587 st->force_persample_in_shader =
590 st->has_shareable_shaders = screen->get_param(screen,
592 st->needs_texcoord_semantic =
594 st->apply_texture_swizzle_to_border_color =
598 st->use_format_with_border_color =
601 st->emulate_gl_clamp =
603 st->texture_buffer_sampler =
605 st->has_time_elapsed =
607 st->has_half_float_packing =
609 st->has_multi_draw_indirect =
611 st->has_indirect_partial_stride =
613 st->has_single_pipe_stat =
615 st->has_indep_blend_func =
617 st->needs_rgb_dst_alpha_override =
619 st->can_dither =
621 st->lower_flatshade =
623 st->lower_alpha_test =
625 st->lower_point_size =
627 st->lower_two_sided_color =
629 st->lower_ucp =
631 st->prefer_real_buffer_in_constbuf0 =
633 st->has_conditional_render =
635 st->lower_texcoord_replace =
637 st->lower_rect_tex =
639 st->allow_st_finalize_nir_twice = screen->finalize_nir != NULL;
641 st->has_hw_atomics =
646 util_throttle_init(&st->throttle,
653 &ctx->Extensions, &st->options, ctx->API);
655 if (st_have_perfmon(st)) {
659 if (st_have_perfquery(st)) {
666 st->clamp_vert_color_in_shader = GL_TRUE;
670 st->clamp_frag_color_in_shader = GL_TRUE;
677 (st->clamp_frag_color_in_shader || st->clamp_vert_color_in_shader)) {
678 st->clamp_vert_color_in_shader = GL_FALSE;
679 st->clamp_frag_color_in_shader = GL_FALSE;
709 st->shader_has_one_variant[MESA_SHADER_VERTEX] =
710 st->has_shareable_shaders &&
711 !st->clamp_vert_color_in_shader &&
712 !st->lower_point_size &&
713 !st->lower_ucp;
715 st->shader_has_one_variant[MESA_SHADER_FRAGMENT] =
716 st->has_shareable_shaders &&
717 !st->lower_flatshade &&
718 !st->lower_alpha_test &&
719 !st->clamp_frag_color_in_shader &&
720 !st->force_persample_in_shader &&
721 !st->lower_two_sided_color &&
722 !st->lower_texcoord_replace;
724 st->shader_has_one_variant[MESA_SHADER_TESS_CTRL] = st->has_shareable_shaders;
725 st->shader_has_one_variant[MESA_SHADER_TESS_EVAL] =
726 st->has_shareable_shaders &&
727 !st->clamp_vert_color_in_shader &&
728 !st->lower_point_size &&
729 !st->lower_ucp;
731 st->shader_has_one_variant[MESA_SHADER_GEOMETRY] =
732 st->has_shareable_shaders &&
733 !st->clamp_vert_color_in_shader &&
734 !st->lower_point_size &&
735 !st->lower_ucp;
736 st->shader_has_one_variant[MESA_SHADER_COMPUTE] = st->has_shareable_shaders;
739 !st->pipe->set_context_param)
740 st->pin_thread_counter = ST_L3_PINNING_DISABLED;
742 st->bitmap.cache.empty = true;
769 st_destroy_context_priv(st, false);
779 st_init_driver_flags(st);
782 list_inithead(&st->winsys_buffers);
784 list_inithead(&st->zombie_sampler_views.list.node);
785 simple_mtx_init(&st->zombie_sampler_views.mutex, mtx_plain);
786 list_inithead(&st->zombie_shaders.list.node);
787 simple_mtx_init(&st->zombie_shaders.mutex, mtx_plain);
793 return st;
800 struct st_context *st = ctx->st;
802 (struct st_manager *) st->iface.st_context_private;
805 smapi->set_background_context(&st->iface, queue_info);
839 struct st_context *st;
875 st = st_create_context_priv(ctx, pipe, options);
876 if (!st) {
881 return st;
896 struct st_context *st = (struct st_context *) userData;
898 st_texture_release_context_sampler_view(st, texObj);
905 struct st_context *st = (struct st_context *) userData;
910 st_texture_release_context_sampler_view(st, att->Texture);
916 st_destroy_context(struct st_context *st)
918 struct gl_context *ctx = st->ctx;
942 _mesa_HashWalk(ctx->Shared->TexObjects, destroy_tex_sampler_cb, st);
951 st_texture_release_context_sampler_view(st, stObj);
955 st_context_free_zombie_objects(st);
957 simple_mtx_destroy(&st->zombie_sampler_views.mutex);
958 simple_mtx_destroy(&st->zombie_shaders.mutex);
960 st_release_program(st, &st->fp);
961 st_release_program(st, &st->gp);
962 st_release_program(st, &st->vp);
963 st_release_program(st, &st->tcp);
964 st_release_program(st, &st->tep);
965 st_release_program(st, &st->cp);
967 if (st->hw_select_shaders) {
968 hash_table_foreach(st->hw_select_shaders, entry)
969 st->pipe->delete_gs_state(st->pipe, entry->data);
970 _mesa_hash_table_destroy(st->hw_select_shaders, NULL);
974 LIST_FOR_EACH_ENTRY_SAFE_REV(stfb, next, &st->winsys_buffers, head) {
978 _mesa_HashWalk(ctx->Shared->FrameBuffers, destroy_framebuffer_attachment_sampler_cb, st);
980 pipe_sampler_view_reference(&st->pixel_xfer.pixelmap_sampler_view, NULL);
981 pipe_resource_reference(&st->pixel_xfer.pixelmap_texture, NULL);
985 st_destroy_program_variants(st);
993 /* This will free the st_context too, so 'st' must not be accessed
995 st_destroy_context_priv(st, true);
996 st = NULL;
1012 st_get_nir_compiler_options(struct st_context *st, gl_shader_stage stage)
1015 st->ctx->Const.ShaderCompilerOptions[stage].NirOptions;
1020 return nir_to_tgsi_get_compiler_options(st->screen,