We now get everything we need directly from gl_program so there is no need for this. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>tags/17.0-branchpoint
| static void | static void | ||||
| assign_cs_binding_table_offsets(const struct gen_device_info *devinfo, | assign_cs_binding_table_offsets(const struct gen_device_info *devinfo, | ||||
| const struct gl_shader_program *shader_prog, | |||||
| const struct gl_program *prog, | const struct gl_program *prog, | ||||
| struct brw_cs_prog_data *prog_data) | struct brw_cs_prog_data *prog_data) | ||||
| { | { | ||||
| prog_data->binding_table.work_groups_start = next_binding_table_offset; | prog_data->binding_table.work_groups_start = next_binding_table_offset; | ||||
| next_binding_table_offset++; | next_binding_table_offset++; | ||||
| brw_assign_common_binding_table_offsets(MESA_SHADER_COMPUTE, devinfo, | |||||
| shader_prog, prog, &prog_data->base, | |||||
| brw_assign_common_binding_table_offsets(devinfo, prog, &prog_data->base, | |||||
| next_binding_table_offset); | next_binding_table_offset); | ||||
| } | } | ||||
| prog_data.base.total_shared = cp->program.info.cs.shared_size; | prog_data.base.total_shared = cp->program.info.cs.shared_size; | ||||
| } | } | ||||
| assign_cs_binding_table_offsets(devinfo, prog, &cp->program, &prog_data); | |||||
| assign_cs_binding_table_offsets(devinfo, &cp->program, &prog_data); | |||||
| /* Allocate the references to the uniforms that will end up in the | /* Allocate the references to the uniforms that will end up in the | ||||
| * prog_data associated with the compiled program, and which will be freed | * prog_data associated with the compiled program, and which will be freed |
| static void | static void | ||||
| assign_gs_binding_table_offsets(const struct gen_device_info *devinfo, | assign_gs_binding_table_offsets(const struct gen_device_info *devinfo, | ||||
| const struct gl_shader_program *shader_prog, | |||||
| const struct gl_program *prog, | const struct gl_program *prog, | ||||
| struct brw_gs_prog_data *prog_data) | struct brw_gs_prog_data *prog_data) | ||||
| { | { | ||||
| */ | */ | ||||
| uint32_t reserved = devinfo->gen == 6 ? BRW_MAX_SOL_BINDINGS : 0; | uint32_t reserved = devinfo->gen == 6 ? BRW_MAX_SOL_BINDINGS : 0; | ||||
| brw_assign_common_binding_table_offsets(MESA_SHADER_GEOMETRY, devinfo, | |||||
| shader_prog, prog, | |||||
| &prog_data->base.base, | |||||
| reserved); | |||||
| brw_assign_common_binding_table_offsets(devinfo, prog, | |||||
| &prog_data->base.base, reserved); | |||||
| } | } | ||||
| bool | bool | ||||
| memset(&prog_data, 0, sizeof(prog_data)); | memset(&prog_data, 0, sizeof(prog_data)); | ||||
| assign_gs_binding_table_offsets(devinfo, prog, &gp->program, &prog_data); | |||||
| assign_gs_binding_table_offsets(devinfo, &gp->program, &prog_data); | |||||
| /* Allocate the references to the uniforms that will end up in the | /* Allocate the references to the uniforms that will end up in the | ||||
| * prog_data associated with the compiled program, and which will be freed | * prog_data associated with the compiled program, and which will be freed |
| * trigger some of our asserts that surface indices are < BRW_MAX_SURFACES. | * trigger some of our asserts that surface indices are < BRW_MAX_SURFACES. | ||||
| */ | */ | ||||
| uint32_t | uint32_t | ||||
| brw_assign_common_binding_table_offsets(gl_shader_stage stage, | |||||
| const struct gen_device_info *devinfo, | |||||
| const struct gl_shader_program *shader_prog, | |||||
| brw_assign_common_binding_table_offsets(const struct gen_device_info *devinfo, | |||||
| const struct gl_program *prog, | const struct gl_program *prog, | ||||
| struct brw_stage_prog_data *stage_prog_data, | struct brw_stage_prog_data *stage_prog_data, | ||||
| uint32_t next_binding_table_offset) | uint32_t next_binding_table_offset) | ||||
| { | { | ||||
| const struct gl_linked_shader *shader = NULL; | |||||
| int num_textures = util_last_bit(prog->SamplersUsed); | int num_textures = util_last_bit(prog->SamplersUsed); | ||||
| if (shader_prog) | |||||
| shader = shader_prog->_LinkedShaders[stage]; | |||||
| stage_prog_data->binding_table.texture_start = next_binding_table_offset; | stage_prog_data->binding_table.texture_start = next_binding_table_offset; | ||||
| next_binding_table_offset += num_textures; | next_binding_table_offset += num_textures; | ||||
| }; | }; | ||||
| uint32_t | uint32_t | ||||
| brw_assign_common_binding_table_offsets(gl_shader_stage stage, | |||||
| const struct gen_device_info *devinfo, | |||||
| const struct gl_shader_program *shader_prog, | |||||
| brw_assign_common_binding_table_offsets(const struct gen_device_info *devinfo, | |||||
| const struct gl_program *prog, | const struct gl_program *prog, | ||||
| struct brw_stage_prog_data *stage_prog_data, | struct brw_stage_prog_data *stage_prog_data, | ||||
| uint32_t next_binding_table_offset); | uint32_t next_binding_table_offset); |
| prog_data.base.base.nr_params = param_count; | prog_data.base.base.nr_params = param_count; | ||||
| if (tcp) { | if (tcp) { | ||||
| brw_assign_common_binding_table_offsets(MESA_SHADER_TESS_CTRL, devinfo, | |||||
| shader_prog, &tcp->program, | |||||
| brw_assign_common_binding_table_offsets(devinfo, &tcp->program, | |||||
| &prog_data.base.base, 0); | &prog_data.base.base, 0); | ||||
| prog_data.base.base.image_param = | prog_data.base.base.image_param = |
| memset(&prog_data, 0, sizeof(prog_data)); | memset(&prog_data, 0, sizeof(prog_data)); | ||||
| brw_assign_common_binding_table_offsets(MESA_SHADER_TESS_EVAL, devinfo, | |||||
| shader_prog, &tep->program, | |||||
| brw_assign_common_binding_table_offsets(devinfo, &tep->program, | |||||
| &prog_data.base.base, 0); | &prog_data.base.base, 0); | ||||
| switch (tep->program.info.tes.spacing) { | switch (tep->program.info.tes.spacing) { |
| mem_ctx = ralloc_context(NULL); | mem_ctx = ralloc_context(NULL); | ||||
| brw_assign_common_binding_table_offsets(MESA_SHADER_VERTEX, devinfo, prog, | |||||
| &vp->program, &prog_data.base.base, | |||||
| 0); | |||||
| brw_assign_common_binding_table_offsets(devinfo, &vp->program, | |||||
| &prog_data.base.base, 0); | |||||
| /* Allocate the references to the uniforms that will end up in the | /* Allocate the references to the uniforms that will end up in the | ||||
| * prog_data associated with the compiled program, and which will be freed | * prog_data associated with the compiled program, and which will be freed |
| static void | static void | ||||
| assign_fs_binding_table_offsets(const struct gen_device_info *devinfo, | assign_fs_binding_table_offsets(const struct gen_device_info *devinfo, | ||||
| const struct gl_shader_program *shader_prog, | |||||
| const struct gl_program *prog, | const struct gl_program *prog, | ||||
| const struct brw_wm_prog_key *key, | const struct brw_wm_prog_key *key, | ||||
| struct brw_wm_prog_data *prog_data) | struct brw_wm_prog_data *prog_data) | ||||
| next_binding_table_offset += MAX2(key->nr_color_regions, 1); | next_binding_table_offset += MAX2(key->nr_color_regions, 1); | ||||
| next_binding_table_offset = | next_binding_table_offset = | ||||
| brw_assign_common_binding_table_offsets(MESA_SHADER_FRAGMENT, devinfo, | |||||
| shader_prog, prog, &prog_data->base, | |||||
| brw_assign_common_binding_table_offsets(devinfo, prog, &prog_data->base, | |||||
| next_binding_table_offset); | next_binding_table_offset); | ||||
| if (prog->nir->info->outputs_read && !key->coherent_fb_fetch) { | if (prog->nir->info->outputs_read && !key->coherent_fb_fetch) { | ||||
| if (!prog) | if (!prog) | ||||
| prog_data.base.use_alt_mode = true; | prog_data.base.use_alt_mode = true; | ||||
| assign_fs_binding_table_offsets(devinfo, prog, &fp->program, key, | |||||
| &prog_data); | |||||
| assign_fs_binding_table_offsets(devinfo, &fp->program, key, &prog_data); | |||||
| /* Allocate the references to the uniforms that will end up in the | /* Allocate the references to the uniforms that will end up in the | ||||
| * prog_data associated with the compiled program, and which will be freed | * prog_data associated with the compiled program, and which will be freed |