2 * Mesa 3-D graphics library
4 * Copyright (C) 2012-2014 LunarG, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
25 * Chia-I Wu <olv@lunarg.com>
28 #ifndef ILO_STATE_3D_H
29 #define ILO_STATE_3D_H
31 #include "genhw/genhw.h"
32 #include "pipe/p_state.h"
36 #include "ilo_state_surface.h"
37 #include "ilo_state_zs.h"
42 #define ILO_MAX_DRAW_BUFFERS 8
43 #define ILO_MAX_CONST_BUFFERS (1 + 12)
44 #define ILO_MAX_SAMPLER_VIEWS 16
45 #define ILO_MAX_SAMPLERS 16
46 #define ILO_MAX_SO_BINDINGS 64
47 #define ILO_MAX_SO_BUFFERS 4
48 #define ILO_MAX_VIEWPORTS 1
50 #define ILO_MAX_SURFACES 256
55 struct ilo_shader_state
;
58 struct pipe_vertex_buffer states
[PIPE_MAX_ATTRIBS
];
59 uint32_t enabled_mask
;
63 struct pipe_resource
*buffer
;
64 const void *user_buffer
;
68 /* these are not valid until the state is finalized */
69 struct pipe_resource
*hw_resource
;
70 unsigned hw_index_size
;
71 /* an offset to be added to pipe_draw_info::start */
72 int64_t draw_start_offset
;
76 struct pipe_stream_output_target
*states
[ILO_MAX_SO_BUFFERS
];
78 unsigned append_bitmask
;
83 struct ilo_surface_cso
{
84 struct pipe_surface base
;
88 struct ilo_state_surface rt
;
89 struct ilo_state_zs zs
;
94 struct pipe_framebuffer_state state
;
96 struct ilo_state_surface null_rt
;
97 struct ilo_state_zs null_zs
;
99 struct ilo_fb_blend_caps
{
102 bool force_dst_alpha_one
;
107 } blend_caps
[PIPE_MAX_COLOR_BUFS
];
109 unsigned num_samples
;
113 enum gen_depth_format depth_offset_format
;
116 struct ilo_shader_cso
{
121 ilo_gpe_init_vs_cso(const struct ilo_dev
*dev
,
122 const struct ilo_shader_state
*vs
,
123 struct ilo_shader_cso
*cso
);
126 ilo_gpe_init_gs_cso(const struct ilo_dev
*dev
,
127 const struct ilo_shader_state
*gs
,
128 struct ilo_shader_cso
*cso
);
131 ilo_gpe_init_fs_cso(const struct ilo_dev
*dev
,
132 const struct ilo_shader_state
*fs
,
133 struct ilo_shader_cso
*cso
);
136 ilo_gpe_set_fb(const struct ilo_dev
*dev
,
137 const struct pipe_framebuffer_state
*state
,
138 struct ilo_fb_state
*fb
);
140 #endif /* ILO_STATE_3D_H */