v3d: Avoid duplicating limits defines between gallium and v3d core.
[mesa.git] / src / gallium / drivers / v3d / v3d_context.h
index 9f52342d2dd7d1c18a5f175786461b31b7ff04d7..3ec4940b6482baef3cf6c41c649187786770b9ea 100644 (file)
@@ -38,6 +38,7 @@
 #include "xf86drm.h"
 #include "v3d_drm.h"
 #include "v3d_screen.h"
+#include "broadcom/common/v3d_limits.h"
 
 struct v3d_job;
 struct v3d_bo;
@@ -58,6 +59,7 @@ void v3d_job_add_bo(struct v3d_job *job, struct v3d_bo *bo);
 #define VC5_DIRTY_ZSA           (1 <<  2)
 #define VC5_DIRTY_FRAGTEX       (1 <<  3)
 #define VC5_DIRTY_VERTTEX       (1 <<  4)
+#define VC5_DIRTY_SHADER_IMAGE  (1 <<  5)
 
 #define VC5_DIRTY_BLEND_COLOR   (1 <<  7)
 #define VC5_DIRTY_STENCIL_REF   (1 <<  8)
@@ -82,6 +84,7 @@ void v3d_job_add_bo(struct v3d_job *job, struct v3d_bo *bo);
 #define VC5_DIRTY_OQ            (1 << 28)
 #define VC5_DIRTY_CENTROID_FLAGS (1 << 29)
 #define VC5_DIRTY_NOPERSPECTIVE_FLAGS (1 << 30)
+#define VC5_DIRTY_SSBO          (1 << 31)
 
 #define VC5_MAX_FS_INPUTS 64
 
@@ -188,10 +191,10 @@ struct v3d_vertexbuf_stateobj {
 };
 
 struct v3d_vertex_stateobj {
-        struct pipe_vertex_element pipe[VC5_MAX_ATTRIBUTES];
+        struct pipe_vertex_element pipe[V3D_MAX_VS_INPUTS / 4];
         unsigned num_elements;
 
-        uint8_t attrs[16 * VC5_MAX_ATTRIBUTES];
+        uint8_t attrs[16 * (V3D_MAX_VS_INPUTS / 4)];
         struct pipe_resource *defaults;
         uint32_t defaults_offset;
 };
@@ -203,6 +206,11 @@ struct v3d_streamout_stateobj {
         unsigned num_targets;
 };
 
+struct v3d_ssbo_stateobj {
+        struct pipe_shader_buffer sb[PIPE_MAX_SHADER_BUFFERS];
+        uint32_t enabled_mask;
+};
+
 /* Hash table key for v3d->jobs */
 struct v3d_job_key {
         struct pipe_surface *cbufs[4];
@@ -216,6 +224,18 @@ enum v3d_ez_state {
         VC5_EZ_DISABLED,
 };
 
+struct v3d_image_view {
+        struct pipe_image_view base;
+        /* V3D 4.x texture shader state struct */
+        struct pipe_resource *tex_state;
+        uint32_t tex_state_offset;
+};
+
+struct v3d_shaderimg_stateobj {
+        struct v3d_image_view si[PIPE_MAX_SHADER_IMAGES];
+        uint32_t enabled_mask;
+};
+
 /**
  * A complete bin/render job.
  *
@@ -308,6 +328,11 @@ struct v3d_job {
          */
         bool needs_flush;
 
+        /* Set if any shader has dirtied cachelines in the TMU that need to be
+         * flushed before job end.
+         */
+        bool tmu_dirty_rcl;
+
         /**
          * Set if a packet enabling TF has been emitted in the job (V3D 4.x).
          */
@@ -428,6 +453,8 @@ struct v3d_context {
         struct pipe_poly_stipple stipple;
         struct pipe_clip_state clip;
         struct pipe_viewport_state viewport;
+        struct v3d_ssbo_stateobj ssbo[PIPE_SHADER_TYPES];
+        struct v3d_shaderimg_stateobj shaderimg[PIPE_SHADER_TYPES];
         struct v3d_constbuf_stateobj constbuf[PIPE_SHADER_TYPES];
         struct v3d_texture_stateobj tex[PIPE_SHADER_TYPES];
         struct v3d_vertexbuf_stateobj vertexbuf;