X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fstate_tracker%2Fst_context.h;h=31539d9db7d5cf0da69e40958d736c608a005503;hb=6fe20ebaaa933ddd17b655e61ba3fe3d358b8513;hp=1106bb628a38c5f901d019e8bb70bb66b0311f2e;hpb=593e36f9561d3665cc12ed1fc8a07dd8612c004e;p=mesa.git diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 1106bb628a3..31539d9db7d 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -30,7 +30,7 @@ #include "main/arrayobj.h" #include "main/mtypes.h" -#include "state_tracker/st_api.h" +#include "frontend/api.h" #include "main/fbobject.h" #include "state_tracker/st_atom.h" #include "util/u_helpers.h" @@ -38,6 +38,7 @@ #include "util/list.h" #include "vbo/vbo.h" #include "util/list.h" +#include "cso_cache/cso_context.h" #ifdef __cplusplus @@ -50,7 +51,7 @@ struct draw_context; struct draw_stage; struct gen_mipmap_state; struct st_context; -struct st_fragment_program; +struct st_program; struct st_perf_monitor_group; struct u_upload_mgr; @@ -106,6 +107,17 @@ struct st_zombie_sampler_view_node }; +/* + * Node for a linked list of dead shaders. + */ +struct st_zombie_shader_node +{ + void *shader; + enum pipe_shader_type type; + struct list_head node; +}; + + struct st_context { struct st_context_iface iface; @@ -120,12 +132,13 @@ struct st_context struct draw_stage *rastpos_stage; /**< For glRasterPos */ GLboolean clamp_frag_color_in_shader; GLboolean clamp_vert_color_in_shader; + boolean clamp_frag_depth_in_shader; boolean has_stencil_export; /**< can do shader stencil export? */ boolean has_time_elapsed; - boolean has_shader_model3; boolean has_etc1; boolean has_etc2; boolean has_astc_2d_ldr; + boolean has_astc_5x5_ldr; boolean prefer_blit_based_texture_transfer; boolean force_persample_in_shader; boolean has_shareable_shaders; @@ -135,6 +148,22 @@ struct st_context boolean has_indep_blend_func; boolean needs_rgb_dst_alpha_override; boolean can_bind_const_buffer_as_vertex; + boolean lower_flatshade; + boolean lower_alpha_test; + boolean lower_point_size; + boolean lower_two_sided_color; + boolean lower_ucp; + + /* There are consequences for drivers wanting to call st_finalize_nir + * twice, once before shader caching and once after lowering for shader + * variants. If shader variants use lowering passes that are not ready + * for that, things can blow up. + * + * If this is true, st_finalize_nir and pipe_screen::finalize_nir will be + * called before the result is stored in the shader cache. If lowering for + * shader variants is invoked, the functions will be called again. + */ + boolean allow_st_finalize_nir_twice; /** * If a shader can be created when we get its source. @@ -151,9 +180,12 @@ struct st_context */ boolean invalidate_on_gl_viewport; boolean draw_needs_minmax_index; - boolean vertex_array_out_of_memory; boolean has_hw_atomics; + + /* driver supports scissored clears */ + boolean can_scissor_clear; + /* Some state is contained in constant objects. * Other state is just parameter values. */ @@ -161,8 +193,11 @@ struct st_context struct pipe_blend_state blend; struct pipe_depth_stencil_alpha_state depth_stencil; struct pipe_rasterizer_state rasterizer; + struct pipe_sampler_state vert_samplers[PIPE_MAX_SAMPLERS]; struct pipe_sampler_state frag_samplers[PIPE_MAX_SAMPLERS]; + GLuint num_vert_samplers; GLuint num_frag_samplers; + struct pipe_sampler_view *vert_sampler_views[PIPE_MAX_SAMPLERS]; struct pipe_sampler_view *frag_sampler_views[PIPE_MAX_SAMPLERS]; GLuint num_sampler_views[PIPE_SHADER_TYPES]; struct pipe_clip_state clip; @@ -211,14 +246,25 @@ struct st_context GLboolean vertdata_edgeflags; GLboolean edgeflag_culls_prims; - struct st_vertex_program *vp; /**< Currently bound vertex program */ - struct st_fragment_program *fp; /**< Currently bound fragment program */ - struct st_common_program *gp; /**< Currently bound geometry program */ - struct st_common_program *tcp; /**< Currently bound tess control program */ - struct st_common_program *tep; /**< Currently bound tess eval program */ - struct st_compute_program *cp; /**< Currently bound compute program */ + /** + * The number of currently active queries (excluding timer queries). + * This is used to know if we need to pause any queries for meta ops. + */ + unsigned active_queries; - struct st_vp_variant *vp_variant; + union { + struct { + struct st_program *vp; /**< Currently bound vertex program */ + struct st_program *tcp; /**< Currently bound tess control program */ + struct st_program *tep; /**< Currently bound tess eval program */ + struct st_program *gp; /**< Currently bound geometry program */ + struct st_program *fp; /**< Currently bound fragment program */ + struct st_program *cp; /**< Currently bound compute program */ + }; + struct gl_program *current_program[MESA_SHADER_STAGES]; + }; + + struct st_common_variant *vp_variant; struct { struct pipe_resource *pixelmap_texture; @@ -281,7 +327,7 @@ struct st_context } pbo; /** for drawing with st_util_vertex */ - struct pipe_vertex_element util_velems[3]; + struct cso_velems_state util_velems; /** passthrough vertex shader matching the util_velem attributes */ void *passthrough_vs; @@ -295,6 +341,9 @@ struct st_context /* The number of vertex buffers from the last call of validate_arrays. */ unsigned last_num_vbuffers; + unsigned last_used_atomic_bindings[PIPE_SHADER_TYPES]; + unsigned last_num_ssbos[PIPE_SHADER_TYPES]; + int32_t draw_stamp; int32_t read_stamp; @@ -320,8 +369,14 @@ struct st_context struct { struct st_zombie_sampler_view_node list; - mtx_t mutex; + simple_mtx_t mutex; } zombie_sampler_views; + + struct { + struct st_zombie_shader_node list; + simple_mtx_t mutex; + } zombie_shaders; + }; @@ -354,6 +409,12 @@ extern void st_save_zombie_sampler_view(struct st_context *st, struct pipe_sampler_view *view); +extern void +st_save_zombie_shader(struct st_context *st, + enum pipe_shader_type type, + struct pipe_shader_state *shader); + + void st_context_free_zombie_objects(struct st_context *st);