i965: Pass compiler to default key populators
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 7 May 2019 01:24:08 +0000 (18:24 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 14 May 2019 20:16:21 +0000 (13:16 -0700)
This lets us get devinfo and other misc. compiler settings.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
13 files changed:
src/mesa/drivers/dri/i965/brw_cs.c
src/mesa/drivers/dri/i965/brw_cs.h
src/mesa/drivers/dri/i965/brw_gs.c
src/mesa/drivers/dri/i965/brw_gs.h
src/mesa/drivers/dri/i965/brw_program.c
src/mesa/drivers/dri/i965/brw_program.h
src/mesa/drivers/dri/i965/brw_program_binary.c
src/mesa/drivers/dri/i965/brw_tcs.c
src/mesa/drivers/dri/i965/brw_tes.c
src/mesa/drivers/dri/i965/brw_vs.c
src/mesa/drivers/dri/i965/brw_vs.h
src/mesa/drivers/dri/i965/brw_wm.c
src/mesa/drivers/dri/i965/brw_wm.h

index ea78471d7634f8b4dcc5fe2f6accaeb99d761791..58adbda2fb6665ff90ca9a01cb1761400dd85b92 100644 (file)
@@ -185,10 +185,11 @@ brw_upload_cs_prog(struct brw_context *brw)
 }
 
 void
