i965/vs: Add a little bit of IR-level debug ability.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_context.h
index 1548f81ec4fd41c89fefc025ceb07975db0b6eb7..e9d6cc43810f25094f4aeff6273062b2d7f20288 100644 (file)
@@ -275,6 +275,8 @@ struct brw_fragment_program {
 struct brw_shader {
    struct gl_shader base;
 
+   bool compiled_once;
+
    /** Shader IR transformed for native compile, at link time. */
    struct exec_list *ir;
 };
@@ -286,7 +288,10 @@ struct brw_shader_program {
 /* Data about a particular attempt to compile a program.  Note that
  * there can be many of these, each in a different GL state
  * corresponding to a different brw_wm_prog_key struct, with different
- * compiled programs:
+ * compiled programs.
+ *
+ * Note: brw_wm_prog_data_compare() must be updated when adding fields to this
+ * struct!
  */
 struct brw_wm_prog_data {
    GLuint curb_read_length;
@@ -311,11 +316,14 @@ struct brw_wm_prog_data {
     */
    uint32_t barycentric_interp_modes;
 
-   /* Pointer to tracked values (only valid once
+   /* Pointers to tracked values (only valid once
     * _mesa_load_state_parameters has been called at runtime).
+    *
+    * These must be the last fields of the struct (see
+    * brw_wm_prog_data_compare()).
     */
-   const float *param[MAX_UNIFORMS * 4]; /* should be: BRW_MAX_CURBE */
-   const float *pull_param[MAX_UNIFORMS * 4];
+   const float **param;
+   const float **pull_param;
 };
 
 /**
@@ -424,6 +432,9 @@ struct brw_gs_prog_data {
    unsigned svbi_postincrement_value;
 };
 
+/* Note: brw_vs_prog_data_compare() must be updated when adding fields to this
+ * struct!
+ */
 struct brw_vs_prog_data {
    struct brw_vue_map vue_map;
 
@@ -441,14 +452,15 @@ struct brw_vs_prog_data {
     */
    GLuint urb_entry_size;
 
-   const float *param[MAX_UNIFORMS * 4]; /* should be: BRW_MAX_CURBE */
-   const float *pull_param[MAX_UNIFORMS * 4];
-
    bool uses_new_param_layout;
    bool uses_vertexid;
    bool userclip;
 
    int num_surfaces;
+
+   /* These pointers must appear last.  See brw_vs_prog_data_compare(). */
+   const float **param;
+   const float **pull_param;
 };
 
 
@@ -617,6 +629,9 @@ struct brw_cache_item {
 };   
 
 
+typedef bool (*cache_aux_compare_func)(const void *a, const void *b,
+                                       int aux_size, const void *key);
+typedef void (*cache_aux_free_func)(const void *aux);
 
 struct brw_cache {
    struct brw_context *brw;
@@ -627,6 +642,15 @@ struct brw_cache {
 
    uint32_t next_offset;
    bool bo_used_by_gpu;
+
+   /**
+    * Optional functions used in determining whether the prog_data for a new
+    * cache item matches an existing cache item (in case there's relevant data
+    * outside of the prog_data).  If NULL, a plain memcmp is done.
+    */
+   cache_aux_compare_func aux_compare[BRW_MAX_CACHE];
+   /** Optional functions for freeing other pointers attached to a prog_data. */
+   cache_aux_free_func aux_free[BRW_MAX_CACHE];
 };
 
 
@@ -1097,8 +1121,21 @@ void brwInitVtbl( struct brw_context *brw );
 bool brwCreateContext(int api,
                      const struct gl_config *mesaVis,
                      __DRIcontext *driContextPriv,
+                      unsigned major_version,
+                      unsigned minor_version,
+                      uint32_t flags,
+                      unsigned *error,
                      void *sharedContextPrivate);
 
+/*======================================================================
+ * brw_misc_state.c
+ */
+void brw_get_depthstencil_tile_masks(struct intel_mipmap_tree *depth_mt,
+                                     struct intel_mipmap_tree *stencil_mt,
+                                     uint32_t *out_tile_mask_x,
+                                     uint32_t *out_tile_mask_y);
+void brw_workaround_depthstencil_alignment(struct brw_context *brw);
+
 /*======================================================================
  * brw_queryobj.c
  */
@@ -1261,6 +1298,14 @@ brw_program_reloc(struct brw_context *brw, uint32_t state_offset,
 bool brw_do_cubemap_normalize(struct exec_list *instructions);
 bool brw_lower_texture_gradients(struct exec_list *instructions);
 
+struct opcode_desc {
+    char    *name;
+    int            nsrc;
+    int            ndst;
+};
+
+extern const struct opcode_desc opcode_descs[128];
+
 #ifdef __cplusplus
 }
 #endif