diff options
author | Chia-I Wu <[email protected]> | 2014-09-20 00:34:47 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2014-09-20 10:13:53 +0800 |
commit | 284d767be0589143d5c20fdf1f3b52cadf2663f6 (patch) | |
tree | cae460db703304752253313a99f8f3af3b95dc98 /src/gallium/drivers/ilo/ilo_state.h | |
parent | 4a8a6ce154b4284da0160e8d88e330e1a26bea78 (diff) |
ilo: merge ilo_gpe.h to ilo_state*.h
Move the #define's and struct's to ilo_state.h. Move the inline functions and
function declarations to ilo_state_gen.h.
Diffstat (limited to 'src/gallium/drivers/ilo/ilo_state.h')
-rw-r--r-- | src/gallium/drivers/ilo/ilo_state.h | 258 |
1 files changed, 258 insertions, 0 deletions
diff --git a/src/gallium/drivers/ilo/ilo_state.h b/src/gallium/drivers/ilo/ilo_state.h index 588a1b9660a..a14c3fbb28e 100644 --- a/src/gallium/drivers/ilo/ilo_state.h +++ b/src/gallium/drivers/ilo/ilo_state.h @@ -31,6 +31,29 @@ #include "ilo_common.h" /** + * \see brw_context.h + */ +#define ILO_MAX_DRAW_BUFFERS 8 +#define ILO_MAX_CONST_BUFFERS (1 + 12) +#define ILO_MAX_SAMPLER_VIEWS 16 +#define ILO_MAX_SAMPLERS 16 +#define ILO_MAX_SO_BINDINGS 64 +#define ILO_MAX_SO_BUFFERS 4 +#define ILO_MAX_VIEWPORTS 1 + +#define ILO_MAX_VS_SURFACES (ILO_MAX_CONST_BUFFERS + ILO_MAX_SAMPLER_VIEWS) +#define ILO_VS_CONST_SURFACE(i) (i) +#define ILO_VS_TEXTURE_SURFACE(i) (ILO_MAX_CONST_BUFFERS + i) + +#define ILO_MAX_GS_SURFACES (ILO_MAX_SO_BINDINGS) +#define ILO_GS_SO_SURFACE(i) (i) + +#define ILO_MAX_WM_SURFACES (ILO_MAX_DRAW_BUFFERS + ILO_MAX_CONST_BUFFERS + ILO_MAX_SAMPLER_VIEWS) +#define ILO_WM_DRAW_SURFACE(i) (i) +#define ILO_WM_CONST_SURFACE(i) (ILO_MAX_DRAW_BUFFERS + i) +#define ILO_WM_TEXTURE_SURFACE(i) (ILO_MAX_DRAW_BUFFERS + ILO_MAX_CONST_BUFFERS + i) + +/** * States that we track. * * XXX Do we want to count each sampler or vertex buffer as a state? If that @@ -117,7 +140,242 @@ enum ilo_dirty_flags { struct pipe_draw_info; struct pipe_resource; + +struct ilo_buffer; struct ilo_context; +struct ilo_shader_state; +struct ilo_texture; + +struct ilo_vb_state { + struct pipe_vertex_buffer states[PIPE_MAX_ATTRIBS]; + uint32_t enabled_mask; +}; + +struct ilo_ib_state { + struct pipe_resource *buffer; + const void *user_buffer; + unsigned offset; + unsigned index_size; + + /* these are not valid until the state is finalized */ + struct pipe_resource *hw_resource; + unsigned hw_index_size; + /* an offset to be added to pipe_draw_info::start */ + int64_t draw_start_offset; +}; + +struct ilo_ve_cso { + /* VERTEX_ELEMENT_STATE */ + uint32_t payload[2]; +}; + +struct ilo_ve_state { + struct ilo_ve_cso cso[PIPE_MAX_ATTRIBS]; + unsigned count; + + unsigned instance_divisors[PIPE_MAX_ATTRIBS]; + unsigned vb_mapping[PIPE_MAX_ATTRIBS]; + unsigned vb_count; +}; + +struct ilo_so_state { + struct pipe_stream_output_target *states[ILO_MAX_SO_BUFFERS]; + unsigned count; + unsigned append_bitmask; + + bool enabled; +}; + +struct ilo_viewport_cso { + /* matrix form */ + float m00, m11, m22, m30, m31, m32; + + /* guardband in NDC space */ + float min_gbx, min_gby, max_gbx, max_gby; + + /* viewport in screen space */ + float min_x, min_y, min_z; + float max_x, max_y, max_z; +}; + +struct ilo_viewport_state { + struct ilo_viewport_cso cso[ILO_MAX_VIEWPORTS]; + unsigned count; + + struct pipe_viewport_state viewport0; +}; + +struct ilo_scissor_state { + /* SCISSOR_RECT */ + uint32_t payload[ILO_MAX_VIEWPORTS * 2]; + + struct pipe_scissor_state scissor0; +}; + +struct ilo_rasterizer_clip { + /* 3DSTATE_CLIP */ + uint32_t payload[3]; + + uint32_t can_enable_guardband; +}; + +struct ilo_rasterizer_sf { + /* 3DSTATE_SF */ + uint32_t payload[6]; + uint32_t dw_msaa; +}; + +struct ilo_rasterizer_wm { + /* 3DSTATE_WM */ + uint32_t payload[2]; + uint32_t dw_msaa_rast; + uint32_t dw_msaa_disp; +}; + +struct ilo_rasterizer_state { + struct pipe_rasterizer_state state; + + struct ilo_rasterizer_clip clip; + struct ilo_rasterizer_sf sf; + struct ilo_rasterizer_wm wm; +}; + +struct ilo_dsa_state { + /* DEPTH_STENCIL_STATE */ + uint32_t payload[3]; + + uint32_t dw_alpha; + ubyte alpha_ref; +}; + +struct ilo_blend_cso { + /* BLEND_STATE */ + uint32_t payload[2]; + + uint32_t dw_blend; + uint32_t dw_blend_dst_alpha_forced_one; + + uint32_t dw_logicop; + uint32_t dw_alpha_mod; +}; + +struct ilo_blend_state { + struct ilo_blend_cso cso[ILO_MAX_DRAW_BUFFERS]; + + bool independent_blend_enable; + bool dual_blend; + bool alpha_to_coverage; +}; + +struct ilo_sampler_cso { + /* SAMPLER_STATE and SAMPLER_BORDER_COLOR_STATE */ + uint32_t payload[15]; + + uint32_t dw_filter; + uint32_t dw_filter_aniso; + uint32_t dw_wrap; + uint32_t dw_wrap_1d; + uint32_t dw_wrap_cube; + + bool anisotropic; + bool saturate_r; + bool saturate_s; + bool saturate_t; +}; + +struct ilo_sampler_state { + const struct ilo_sampler_cso *cso[ILO_MAX_SAMPLERS]; + unsigned count; +}; + +struct ilo_view_surface { + /* SURFACE_STATE */ + uint32_t payload[8]; + struct intel_bo *bo; +}; + +struct ilo_view_cso { + struct pipe_sampler_view base; + + struct ilo_view_surface surface; +}; + +struct ilo_view_state { + struct pipe_sampler_view *states[ILO_MAX_SAMPLER_VIEWS]; + unsigned count; +}; + +struct ilo_cbuf_cso { + struct pipe_resource *resource; + struct ilo_view_surface surface; + + /* + * this CSO is not so constant because user buffer needs to be uploaded in + * finalize_constant_buffers() + */ + const void *user_buffer; + unsigned user_buffer_size; +}; + +struct ilo_cbuf_state { + struct ilo_cbuf_cso cso[ILO_MAX_CONST_BUFFERS]; + uint32_t enabled_mask; +}; + +struct ilo_resource_state { + struct pipe_surface *states[PIPE_MAX_SHADER_RESOURCES]; + unsigned count; +}; + +struct ilo_surface_cso { + struct pipe_surface base; + + bool is_rt; + union { + struct ilo_view_surface rt; + struct ilo_zs_surface { + uint32_t payload[10]; + struct intel_bo *bo; + struct intel_bo *hiz_bo; + struct intel_bo *separate_s8_bo; + } zs; + } u; +}; + +struct ilo_fb_state { + struct pipe_framebuffer_state state; + + struct ilo_view_surface null_rt; + struct ilo_zs_surface null_zs; + + unsigned num_samples; +}; + +struct ilo_global_binding { + /* + * XXX These should not be treated as real resources (and there could be + * thousands of them). They should be treated as regions in GLOBAL + * resource, which is the only real resource. + * + * That is, a resource here should instead be + * + * struct ilo_global_region { + * struct pipe_resource base; + * int offset; + * int size; + * }; + * + * and it describes the region [offset, offset + size) in GLOBAL + * resource. + */ + struct pipe_resource *resources[PIPE_MAX_SHADER_RESOURCES]; + uint32_t *handles[PIPE_MAX_SHADER_RESOURCES]; + unsigned count; +}; + +struct ilo_shader_cso { + uint32_t payload[5]; +}; void ilo_init_state_functions(struct ilo_context *ilo); |