mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 10:20:09 +01:00
nir: add nir_tex_src_{sampler,texture}_deref_intrinsic
To be used as a placeholder until after function inlining so we can replace function params with bindless handles if needed. Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30315>
This commit is contained in:
parent
ef13ff00d1
commit
017770ff14
5 changed files with 41 additions and 0 deletions
|
|
@ -3222,6 +3222,8 @@ nir_tex_instr_src_type(const nir_tex_instr *instr, unsigned src)
|
|||
case nir_tex_src_plane:
|
||||
return nir_type_int;
|
||||
|
||||
case nir_tex_src_sampler_deref_intrinsic:
|
||||
case nir_tex_src_texture_deref_intrinsic:
|
||||
case nir_tex_src_ms_mcs_intel:
|
||||
case nir_tex_src_texture_deref:
|
||||
case nir_tex_src_sampler_deref:
|
||||
|
|
|
|||
|
|
@ -2328,6 +2328,15 @@ typedef enum nir_tex_src_type {
|
|||
*/
|
||||
nir_tex_src_sampler_handle,
|
||||
|
||||
/** Tex src intrinsic
|
||||
*
|
||||
* This is an intrinsic used before function inlining i.e. before we know
|
||||
* if a bindless value has been given as function param for use as a tex
|
||||
* src.
|
||||
*/
|
||||
nir_tex_src_sampler_deref_intrinsic,
|
||||
nir_tex_src_texture_deref_intrinsic,
|
||||
|
||||
/** Plane index for multi-plane YCbCr textures */
|
||||
nir_tex_src_plane,
|
||||
|
||||
|
|
|
|||
|
|
@ -1082,6 +1082,11 @@ intrinsic("load_persp_center_rhw_ir3", dest_comp=1,
|
|||
intrinsic("load_texture_scale", src_comp=[1], dest_comp=2,
|
||||
flags=[CAN_ELIMINATE, CAN_REORDER])
|
||||
|
||||
# Gets the texture src. This intrinsic will be lowered once functions have
|
||||
# been inlined and we know if the src is bindless or not.
|
||||
intrinsic("deref_texture_src", src_comp=[1], dest_comp=1,
|
||||
flags=[CAN_ELIMINATE, CAN_REORDER])
|
||||
|
||||
# Fragment shader input interpolation delta intrinsic.
|
||||
#
|
||||
# For hw where fragment shader input interpolation is handled in shader, the
|
||||
|
|
|
|||
|
|
@ -1797,6 +1797,14 @@ print_tex_instr(nir_tex_instr *instr, print_state *state)
|
|||
case nir_tex_src_ddy:
|
||||
fprintf(fp, "(ddy)");
|
||||
break;
|
||||
case nir_tex_src_sampler_deref_intrinsic:
|
||||
has_texture_deref = true;
|
||||
fprintf(fp, "(sampler_deref_intrinsic)");
|
||||
break;
|
||||
case nir_tex_src_texture_deref_intrinsic:
|
||||
has_texture_deref = true;
|
||||
fprintf(fp, "(texture_deref_intrinsic)");
|
||||
break;
|
||||
case nir_tex_src_texture_deref:
|
||||
has_texture_deref = true;
|
||||
fprintf(fp, "(texture_deref)");
|
||||
|
|
|
|||
|
|
@ -898,6 +898,23 @@ validate_tex_instr(nir_tex_instr *instr, validate_state *state)
|
|||
break;
|
||||
}
|
||||
|
||||
case nir_tex_src_sampler_deref_intrinsic:
|
||||
case nir_tex_src_texture_deref_intrinsic: {
|
||||
nir_intrinsic_instr *intrin =
|
||||
nir_instr_as_intrinsic(instr->src[i].src.ssa->parent_instr);
|
||||
nir_deref_instr *deref =
|
||||
nir_instr_as_deref(intrin->src[0].ssa->parent_instr);
|
||||
if (!validate_assert(state, deref))
|
||||
break;
|
||||
|
||||
if (instr->src[i].src_type == nir_tex_src_sampler_deref_intrinsic)
|
||||
validate_assert(state, glsl_type_is_sampler(deref->type));
|
||||
else
|
||||
validate_tex_src_texture_deref(instr, state, deref);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case nir_tex_src_coord:
|
||||
case nir_tex_src_projector:
|
||||
case nir_tex_src_offset:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue