/********************************************************** * Copyright 2008-2009 VMware, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * **********************************************************/ #ifndef SVGA_CONTEXT_H #define SVGA_CONTEXT_H #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_state.h" #include "util/u_blitter.h" #include "util/u_double_list.h" #include "tgsi/tgsi_scan.h" #include "svga_state.h" #include "svga_tgsi.h" #include "svga_hw_reg.h" #include "svga3d_shaderdefs.h" /** Non-GPU queries for gallium HUD */ #define SVGA_QUERY_DRAW_CALLS (PIPE_QUERY_DRIVER_SPECIFIC + 0) #define SVGA_QUERY_FALLBACKS (PIPE_QUERY_DRIVER_SPECIFIC + 1) #define SVGA_QUERY_MEMORY_USED (PIPE_QUERY_DRIVER_SPECIFIC + 2) struct draw_vertex_shader; struct draw_fragment_shader; struct svga_shader_result; struct SVGACmdMemory; struct util_bitmask; struct svga_shader { const struct tgsi_token *tokens; struct tgsi_shader_info info; struct svga_shader_result *results; unsigned id; /**< for debugging only */ }; struct svga_fragment_shader { struct svga_shader base; struct draw_fragment_shader *draw_shader; /** Mask of which generic varying variables are read by this shader */ unsigned generic_inputs; /** Table mapping original TGSI generic indexes to low integers */ int8_t generic_remap_table[MAX_GENERIC_VARYING]; }; struct svga_vertex_shader { struct svga_shader base; struct draw_vertex_shader *draw_shader; }; struct svga_cache_context; struct svga_tracked_state; struct svga_blend_state { boolean need_white_fragments; /* Should be per-render-target: */ struct { uint8_t writemask; boolean blend_enable; uint8_t srcblend; uint8_t dstblend; uint8_t blendeq; boolean separate_alpha_blend_enable; uint8_t srcblend_alpha; uint8_t dstblend_alpha; uint8_t blendeq_alpha; } rt[1]; }; struct svga_depth_stencil_state { unsigned zfunc:8; unsigned zenable:1; unsigned zwriteenable:1; unsigned alphatestenable:1; unsigned alphafunc:8; struct { unsigned enabled:1; unsigned func:8; unsigned fail:8; unsigned zfail:8; unsigned pass:8; } stencil[2]; /* SVGA3D has one ref/mask/writemask triple shared between front & * back face stencil. We really need two: */ unsigned stencil_mask:8; unsigned stencil_writemask:8; float alpharef; }; #define SVGA_UNFILLED_DISABLE 0 #define SVGA_UNFILLED_LINE 1 #define SVGA_UNFILLED_POINT 2 #define SVGA_PIPELINE_FLAG_POINTS (1<