intel/fs: add plumbing for embedded samplers
We can address samplers from 3 different locations : - binding table - dynamic state base address - bindless sampler base address (only Gfx11+) Here we allow samplers to be address from the dynamic state base address with the embedded sampler flag. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Ivan Briano <ivan.briano@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22151>
This commit is contained in:

committed by
Marge Bot

parent
3f25b2826f
commit
99047451c9
@@ -467,6 +467,8 @@ enum brw_param_builtin {
|
||||
#define BRW_PARAM_BUILTIN_CLIP_PLANE_COMP(param) \
|
||||
(((param) - BRW_PARAM_BUILTIN_CLIP_PLANE_0_X) & 0x3)
|
||||
|
||||
#define BRW_MAX_EMBEDDED_SAMPLERS (4096)
|
||||
|
||||
enum brw_shader_reloc_id {
|
||||
BRW_SHADER_RELOC_CONST_DATA_ADDR_LOW,
|
||||
BRW_SHADER_RELOC_CONST_DATA_ADDR_HIGH,
|
||||
@@ -474,6 +476,9 @@ enum brw_shader_reloc_id {
|
||||
BRW_SHADER_RELOC_RESUME_SBT_ADDR_LOW,
|
||||
BRW_SHADER_RELOC_RESUME_SBT_ADDR_HIGH,
|
||||
BRW_SHADER_RELOC_DESCRIPTORS_ADDR_HIGH,
|
||||
BRW_SHADER_RELOC_EMBEDDED_SAMPLER_HANDLE,
|
||||
BRW_SHADER_RELOC_LAST_EMBEDDED_SAMPLER_HANDLE =
|
||||
BRW_SHADER_RELOC_EMBEDDED_SAMPLER_HANDLE + BRW_MAX_EMBEDDED_SAMPLERS - 1,
|
||||
};
|
||||
|
||||
enum brw_shader_reloc_type {
|
||||
|
@@ -4643,13 +4643,25 @@ try_rebuild_resource(nir_to_brw_state &ntb, const brw::fs_builder &bld, nir_def
|
||||
} else {
|
||||
assert(def->parent_instr->type == nir_instr_type_intrinsic &&
|
||||
(nir_instr_as_intrinsic(def->parent_instr)->intrinsic ==
|
||||
nir_intrinsic_load_uniform));
|
||||
nir_intrinsic_load_uniform ||
|
||||
nir_instr_as_intrinsic(def->parent_instr)->intrinsic ==
|
||||
nir_intrinsic_load_reloc_const_intel));
|
||||
nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(def->parent_instr);
|
||||
unsigned base_offset = nir_intrinsic_base(intrin);
|
||||
unsigned load_offset = nir_src_as_uint(intrin->src[0]);
|
||||
fs_reg src(UNIFORM, base_offset / 4, BRW_REGISTER_TYPE_UD);
|
||||
src.offset = load_offset + base_offset % 4;
|
||||
return src;
|
||||
switch (intrin->intrinsic) {
|
||||
case nir_intrinsic_load_uniform: {
|
||||
unsigned base_offset = nir_intrinsic_base(intrin);
|
||||
unsigned load_offset = nir_src_as_uint(intrin->src[0]);
|
||||
fs_reg src(UNIFORM, base_offset / 4, BRW_REGISTER_TYPE_UD);
|
||||
src.offset = load_offset + base_offset % 4;
|
||||
return src;
|
||||
}
|
||||
|
||||
default:
|
||||
/* Execute the code below, since we have to generate new
|
||||
* instructions.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4759,6 +4771,14 @@ try_rebuild_resource(nir_to_brw_state &ntb, const brw::fs_builder &bld, nir_def
|
||||
break;
|
||||
}
|
||||
|
||||
case nir_intrinsic_load_reloc_const_intel: {
|
||||
uint32_t id = nir_intrinsic_param_idx(intrin);
|
||||
fs_reg dst = ubld8.vgrf(BRW_REGISTER_TYPE_UD);
|
||||
ntb.resource_insts[def->index] =
|
||||
ubld8.emit(SHADER_OPCODE_MOV_RELOC_IMM, dst,
|
||||
brw_imm_ud(id), brw_imm_ud(0));
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -8520,4 +8540,3 @@ nir_to_brw(fs_visitor *s)
|
||||
|
||||
ralloc_free(ntb.mem_ctx);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user