gallium/radeon: eliminate fast color clear before sharing
[mesa.git] / src / gallium / drivers / radeonsi / si_state.h
index a396f07e926d0d3b69617d021bf0d55853e71466..40792cbc1d5b170fecb004b6f8ad960cfcd6e1e9 100644 (file)
@@ -39,8 +39,14 @@ struct si_shader;
 struct si_state_blend {
        struct si_pm4_state     pm4;
        uint32_t                cb_target_mask;
+       bool                    alpha_to_coverage;
        bool                    alpha_to_one;
        bool                    dual_src_blend;
+       /* Set 0xf or 0x0 (4 bits) per render target if the following is
+        * true. ANDed with spi_shader_col_format.
+        */
+       unsigned                blend_enable_4bit;
+       unsigned                need_src_alpha_4bit;
 };
 
 struct si_state_rasterizer {
@@ -50,6 +56,7 @@ struct si_state_rasterizer {
        bool                    flatshade;
        bool                    two_side;
        bool                    multisample_enable;
+       bool                    force_persample_interp;
        bool                    line_stipple_enable;
        unsigned                sprite_coord_enable;
        unsigned                pa_sc_line_stipple;
@@ -58,6 +65,9 @@ struct si_state_rasterizer {
        bool                    poly_stipple_enable;
        bool                    line_smooth;
        bool                    poly_smooth;
+       bool                    uses_poly_offset;
+       bool                    clamp_fragment_color;
+       bool                    rasterizer_discard;
 };
 
 struct si_dsa_stencil_ref_part {
@@ -91,7 +101,6 @@ union si_state {
                struct si_state_rasterizer      *rasterizer;
                struct si_state_dsa             *dsa;
                struct si_pm4_state             *poly_offset;
-               struct si_pm4_state             *ta_bordercolor_base;
                struct si_pm4_state             *ls;
                struct si_pm4_state             *hs;
                struct si_pm4_state             *es;
@@ -99,7 +108,6 @@ union si_state {
                struct si_pm4_state             *vgt_shader_config;
                struct si_pm4_state             *vs;
                struct si_pm4_state             *ps;
-               struct si_pm4_state             *spi;
        } named;
        struct si_pm4_state     *array[0];
 };
@@ -108,6 +116,7 @@ union si_state_atoms {
        struct {
                /* The order matters. */
                struct r600_atom *cache_flush;
+               struct r600_atom *render_cond;
                struct r600_atom *streamout_begin;
                struct r600_atom *streamout_enable; /* must be after streamout_begin */
                struct r600_atom *framebuffer;
@@ -115,7 +124,7 @@ union si_state_atoms {
                struct r600_atom *db_render_state;
                struct r600_atom *msaa_config;
                struct r600_atom *sample_mask;
-               struct r600_atom *cb_target_mask;
+               struct r600_atom *cb_render_state;
                struct r600_atom *blend_color;
                struct r600_atom *clip_regs;
                struct r600_atom *clip_state;
@@ -123,6 +132,7 @@ union si_state_atoms {
                struct r600_atom *scissors;
                struct r600_atom *viewports;
                struct r600_atom *stencil_ref;
+               struct r600_atom *spi_map;
        } s;
        struct r600_atom *array[0];
 };
@@ -134,17 +144,12 @@ struct si_shader_data {
        uint32_t                sh_base[SI_NUM_SHADERS];
 };
 
-#define SI_NUM_USER_SAMPLERS            16 /* AKA OpenGL textures units per shader */
-#define SI_POLY_STIPPLE_SAMPLER         SI_NUM_USER_SAMPLERS
-#define SI_NUM_SAMPLERS                 (SI_POLY_STIPPLE_SAMPLER + 1)
-
 /* User sampler views:   0..15
  * Polygon stipple tex:  16
- * FMASK sampler views:  17..33 (no sampler states)
  */
-#define SI_FMASK_TEX_OFFSET            SI_NUM_SAMPLERS
-#define SI_NUM_SAMPLER_VIEWS           (SI_FMASK_TEX_OFFSET + SI_NUM_SAMPLERS)
-#define SI_NUM_SAMPLER_STATES          SI_NUM_SAMPLERS
+#define SI_NUM_USER_SAMPLERS            16 /* AKA OpenGL textures units per shader */
+#define SI_POLY_STIPPLE_SAMPLER         SI_NUM_USER_SAMPLERS
+#define SI_NUM_SAMPLERS                 (SI_POLY_STIPPLE_SAMPLER + 1)
 
 /* User constant buffers:   0..15
  * Driver state constants:  16
@@ -200,12 +205,8 @@ struct si_descriptors {
 
 struct si_sampler_views {
        struct si_descriptors           desc;
-       struct pipe_sampler_view        *views[SI_NUM_SAMPLER_VIEWS];
-};
-
-struct si_sampler_states {
-       struct si_descriptors           desc;
-       void                            *saved_states[2]; /* saved for u_blitter */
+       struct pipe_sampler_view        *views[SI_NUM_SAMPLERS];
+       void                            *sampler_states[SI_NUM_SAMPLERS];
 };
 
 struct si_buffer_resources {
@@ -235,19 +236,7 @@ struct si_buffer_resources {
                                  si_pm4_block_idx(member)); \
        } while(0)
 
-#define si_pm4_set_state(sctx, member, value) \
-       do { \
-               if ((sctx)->queued.named.member != (value)) { \
-                       si_pm4_free_state(sctx, \
-                               (struct si_pm4_state *)(sctx)->queued.named.member, \
-                               si_pm4_block_idx(member)); \
-                       (sctx)->queued.named.member = (value); \
-               } \
-       } while(0)
-
 /* si_descriptors.c */
-void si_set_sampler_descriptors(struct si_context *sctx, unsigned shader,
-                               unsigned start, unsigned count, void **states);
 void si_set_ring_buffer(struct pipe_context *ctx, uint shader, uint slot,
                        struct pipe_resource *buffer,
                        unsigned stride, unsigned num_records,
@@ -267,8 +256,7 @@ struct si_shader_selector;
 
 void si_init_atom(struct si_context *sctx, struct r600_atom *atom,
                  struct r600_atom **list_elem,
-                 void (*emit_func)(struct si_context *ctx, struct r600_atom *state),
-                 unsigned num_dw);
+                 void (*emit_func)(struct si_context *ctx, struct r600_atom *state));
 boolean si_is_format_supported(struct pipe_screen *screen,
                                enum pipe_format format,
                                enum pipe_texture_target target,
@@ -290,15 +278,14 @@ si_create_sampler_view_custom(struct pipe_context *ctx,
                              unsigned force_level);
 
 /* si_state_shader.c */
-void si_update_shaders(struct si_context *sctx);
+bool si_update_shaders(struct si_context *sctx);
 void si_init_shader_functions(struct si_context *sctx);
+bool si_init_shader_cache(struct si_screen *sscreen);
+void si_destroy_shader_cache(struct si_screen *sscreen);
 
 /* si_state_draw.c */
 void si_emit_cache_flush(struct si_context *sctx, struct r600_atom *atom);
 void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *dinfo);
 void si_trace_emit(struct si_context *sctx);
 
-/* si_commands.c */
-void si_cmd_context_control(struct si_pm4_state *pm4);
-
 #endif