1848b8605Smrg/**********************************************************
2848b8605Smrg * Copyright 2008-2009 VMware, Inc.  All rights reserved.
3848b8605Smrg *
4848b8605Smrg * Permission is hereby granted, free of charge, to any person
5848b8605Smrg * obtaining a copy of this software and associated documentation
6848b8605Smrg * files (the "Software"), to deal in the Software without
7848b8605Smrg * restriction, including without limitation the rights to use, copy,
8848b8605Smrg * modify, merge, publish, distribute, sublicense, and/or sell copies
9848b8605Smrg * of the Software, and to permit persons to whom the Software is
10848b8605Smrg * furnished to do so, subject to the following conditions:
11848b8605Smrg *
12848b8605Smrg * The above copyright notice and this permission notice shall be
13848b8605Smrg * included in all copies or substantial portions of the Software.
14848b8605Smrg *
15848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16848b8605Smrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17848b8605Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18848b8605Smrg * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19848b8605Smrg * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20848b8605Smrg * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21848b8605Smrg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22848b8605Smrg * SOFTWARE.
23848b8605Smrg *
24848b8605Smrg **********************************************************/
25848b8605Smrg
26848b8605Smrg#ifndef SVGA_STATE_H
27848b8605Smrg#define SVGA_STATE_H
28848b8605Smrg
29848b8605Smrg
30848b8605Smrg#include "pipe/p_compiler.h"
31848b8605Smrg#include "pipe/p_defines.h"
32848b8605Smrg
33848b8605Smrgstruct svga_context;
34848b8605Smrg
35848b8605Smrg
36848b8605Smrgvoid svga_init_state( struct svga_context *svga );
37848b8605Smrgvoid svga_destroy_state( struct svga_context *svga );
38848b8605Smrg
39848b8605Smrg
40848b8605Smrgstruct svga_tracked_state {
41848b8605Smrg   const char *name;
42848b8605Smrg   unsigned dirty;
43848b8605Smrg   enum pipe_error (*update)( struct svga_context *svga, unsigned dirty );
44848b8605Smrg};
45848b8605Smrg
46848b8605Smrg/* NEED_SWTNL
47848b8605Smrg */
48848b8605Smrgextern struct svga_tracked_state svga_update_need_swvfetch;
49848b8605Smrgextern struct svga_tracked_state svga_update_need_pipeline;
50848b8605Smrgextern struct svga_tracked_state svga_update_need_swtnl;
51848b8605Smrg
52848b8605Smrg/* HW_CLEAR
53848b8605Smrg */
54848b8605Smrgextern struct svga_tracked_state svga_hw_viewport;
55848b8605Smrgextern struct svga_tracked_state svga_hw_scissor;
56848b8605Smrgextern struct svga_tracked_state svga_hw_framebuffer;
57848b8605Smrg
58848b8605Smrg/* HW_DRAW
59848b8605Smrg */
60b8e80941Smrgextern struct svga_tracked_state svga_need_tgsi_transform;
61848b8605Smrgextern struct svga_tracked_state svga_hw_vs;
62848b8605Smrgextern struct svga_tracked_state svga_hw_fs;
63b8e80941Smrgextern struct svga_tracked_state svga_hw_gs;
64848b8605Smrgextern struct svga_tracked_state svga_hw_rss;
65b8e80941Smrgextern struct svga_tracked_state svga_hw_pstipple;
66b8e80941Smrgextern struct svga_tracked_state svga_hw_sampler;
67b8e80941Smrgextern struct svga_tracked_state svga_hw_sampler_bindings;
68848b8605Smrgextern struct svga_tracked_state svga_hw_tss;
69848b8605Smrgextern struct svga_tracked_state svga_hw_tss_binding;
70848b8605Smrgextern struct svga_tracked_state svga_hw_clip_planes;
71848b8605Smrgextern struct svga_tracked_state svga_hw_vdecl;
72848b8605Smrgextern struct svga_tracked_state svga_hw_fs_constants;
73b8e80941Smrgextern struct svga_tracked_state svga_hw_gs_constants;
74848b8605Smrgextern struct svga_tracked_state svga_hw_vs_constants;
75848b8605Smrg
76848b8605Smrg/* SWTNL_DRAW
77848b8605Smrg */
78848b8605Smrgextern struct svga_tracked_state svga_update_swtnl_draw;
79848b8605Smrgextern struct svga_tracked_state svga_update_swtnl_vdecl;
80848b8605Smrg
81848b8605Smrg/* Bring the hardware fully up-to-date so that we can emit draw
82848b8605Smrg * commands.
83848b8605Smrg */
84848b8605Smrg#define SVGA_STATE_NEED_SWTNL        0
85848b8605Smrg#define SVGA_STATE_HW_CLEAR          1
86848b8605Smrg#define SVGA_STATE_HW_DRAW           2
87848b8605Smrg#define SVGA_STATE_SWTNL_DRAW        3
88848b8605Smrg#define SVGA_STATE_MAX               4
89848b8605Smrg
90848b8605Smrg
91848b8605Smrgenum pipe_error svga_update_state( struct svga_context *svga,
92848b8605Smrg                                   unsigned level );
93848b8605Smrg
94b8e80941Smrgbool svga_update_state_retry(struct svga_context *svga, unsigned level);
95848b8605Smrg
96848b8605Smrgenum pipe_error svga_emit_initial_state( struct svga_context *svga );
97848b8605Smrg
98848b8605Smrgenum pipe_error svga_reemit_framebuffer_bindings( struct svga_context *svga );
99848b8605Smrg
100b8e80941Smrgenum pipe_error svga_rebind_framebuffer_bindings( struct svga_context *svga );
101b8e80941Smrg
102848b8605Smrgenum pipe_error svga_reemit_tss_bindings( struct svga_context *svga );
103848b8605Smrg
104848b8605Smrgenum pipe_error svga_reemit_vs_bindings(struct svga_context *svga);
105848b8605Smrg
106848b8605Smrgenum pipe_error svga_reemit_fs_bindings(struct svga_context *svga);
107848b8605Smrg
108848b8605Smrg#endif
109