#ifndef ILO_STATE_H
#define ILO_STATE_H
+#include "core/ilo_state_3d.h"
+#include "pipe/p_state.h"
+#include "util/u_dynarray.h"
+
#include "ilo_common.h"
/**
ILO_DIRTY_ALL = 0xffffffff,
};
-struct pipe_draw_info;
-struct pipe_resource;
struct ilo_context;
+struct ilo_global_binding_cso {
+ struct pipe_resource *resource;
+ uint32_t *handle;
+};
+
+/*
+ * In theory, we would like a "virtual" bo that serves as the global memory
+ * region. The virtual bo would reserve a region in the GTT aperture, but the
+ * pages of it would come from those of the global bindings.
+ *
+ * The virtual bo would be created in launch_grid(). The global bindings
+ * would be added to the virtual bo. A SURFACE_STATE for the virtual bo would
+ * be created. The handles returned by set_global_binding() would be offsets
+ * into the virtual bo.
+ *
+ * But for now, we will create a SURFACE_STATE for each of the bindings. The
+ * handle of a global binding consists of the offset and the binding table
+ * index.
+ */
+struct ilo_global_binding {
+ struct util_dynarray bindings;
+ unsigned count;
+};
+
+struct ilo_state_vector {
+ const struct pipe_draw_info *draw;
+
+ uint32_t dirty;
+
+ struct ilo_vb_state vb;
+ struct ilo_ve_state *ve;
+ struct ilo_ib_state ib;
+
+ struct ilo_shader_state *vs;
+ struct ilo_shader_state *gs;
+
+ struct ilo_so_state so;
+
+ struct pipe_clip_state clip;
+ struct ilo_viewport_state viewport;
+ struct ilo_scissor_state scissor;
+
+ const struct ilo_rasterizer_state *rasterizer;
+ struct pipe_poly_stipple poly_stipple;
+ unsigned sample_mask;
+
+ struct ilo_shader_state *fs;
+
+ const struct ilo_dsa_state *dsa;
+ struct pipe_stencil_ref stencil_ref;
+ const struct ilo_blend_state *blend;
+ struct pipe_blend_color blend_color;
+ struct ilo_fb_state fb;
+
+ /* shader resources */
+ struct ilo_sampler_state sampler[PIPE_SHADER_TYPES];
+ struct ilo_view_state view[PIPE_SHADER_TYPES];
+ struct ilo_cbuf_state cbuf[PIPE_SHADER_TYPES];
+ struct ilo_resource_state resource;
+
+ /* GPGPU */
+ struct ilo_shader_state *cs;
+ struct ilo_resource_state cs_resource;
+ struct ilo_global_binding global_binding;
+};
+
void
ilo_init_state_functions(struct ilo_context *ilo);
void
-ilo_init_states(struct ilo_context *ilo);
+ilo_finalize_3d_states(struct ilo_context *ilo,
+ const struct pipe_draw_info *draw);
void
-ilo_cleanup_states(struct ilo_context *ilo);
+ilo_finalize_compute_states(struct ilo_context *ilo);
void
-ilo_finalize_3d_states(struct ilo_context *ilo,
- const struct pipe_draw_info *draw);
+ilo_state_vector_init(const struct ilo_dev *dev,
+ struct ilo_state_vector *vec);
+
+void
+ilo_state_vector_cleanup(struct ilo_state_vector *vec);
void
-ilo_mark_states_with_resource_renamed(struct ilo_context *ilo,
- struct pipe_resource *res);
+ilo_state_vector_resource_renamed(struct ilo_state_vector *vec,
+ struct pipe_resource *res);
void
-ilo_dump_dirty_flags(uint32_t dirty);
+ilo_state_vector_dump_dirty(const struct ilo_state_vector *vec);
#endif /* ILO_STATE_H */