intel: Split gen_device_info out into libintel_dev
[mesa.git] / src / intel / compiler / brw_compiler.h
index 17615c6dd9f80c76e0e8bd485be80750a1952612..3f1852f582a807ac9ccb9f6ea0320160e249aa8c 100644 (file)
@@ -25,8 +25,7 @@
 #define BRW_COMPILER_H
 
 #include <stdio.h>
-#include "common/gen_device_info.h"
-#include "main/mtypes.h"
+#include "dev/gen_device_info.h"
 #include "main/macros.h"
 #include "util/ralloc.h"
 
@@ -402,6 +401,16 @@ struct brw_cs_prog_key {
    struct brw_sampler_prog_key_data tex;
 };
 
+/* brw_any_prog_key is any of the keys that map to an API stage */
+union brw_any_prog_key {
+   struct brw_vs_prog_key vs;
+   struct brw_tcs_prog_key tcs;
+   struct brw_tes_prog_key tes;
+   struct brw_gs_prog_key gs;
+   struct brw_wm_prog_key wm;
+   struct brw_cs_prog_key cs;
+};
+
 /*
  * Image metadata structure as laid out in the shader parameter
  * buffer.  Entries have to be 16B-aligned for the vec4 back-end to be
@@ -542,7 +551,7 @@ enum brw_param_builtin {
    BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_X,
    BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_Y,
 
-   BRW_PARAM_BUILTIN_THREAD_LOCAL_ID,
+   BRW_PARAM_BUILTIN_SUBGROUP_ID,
 };
 
 #define BRW_PARAM_BUILTIN_CLIP_PLANE(idx, comp) \
@@ -571,7 +580,6 @@ struct brw_stage_prog_data {
       uint32_t gather_texture_start;
       uint32_t ubo_start;
       uint32_t ssbo_start;
-      uint32_t abo_start;
       uint32_t image_start;
       uint32_t shader_time_start;
       uint32_t plane_start[3];
@@ -587,6 +595,8 @@ struct brw_stage_prog_data {
    unsigned total_scratch;
    unsigned total_shared;
 
+   unsigned program_size;
+
    /**
     * Register where the thread expects to find input data from the URB
     * (typically uniforms, followed by vertex or fragment attributes).
@@ -671,7 +681,6 @@ struct brw_wm_prog_data {
       /** @{
        * surface indices the WM-specific surfaces
        */
-      uint32_t render_target_start;
       uint32_t render_target_read_start;
       /** @} */
    } binding_table;
@@ -733,7 +742,6 @@ struct brw_push_const_block {
 struct brw_cs_prog_data {
    struct brw_stage_prog_data base;
 
-   GLuint dispatch_grf_start_reg_16;
    unsigned local_size[3];
    unsigned simd_size;
    unsigned threads;
@@ -1062,6 +1070,18 @@ struct brw_clip_prog_data {
    uint32_t total_grf;
 };
 
+/* brw_any_prog_data is prog_data for any stage that maps to an API stage */
+union brw_any_prog_data {
+   struct brw_stage_prog_data base;
+   struct brw_vue_prog_data vue;
+   struct brw_vs_prog_data vs;
+   struct brw_tcs_prog_data tcs;
+   struct brw_tes_prog_data tes;
+   struct brw_gs_prog_data gs;
+   struct brw_wm_prog_data wm;
+   struct brw_cs_prog_data cs;
+};
+
 #define DEFINE_PROG_DATA_DOWNCAST(stage)                       \
 static inline struct brw_##stage##_prog_data *                 \
 brw_##stage##_prog_data(struct brw_stage_prog_data *prog_data) \
@@ -1085,6 +1105,12 @@ DEFINE_PROG_DATA_DOWNCAST(sf)
 struct brw_compiler *
 brw_compiler_create(void *mem_ctx, const struct gen_device_info *devinfo);
 
+unsigned
+brw_prog_data_size(gl_shader_stage stage);
+
+unsigned
+brw_prog_key_size(gl_shader_stage stage);
+
 /**
  * Compile a vertex shader.
  *
@@ -1096,9 +1122,7 @@ brw_compile_vs(const struct brw_compiler *compiler, void *log_data,
                const struct brw_vs_prog_key *key,
                struct brw_vs_prog_data *prog_data,
                const struct nir_shader *shader,
-               bool use_legacy_snorm_formula,
                int shader_time_index,
-               unsigned *final_assembly_size,
                char **error_str);
 
 /**
@@ -1114,7 +1138,6 @@ brw_compile_tcs(const struct brw_compiler *compiler,
                 struct brw_tcs_prog_data *prog_data,
                 const struct nir_shader *nir,
                 int shader_time_index,
-                unsigned *final_assembly_size,
                 char **error_str);
 
 /**
@@ -1131,7 +1154,6 @@ brw_compile_tes(const struct brw_compiler *compiler, void *log_data,
                 const struct nir_shader *shader,
                 struct gl_program *prog,
                 int shader_time_index,
-                unsigned *final_assembly_size,
                 char **error_str);
 
 /**
@@ -1147,7 +1169,6 @@ brw_compile_gs(const struct brw_compiler *compiler, void *log_data,
                const struct nir_shader *shader,
                struct gl_program *prog,
                int shader_time_index,
-               unsigned *final_assembly_size,
                char **error_str);
 
 /**
@@ -1198,7 +1219,6 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data,
                int shader_time_index16,
                bool allow_spilling,
                bool use_rep_send, struct brw_vue_map *vue_map,
-               unsigned *final_assembly_size,
                char **error_str);
 
 /**
@@ -1213,7 +1233,6 @@ brw_compile_cs(const struct brw_compiler *compiler, void *log_data,
                struct brw_cs_prog_data *prog_data,
                const struct nir_shader *shader,
                int shader_time_index,
-               unsigned *final_assembly_size,
                char **error_str);
 
 static inline uint32_t
@@ -1255,7 +1274,7 @@ encode_slm_size(unsigned gen, uint32_t bytes)
  * '2^n - 1' for some n.
  */
 static inline bool
-brw_stage_has_packed_dispatch(const struct gen_device_info *devinfo,
+brw_stage_has_packed_dispatch(MAYBE_UNUSED const struct gen_device_info *devinfo,
                               gl_shader_stage stage,
                               const struct brw_stage_prog_data *prog_data)
 {