Path: blob/21.2-virgl/src/gallium/drivers/softpipe/sp_state.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 SP_STATE_H31#define SP_STATE_H3233#include "pipe/p_state.h"34#include "tgsi/tgsi_scan.h"353637#define SP_NEW_VIEWPORT 0x138#define SP_NEW_RASTERIZER 0x239#define SP_NEW_FS 0x440#define SP_NEW_BLEND 0x841#define SP_NEW_CLIP 0x1042#define SP_NEW_SCISSOR 0x2043#define SP_NEW_STIPPLE 0x4044#define SP_NEW_FRAMEBUFFER 0x8045#define SP_NEW_DEPTH_STENCIL_ALPHA 0x10046#define SP_NEW_CONSTANTS 0x20047#define SP_NEW_SAMPLER 0x40048#define SP_NEW_TEXTURE 0x80049#define SP_NEW_VERTEX 0x100050#define SP_NEW_VS 0x200051#define SP_NEW_QUERY 0x400052#define SP_NEW_GS 0x800053#define SP_NEW_SO 0x1000054#define SP_NEW_SO_BUFFERS 0x20000555657struct tgsi_sampler;58struct tgsi_image;59struct tgsi_buffer;60struct tgsi_exec_machine;61struct vertex_info;626364struct sp_fragment_shader_variant_key65{66boolean polygon_stipple;67};686970struct sp_fragment_shader_variant71{72const struct tgsi_token *tokens;73struct sp_fragment_shader_variant_key key;74struct tgsi_shader_info info;7576unsigned stipple_sampler_unit;7778/* See comments about this elsewhere */79#if 080struct draw_fragment_shader *draw_shader;81#endif8283void (*prepare)(const struct sp_fragment_shader_variant *shader,84struct tgsi_exec_machine *machine,85struct tgsi_sampler *sampler,86struct tgsi_image *image,87struct tgsi_buffer *buffer);8889unsigned (*run)(const struct sp_fragment_shader_variant *shader,90struct tgsi_exec_machine *machine,91struct quad_header *quad,92bool early_depth_test);9394/* Deletes this instance of the object */95void (*delete)(struct sp_fragment_shader_variant *shader,96struct tgsi_exec_machine *machine);9798struct sp_fragment_shader_variant *next;99};100101102/** Subclass of pipe_shader_state */103struct sp_fragment_shader {104struct pipe_shader_state shader;105struct sp_fragment_shader_variant *variants;106struct draw_fragment_shader *draw_shader;107};108109110/** Subclass of pipe_shader_state */111struct sp_vertex_shader {112struct pipe_shader_state shader;113struct draw_vertex_shader *draw_data;114int max_sampler; /* -1 if no samplers */115};116117/** Subclass of pipe_shader_state */118struct sp_geometry_shader {119struct pipe_shader_state shader;120struct draw_geometry_shader *draw_data;121int max_sampler;122};123124struct sp_velems_state {125unsigned count;126struct pipe_vertex_element velem[PIPE_MAX_ATTRIBS];127};128129struct sp_so_state {130struct pipe_stream_output_info base;131};132133/** Subclass of pipe_compute_state */134struct sp_compute_shader {135struct pipe_compute_state shader;136struct tgsi_token *tokens;137struct tgsi_shader_info info;138int max_sampler; /* -1 if no samplers */139};140141void142softpipe_init_blend_funcs(struct pipe_context *pipe);143144void145softpipe_init_clip_funcs(struct pipe_context *pipe);146147void148softpipe_init_sampler_funcs(struct pipe_context *pipe);149150void151softpipe_init_rasterizer_funcs(struct pipe_context *pipe);152153void154softpipe_init_shader_funcs(struct pipe_context *pipe);155156void157softpipe_init_streamout_funcs(struct pipe_context *pipe);158159void160softpipe_init_vertex_funcs(struct pipe_context *pipe);161162void163softpipe_init_image_funcs(struct pipe_context *pipe);164165void166softpipe_set_framebuffer_state(struct pipe_context *,167const struct pipe_framebuffer_state *);168169void170softpipe_update_derived(struct softpipe_context *softpipe, unsigned prim);171172void173softpipe_set_sampler_views(struct pipe_context *pipe,174enum pipe_shader_type shader,175unsigned start,176unsigned num,177unsigned unbind_num_trailing_slots,178struct pipe_sampler_view **views);179180181void182softpipe_draw_vbo(struct pipe_context *pipe,183const struct pipe_draw_info *info,184unsigned drawid_offset,185const struct pipe_draw_indirect_info *indirect,186const struct pipe_draw_start_count_bias *draws,187unsigned num_draws);188189void190softpipe_map_texture_surfaces(struct softpipe_context *sp);191192void193softpipe_unmap_texture_surfaces(struct softpipe_context *sp);194195196struct vertex_info *197softpipe_get_vbuf_vertex_info(struct softpipe_context *softpipe);198199200struct sp_fragment_shader_variant *201softpipe_find_fs_variant(struct softpipe_context *softpipe,202struct sp_fragment_shader *fs,203const struct sp_fragment_shader_variant_key *key);204205206struct sp_fragment_shader_variant *207softpipe_find_fs_variant(struct softpipe_context *softpipe,208struct sp_fragment_shader *fs,209const struct sp_fragment_shader_variant_key *key);210211void212softpipe_prepare_vertex_sampling(struct softpipe_context *ctx,213unsigned num,214struct pipe_sampler_view **views);215void216softpipe_cleanup_vertex_sampling(struct softpipe_context *ctx);217218219void220softpipe_prepare_geometry_sampling(struct softpipe_context *ctx,221unsigned num,222struct pipe_sampler_view **views);223void224softpipe_cleanup_geometry_sampling(struct softpipe_context *ctx);225226227void228softpipe_launch_grid(struct pipe_context *context,229const struct pipe_grid_info *info);230231void232softpipe_update_compute_samplers(struct softpipe_context *softpipe);233#endif234235236