panfrost: Separate postfix from emits
[mesa.git] / src / gallium / drivers / panfrost / pan_blend.h
index a881e0945f48ecd91f685dda7c6c68f8a152ec5a..df1227bfd01b50cf8329f72469e3014ae319e792 100644 (file)
 /* An internal blend shader descriptor, from the compiler */
 
 struct panfrost_blend_shader {
-        /* The compiled shader in GPU memory */
-        struct panfrost_transfer shader;
+        struct panfrost_context *ctx;
+
+        /* The compiled shader */
+        void *buffer;
 
         /* Byte count of the shader */
         unsigned size;
@@ -53,15 +55,18 @@ struct panfrost_blend_shader {
 /* A blend shader descriptor ready for actual use */
 
 struct panfrost_blend_shader_final {
-        /* The upload, possibly to transient memory */
-        mali_ptr gpu;
+        /* GPU address where we're compiled to */
+        uint64_t gpu;
+
+        /* First instruction tag (for tagging the pointer) */
+        unsigned first_tag;
 
         /* Same meaning as panfrost_blend_shader */
         unsigned work_count;
 };
 
 struct panfrost_blend_equation_final {
-        struct mali_blend_equation *equation;
+        struct mali_blend_equation_packed equation;
         float constant;
 };
 
@@ -70,11 +75,14 @@ struct panfrost_blend_rt {
          * fixed-function configuration for this blend state */
 
         bool has_fixed_function;
-        struct mali_blend_equation equation;
+        struct mali_blend_equation_packed equation;
 
         /* Mask of blend color components read */
         unsigned constant_mask;
 
+        /* Properties of the blend mode */
+        bool opaque, load_dest, no_colour;
+
         /* Regardless of fixed-function blending, this is a map of pipe_format
          * to panfrost_blend_shader */
 
@@ -94,6 +102,15 @@ struct panfrost_blend_final {
         /* Set for a shader, clear for an equation */
         bool is_shader;
 
+        /* Set if this is the replace mode */
+        bool opaque;
+
+        /* Set if destination is loaded */
+        bool load_dest;
+
+        /* Set if the colour mask is 0x0 (nothing is written) */
+        bool no_colour;
+
         union {
                 struct panfrost_blend_shader_final shader;
                 struct panfrost_blend_equation_final equation;
@@ -106,4 +123,11 @@ panfrost_blend_context_init(struct pipe_context *pipe);
 struct panfrost_blend_final
 panfrost_get_blend_for_context(struct panfrost_context *ctx, unsigned rt);
 
+struct panfrost_blend_shader *
+panfrost_get_blend_shader(
+        struct panfrost_context *ctx,
+        struct panfrost_blend_state *blend,
+        enum pipe_format fmt,
+        unsigned rt);
+
 #endif