Path: blob/21.2-virgl/src/gallium/drivers/llvmpipe/lp_context.h
4570 views
/**************************************************************************1*2* Copyright 2007 VMware, Inc.3* All Rights Reserved.4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the7* "Software"), to deal in the Software without restriction, including8* without limitation the rights to use, copy, modify, merge, publish,9* distribute, sub license, and/or sell copies of the Software, and to10* permit persons to whom the Software is furnished to do so, subject to11* the following conditions:12*13* The above copyright notice and this permission notice (including the14* next paragraph) shall be included in all copies or substantial portions15* of the Software.16*17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS18* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF19* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.20* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR21* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,22* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE23* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.24*25**************************************************************************/2627/* Authors: Keith Whitwell <[email protected]>28*/2930#ifndef LP_CONTEXT_H31#define LP_CONTEXT_H3233#include "pipe/p_context.h"3435#include "draw/draw_vertex.h"36#include "util/u_blitter.h"3738#include "lp_tex_sample.h"39#include "lp_jit.h"40#include "lp_setup.h"41#include "lp_state_fs.h"42#include "lp_state_cs.h"43#include "lp_state_setup.h"444546struct llvmpipe_vbuf_render;47struct draw_context;48struct draw_stage;49struct draw_vertex_shader;50struct lp_fragment_shader;51struct lp_compute_shader;52struct lp_blend_state;53struct lp_setup_context;54struct lp_setup_variant;55struct lp_velems_state;5657struct llvmpipe_context {58struct pipe_context pipe; /**< base class */5960/** Constant state objects */61const struct pipe_blend_state *blend;62struct pipe_sampler_state *samplers[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];6364const struct pipe_depth_stencil_alpha_state *depth_stencil;65const struct pipe_rasterizer_state *rasterizer;66struct lp_fragment_shader *fs;67struct draw_vertex_shader *vs;68const struct lp_geometry_shader *gs;69const struct lp_tess_ctrl_shader *tcs;70const struct lp_tess_eval_shader *tes;71struct lp_compute_shader *cs;72const struct lp_velems_state *velems;73const struct lp_so_state *so;7475/** Other rendering state */76unsigned sample_mask;77unsigned min_samples;78struct pipe_blend_color blend_color;79struct pipe_stencil_ref stencil_ref;80struct pipe_clip_state clip;81struct pipe_constant_buffer constants[PIPE_SHADER_TYPES][LP_MAX_TGSI_CONST_BUFFERS];82struct pipe_framebuffer_state framebuffer;83struct pipe_poly_stipple poly_stipple;84struct pipe_scissor_state scissors[PIPE_MAX_VIEWPORTS];85struct pipe_sampler_view *sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_SAMPLER_VIEWS];8687struct pipe_viewport_state viewports[PIPE_MAX_VIEWPORTS];88struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];8990struct pipe_shader_buffer ssbos[PIPE_SHADER_TYPES][LP_MAX_TGSI_SHADER_BUFFERS];91struct pipe_image_view images[PIPE_SHADER_TYPES][LP_MAX_TGSI_SHADER_IMAGES];9293unsigned num_samplers[PIPE_SHADER_TYPES];94unsigned num_sampler_views[PIPE_SHADER_TYPES];95unsigned num_images[PIPE_SHADER_TYPES];9697unsigned num_vertex_buffers;9899struct draw_so_target *so_targets[PIPE_MAX_SO_BUFFERS];100int num_so_targets;101struct pipe_query_data_so_statistics so_stats[PIPE_MAX_VERTEX_STREAMS];102103struct pipe_query_data_pipeline_statistics pipeline_statistics;104unsigned active_statistics_queries;105106unsigned active_occlusion_queries;107108unsigned active_primgen_queries;109110bool queries_disabled;111112unsigned dirty; /**< Mask of LP_NEW_x flags */113unsigned cs_dirty; /**< Mask of LP_CSNEW_x flags */114/** Mapped vertex buffers */115ubyte *mapped_vbuffer[PIPE_MAX_ATTRIBS];116117/** Vertex format */118struct vertex_info vertex_info;119120/** Which vertex shader output slot contains color */121int8_t color_slot[2];122123/** Which vertex shader output slot contains bcolor */124int8_t bcolor_slot[2];125126/** Which vertex shader output slot contains point size */127int8_t psize_slot;128129/** Which vertex shader output slot contains viewport index */130int8_t viewport_index_slot;131132/** Which geometry shader output slot contains layer */133int8_t layer_slot;134135/** A fake frontface output for unfilled primitives */136int8_t face_slot;137138/** Depth format and bias settings. */139boolean floating_point_depth;140double mrd; /**< minimum resolvable depth value, for polygon offset */141142/** The tiling engine */143struct lp_setup_context *setup;144struct lp_setup_variant setup_variant;145146/** The primitive drawing context */147struct draw_context *draw;148149struct blitter_context *blitter;150151unsigned tex_timestamp;152153/** List of all fragment shader variants */154struct lp_fs_variant_list_item fs_variants_list;155unsigned nr_fs_variants;156unsigned nr_fs_instrs;157158struct lp_setup_variant_list_item setup_variants_list;159unsigned nr_setup_variants;160161/** List of all compute shader variants */162struct lp_cs_variant_list_item cs_variants_list;163unsigned nr_cs_variants;164unsigned nr_cs_instrs;165struct lp_cs_context *csctx;166167/** Conditional query object and mode */168struct pipe_query *render_cond_query;169enum pipe_render_cond_flag render_cond_mode;170boolean render_cond_cond;171172/** VK render cond */173struct llvmpipe_resource *render_cond_buffer;174unsigned render_cond_offset;175176/** The LLVMContext to use for LLVM related work */177LLVMContextRef context;178179int max_global_buffers;180struct pipe_resource **global_buffers;181182};183184185struct pipe_context *186llvmpipe_create_context(struct pipe_screen *screen, void *priv,187unsigned flags);188189struct pipe_resource *190llvmpipe_user_buffer_create(struct pipe_screen *screen,191void *ptr,192unsigned bytes,193unsigned bind_flags);194195196static inline struct llvmpipe_context *197llvmpipe_context( struct pipe_context *pipe )198{199return (struct llvmpipe_context *)pipe;200}201202#endif /* LP_CONTEXT_H */203204205206