-brw_cs_populate_default_key(const struct gen_device_info *devinfo,
+brw_cs_populate_default_key(const struct brw_compiler *compiler,
                             struct brw_cs_prog_key *key,
                             struct gl_program *prog)
 {
+   const struct gen_device_info *devinfo = compiler->devinfo;
    memset(key, 0, sizeof(*key));
    key->program_string_id = brw_program(prog)->id;
 
@@ -203,7 +204,7 @@ brw_cs_precompile(struct gl_context *ctx, struct gl_program *prog)
 
    struct brw_program *bcp = brw_program(prog);
 
-   brw_cs_populate_default_key(&brw->screen->devinfo, &key, prog);
+   brw_cs_populate_default_key(brw->screen->compiler, &key, prog);
 
    uint32_t old_prog_offset = brw->cs.base.prog_offset;
    struct brw_stage_prog_data *old_prog_data = brw->cs.base.prog_data;
index 669d4b544ebaf9bef6652f1cc934f0d29be8b730..a0d43abaae4b29cce6cd3b772f6168a390baadc0 100644 (file)
@@ -35,7 +35,7 @@ brw_upload_cs_prog(struct brw_context *brw);
 void
 brw_cs_populate_key(struct brw_context *brw, struct brw_cs_prog_key *key);
 void
-brw_cs_populate_default_key(const struct gen_device_info *devinfo,
+brw_cs_populate_default_key(const struct brw_compiler *compiler,
                             struct brw_cs_prog_key *key,
                             struct gl_program *prog);
 
index eeff4784e723762a6a81b5fcb70bd16b2c670e88..34e37373999fbe14a98c69ee02f0b723ca3cd7be 100644 (file)
@@ -186,10 +186,12 @@ brw_upload_gs_prog(struct brw_context *brw)
 }
 
 void
-brw_gs_populate_default_key(const struct gen_device_info *devinfo,
+brw_gs_populate_default_key(const struct brw_compiler *compiler,
                             struct brw_gs_prog_key *key,
                             struct gl_program *prog)
 {
+   const struct gen_device_info *devinfo = compiler->devinfo;
+
    memset(key, 0, sizeof(*key));
 
    brw_setup_tex_for_precompile(devinfo, &key->tex, prog);
@@ -207,7 +209,7 @@ brw_gs_precompile(struct gl_context *ctx, struct gl_program *prog)
 
    struct brw_program *bgp = brw_program(prog);
 
-   brw_gs_populate_default_key(&brw->screen->devinfo, &key, prog);
+   brw_gs_populate_default_key(brw->screen->compiler, &key, prog);
 
    success = brw_codegen_gs_prog(brw, bgp, &key);
 
index cff994a9323829c2cc9eab3cf7873eafee3b21c3..7dab548e4b339e3fefd4191582e12d8c6a6297ca 100644 (file)
@@ -41,7 +41,7 @@ void
 brw_gs_populate_key(struct brw_context *brw,
                     struct brw_gs_prog_key *key);
 void
-brw_gs_populate_default_key(const struct gen_device_info *devinfo,
+brw_gs_populate_default_key(const struct brw_compiler *compiler,
                             struct brw_gs_prog_key *key,
                             struct gl_program *prog);
 
index defb465a2e2167b1c7823a279e13f9826501c464..deb0f1cf22565d499ffac01fe78b3ddb5d30e39d 100644 (file)
@@ -885,29 +885,29 @@ brw_prog_key_set_id(union brw_any_prog_key *key, gl_shader_stage stage,
 }
 
 void
-brw_populate_default_key(const struct gen_device_info *devinfo,
+brw_populate_default_key(const struct brw_compiler *compiler,
                          union brw_any_prog_key *prog_key,
                          struct gl_shader_program *sh_prog,
                          struct gl_program *prog)
 {
    switch (prog->info.stage) {
    case MESA_SHADER_VERTEX:
-      brw_vs_populate_default_key(devinfo, &prog_key->vs, prog);
+      brw_vs_populate_default_key(compiler, &prog_key->vs, prog);
       break;
    case MESA_SHADER_TESS_CTRL:
-      brw_tcs_populate_default_key(devinfo, &prog_key->tcs, sh_prog, prog);
+      brw_tcs_populate_default_key(compiler, &prog_key->tcs, sh_prog, prog);
       break;
    case MESA_SHADER_TESS_EVAL:
-      brw_tes_populate_default_key(devinfo, &prog_key->tes, sh_prog, prog);
+      brw_tes_populate_default_key(compiler, &prog_key->tes, sh_prog, prog);
       break;
    case MESA_SHADER_GEOMETRY:
-      brw_gs_populate_default_key(devinfo, &prog_key->gs, prog);
+      brw_gs_populate_default_key(compiler, &prog_key->gs, prog);
       break;
    case MESA_SHADER_FRAGMENT:
-      brw_wm_populate_default_key(devinfo, &prog_key->wm, prog);
+      brw_wm_populate_default_key(compiler, &prog_key->wm, prog);
       break;
    case MESA_SHADER_COMPUTE:
-      brw_cs_populate_default_key(devinfo, &prog_key->cs, prog);
+      brw_cs_populate_default_key(compiler, &prog_key->cs, prog);
       break;
    default:
       unreachable("Unsupported stage!");
index fc10433f322a8097773165214aa78eeded603200..117019d00c71d8012628fdc828367fe8fbdafb64 100644 (file)
@@ -86,7 +86,7 @@ brw_prog_key_set_id(union brw_any_prog_key *key, gl_shader_stage stage,
                     unsigned id);
 
 void
-brw_populate_default_key(const struct gen_device_info *devinfo,
+brw_populate_default_key(const struct brw_compiler *compiler,
                          union brw_any_prog_key *prog_key,
                          struct gl_shader_program *sh_prog,
                          struct gl_program *prog);
@@ -113,14 +113,14 @@ GLboolean brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog
 void brw_upload_tcs_prog(struct brw_context *brw);
 void brw_tcs_populate_key(struct brw_context *brw,
                           struct brw_tcs_prog_key *key);
-void brw_tcs_populate_default_key(const struct gen_device_info *devinfo,
+void brw_tcs_populate_default_key(const struct brw_compiler *compiler,
                                   struct brw_tcs_prog_key *key,
                                   struct gl_shader_program *sh_prog,
                                   struct gl_program *prog);
 void brw_upload_tes_prog(struct brw_context *brw);
 void brw_tes_populate_key(struct brw_context *brw,
                           struct brw_tes_prog_key *key);
-void brw_tes_populate_default_key(const struct gen_device_info *devinfo,
+void brw_tes_populate_default_key(const struct brw_compiler *compiler,
                                   struct brw_tes_prog_key *key,
                                   struct gl_shader_program *sh_prog,
                                   struct gl_program *prog);
index 1298d9e765ec27e7d9c48b16bf00f118ebec723a..a1502695ac1cc82c1e79bb787a9d98441ace636e 100644 (file)
@@ -251,7 +251,7 @@ serialize_gen_part(struct blob *writer, struct gl_context *ctx,
    struct brw_context *brw = brw_context(ctx);
 
    union brw_any_prog_key key;
-   brw_populate_default_key(&brw->screen->devinfo, &key, sh_prog, prog);
+   brw_populate_default_key(brw->screen->compiler, &key, sh_prog, prog);
 
    const gl_shader_stage stage = prog->info.stage;
    uint32_t offset = 0;
index dbb469214b2822f32040cbd0ef8354306f753243..1c4d79886388e0aaedb47d5f2345c3e3b2326f94 100644 (file)
@@ -235,11 +235,12 @@ brw_upload_tcs_prog(struct brw_context *brw)
 }
 
 void
-brw_tcs_populate_default_key(const struct gen_device_info *devinfo,
+brw_tcs_populate_default_key(const struct brw_compiler *compiler,
                              struct brw_tcs_prog_key *key,
                              struct gl_shader_program *sh_prog,
                              struct gl_program *prog)
 {
+   const struct gen_device_info *devinfo = compiler->devinfo;
    struct brw_program *btcp = brw_program(prog);
    const struct gl_linked_shader *tes =
       sh_prog->_LinkedShaders[MESA_SHADER_TESS_EVAL];
@@ -272,6 +273,7 @@ brw_tcs_precompile(struct gl_context *ctx,
                    struct gl_program *prog)
 {
    struct brw_context *brw = brw_context(ctx);
+   const struct brw_compiler *compiler = brw->screen->compiler;
    struct brw_tcs_prog_key key;
    uint32_t old_prog_offset = brw->tcs.base.prog_offset;
    struct brw_stage_prog_data *old_prog_data = brw->tcs.base.prog_data;
@@ -282,7 +284,7 @@ brw_tcs_precompile(struct gl_context *ctx,
       shader_prog->_LinkedShaders[MESA_SHADER_TESS_EVAL];
    struct brw_program *btep = tes ? brw_program(tes->Program) : NULL;
 
-   brw_tcs_populate_default_key(&brw->screen->devinfo, &key, shader_prog, prog);
+   brw_tcs_populate_default_key(compiler, &key, shader_prog, prog);
 
    success = brw_codegen_tcs_prog(brw, btcp, btep, &key);
 
index 6bdd9c0fdcafd03bab36c8520780ffe7ffa83ada..7a55251363c2b203e2f66a209bab7261ac1ce114 100644 (file)
@@ -184,11 +184,12 @@ brw_upload_tes_prog(struct brw_context *brw)
 }
 
 void
-brw_tes_populate_default_key(const struct gen_device_info *devinfo,
+brw_tes_populate_default_key(const struct brw_compiler *compiler,
                              struct brw_tes_prog_key *key,
                              struct gl_shader_program *sh_prog,
                              struct gl_program *prog)
 {
+   const struct gen_device_info *devinfo = compiler->devinfo;
    struct brw_program *btep = brw_program(prog);
 
    memset(key, 0, sizeof(*key));
@@ -214,6 +215,7 @@ brw_tes_precompile(struct gl_context *ctx,
                    struct gl_program *prog)
 {
    struct brw_context *brw = brw_context(ctx);
+   const struct brw_compiler *compiler = brw->screen->compiler;
    struct brw_tes_prog_key key;
    uint32_t old_prog_offset = brw->tes.base.prog_offset;
    struct brw_stage_prog_data *old_prog_data = brw->tes.base.prog_data;
@@ -221,7 +223,7 @@ brw_tes_precompile(struct gl_context *ctx,
 
    struct brw_program *btep = brw_program(prog);
 
-   brw_tes_populate_default_key(&brw->screen->devinfo, &key, shader_prog, prog);
+   brw_tes_populate_default_key(compiler, &key, shader_prog, prog);
 
    success = brw_codegen_tes_prog(brw, btep, &key);
 
index 12ab05c67c488667d07e3cf4d23dd6780984c7d4..c19a326a45589eedf286caf26bdd228359d84f86 100644 (file)
@@ -318,10 +318,11 @@ brw_upload_vs_prog(struct brw_context *brw)
 }
 
 void
-brw_vs_populate_default_key(const struct gen_device_info *devinfo,
+brw_vs_populate_default_key(const struct brw_compiler *compiler,
                             struct brw_vs_prog_key *key,
                             struct gl_program *prog)
 {
+   const struct gen_device_info *devinfo = compiler->devinfo;
    struct brw_program *bvp = brw_program(prog);
 
    memset(key, 0, sizeof(*key));
@@ -345,7 +346,7 @@ brw_vs_precompile(struct gl_context *ctx, struct gl_program *prog)
 
    struct brw_program *bvp = brw_program(prog);
 
-   brw_vs_populate_default_key(&brw->screen->devinfo, &key, prog);
+   brw_vs_populate_default_key(brw->screen->compiler, &key, prog);
 
    success = brw_codegen_vs_prog(brw, bvp, &key);
 
index 94419f3af0c19636f20dc95d6248f4792c482529..207853c7fb5b4ce454eaa855dd2336a35e35a5c3 100644 (file)
@@ -46,7 +46,7 @@ void
 brw_vs_populate_key(struct brw_context *brw,
                     struct brw_vs_prog_key *key);
 void
-brw_vs_populate_default_key(const struct gen_device_info *devinfo,
+brw_vs_populate_default_key(const struct brw_compiler *compiler,
                             struct brw_vs_prog_key *key,
                             struct gl_program *prog);
 
index 996e7a9884c4e08d7412a6db47296479e0e5eda9..bb0fd789d50a92e7fc9a4c6d12d1432af292ff28 100644 (file)
@@ -524,10 +524,12 @@ brw_upload_wm_prog(struct brw_context *brw)
 }
 
 void
-brw_wm_populate_default_key(const struct gen_device_info *devinfo,
+brw_wm_populate_default_key(const struct brw_compiler *compiler,
                             struct brw_wm_prog_key *key,
                             struct gl_program *prog)
 {
+   const struct gen_device_info *devinfo = compiler->devinfo;
+
    memset(key, 0, sizeof(*key));
 
    uint64_t outputs_written = prog->info.outputs_written;
@@ -571,7 +573,7 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_program *prog)
 
    struct brw_program *bfp = brw_program(prog);
 
-   brw_wm_populate_default_key(&brw->screen->devinfo, &key, prog);
+   brw_wm_populate_default_key(brw->screen->compiler, &key, prog);
 
    /* check brw_wm_populate_default_key coherent_fb_fetch setting */
    assert(key.coherent_fb_fetch ==
index ea9449729972c59978f8d10f1e84c7d06580eba9..86980c3dadc996eb8d703e5aba30554306ed2663 100644 (file)
@@ -48,7 +48,7 @@ void
 brw_wm_populate_key(struct brw_context *brw,
                     struct brw_wm_prog_key *key);
 void
-brw_wm_populate_default_key(const struct gen_device_info *devinfo,
+brw_wm_populate_default_key(const struct brw_compiler *compiler,
                             struct brw_wm_prog_key *key,
                             struct gl_program *prog);