nir: add nir_texop_sampler_descriptor_amd
We'll use it to query the min/mag filter in the shader. Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19422>
This commit is contained in:
@@ -4767,13 +4767,19 @@ static void visit_tex(struct ac_nir_context *ctx, nir_tex_instr *instr)
|
||||
|
||||
/* Don't use the waterfall loop when returning a descriptor. */
|
||||
tex_fetch_ptrs(ctx, instr, wctx, &args.resource, &args.sampler, &fmask_ptr,
|
||||
instr->op != nir_texop_descriptor_amd);
|
||||
instr->op != nir_texop_descriptor_amd &&
|
||||
instr->op != nir_texop_sampler_descriptor_amd);
|
||||
|
||||
if (instr->op == nir_texop_descriptor_amd) {
|
||||
result = args.resource;
|
||||
goto write_result;
|
||||
}
|
||||
|
||||
if (instr->op == nir_texop_sampler_descriptor_amd) {
|
||||
result = args.sampler;
|
||||
goto write_result;
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < instr->num_srcs; i++) {
|
||||
switch (instr->src[i].src_type) {
|
||||
case nir_tex_src_coord: {
|
||||
|
@@ -3237,6 +3237,9 @@ nir_tex_instr_result_size(const nir_tex_instr *instr)
|
||||
case nir_texop_descriptor_amd:
|
||||
return instr->sampler_dim == GLSL_SAMPLER_DIM_BUF ? 4 : 8;
|
||||
|
||||
case nir_texop_sampler_descriptor_amd:
|
||||
return 4;
|
||||
|
||||
default:
|
||||
if (instr->is_shadow && instr->is_new_style_shadow)
|
||||
return 1;
|
||||
@@ -3254,6 +3257,7 @@ nir_tex_instr_is_query(const nir_tex_instr *instr)
|
||||
case nir_texop_texture_samples:
|
||||
case nir_texop_query_levels:
|
||||
case nir_texop_descriptor_amd:
|
||||
case nir_texop_sampler_descriptor_amd:
|
||||
return true;
|
||||
case nir_texop_tex:
|
||||
case nir_texop_txb:
|
||||
|
@@ -2198,6 +2198,7 @@ typedef enum {
|
||||
nir_texop_fragment_fetch_amd, /**< Multisample fragment color texture fetch */
|
||||
nir_texop_fragment_mask_fetch_amd, /**< Multisample fragment mask texture fetch */
|
||||
nir_texop_descriptor_amd, /**< Returns a buffer or image descriptor. */
|
||||
nir_texop_sampler_descriptor_amd, /**< Returns a sampler descriptor. */
|
||||
} nir_texop;
|
||||
|
||||
/** Represents a texture instruction */
|
||||
|
@@ -1275,6 +1275,9 @@ print_tex_instr(nir_tex_instr *instr, print_state *state)
|
||||
case nir_texop_descriptor_amd:
|
||||
fprintf(fp, "descriptor_amd ");
|
||||
break;
|
||||
case nir_texop_sampler_descriptor_amd:
|
||||
fprintf(fp, "sampler_descriptor_amd ");
|
||||
break;
|
||||
default:
|
||||
unreachable("Invalid texture operation");
|
||||
break;
|
||||
|
@@ -900,6 +900,7 @@ validate_tex_instr(nir_tex_instr *instr, validate_state *state)
|
||||
glsl_type_is_sampler(deref->type));
|
||||
switch (instr->op) {
|
||||
case nir_texop_descriptor_amd:
|
||||
case nir_texop_sampler_descriptor_amd:
|
||||
break;
|
||||
case nir_texop_lod:
|
||||
validate_assert(state, nir_alu_type_get_base_type(instr->dest_type) == nir_type_float);
|
||||
|
@@ -2844,7 +2844,8 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
|
||||
vtn_fail("unexpected nir_texop_tex_prefetch");
|
||||
break;
|
||||
case nir_texop_descriptor_amd:
|
||||
vtn_fail("unexpected nir_texop_descriptor_amd");
|
||||
case nir_texop_sampler_descriptor_amd:
|
||||
vtn_fail("unexpected nir_texop_*descriptor_amd");
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user