draw: add sampler max_aniso query.

Add support for draw shaders for retrieve max anisotropy.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8804>
This commit is contained in:
Dave Airlie 2021-02-08 12:33:51 +10:00
parent 9cfcf3783b
commit 0bb23ed6db
3 changed files with 13 additions and 1 deletions

View file

@ -219,7 +219,8 @@ create_jit_sampler_type(struct gallivm_state *gallivm, const char *struct_name)
elem_types[DRAW_JIT_SAMPLER_MIN_LOD] =
elem_types[DRAW_JIT_SAMPLER_MAX_LOD] =
elem_types[DRAW_JIT_SAMPLER_LOD_BIAS] = LLVMFloatTypeInContext(gallivm->context);
elem_types[DRAW_JIT_SAMPLER_LOD_BIAS] =
elem_types[DRAW_JIT_SAMPLER_MAX_ANISO] = LLVMFloatTypeInContext(gallivm->context);
elem_types[DRAW_JIT_SAMPLER_BORDER_COLOR] =
LLVMArrayType(LLVMFloatTypeInContext(gallivm->context), 4);
@ -239,6 +240,9 @@ create_jit_sampler_type(struct gallivm_state *gallivm, const char *struct_name)
LP_CHECK_MEMBER_OFFSET(struct draw_jit_sampler, border_color,
target, sampler_type,
DRAW_JIT_SAMPLER_BORDER_COLOR);
LP_CHECK_MEMBER_OFFSET(struct draw_jit_sampler, max_aniso,
target, sampler_type,
DRAW_JIT_SAMPLER_MAX_ANISO);
LP_CHECK_STRUCT_SIZE(struct draw_jit_sampler, target, sampler_type);
@ -2601,6 +2605,7 @@ draw_llvm_set_sampler_state(struct draw_context *draw,
jit_sam->min_lod = s->min_lod;
jit_sam->max_lod = s->max_lod;
jit_sam->lod_bias = s->lod_bias;
jit_sam->max_aniso = s->max_anisotropy;
COPY_4V(jit_sam->border_color, s->border_color.f);
}
}
@ -2615,6 +2620,7 @@ draw_llvm_set_sampler_state(struct draw_context *draw,
jit_sam->min_lod = s->min_lod;
jit_sam->max_lod = s->max_lod;
jit_sam->lod_bias = s->lod_bias;
jit_sam->max_aniso = s->max_anisotropy;
COPY_4V(jit_sam->border_color, s->border_color.f);
}
}
@ -2629,6 +2635,7 @@ draw_llvm_set_sampler_state(struct draw_context *draw,
jit_sam->min_lod = s->min_lod;
jit_sam->max_lod = s->max_lod;
jit_sam->lod_bias = s->lod_bias;
jit_sam->max_aniso = s->max_anisotropy;
COPY_4V(jit_sam->border_color, s->border_color.f);
}
}
@ -2643,6 +2650,7 @@ draw_llvm_set_sampler_state(struct draw_context *draw,
jit_sam->min_lod = s->min_lod;
jit_sam->max_lod = s->max_lod;
jit_sam->lod_bias = s->lod_bias;
jit_sam->max_aniso = s->max_anisotropy;
COPY_4V(jit_sam->border_color, s->border_color.f);
}
}

View file

@ -86,6 +86,7 @@ struct draw_jit_sampler
float max_lod;
float lod_bias;
float border_color[4];
float max_aniso;
};
@ -122,6 +123,7 @@ enum {
DRAW_JIT_SAMPLER_MAX_LOD,
DRAW_JIT_SAMPLER_LOD_BIAS,
DRAW_JIT_SAMPLER_BORDER_COLOR,
DRAW_JIT_SAMPLER_MAX_ANISO,
DRAW_JIT_SAMPLER_NUM_FIELDS /* number of fields above */
};

View file

@ -289,6 +289,7 @@ DRAW_LLVM_SAMPLER_MEMBER(min_lod, DRAW_JIT_SAMPLER_MIN_LOD, TRUE)
DRAW_LLVM_SAMPLER_MEMBER(max_lod, DRAW_JIT_SAMPLER_MAX_LOD, TRUE)
DRAW_LLVM_SAMPLER_MEMBER(lod_bias, DRAW_JIT_SAMPLER_LOD_BIAS, TRUE)
DRAW_LLVM_SAMPLER_MEMBER(border_color, DRAW_JIT_SAMPLER_BORDER_COLOR, FALSE)
DRAW_LLVM_SAMPLER_MEMBER(max_aniso, DRAW_JIT_SAMPLER_MAX_ANISO, TRUE)
#define DRAW_LLVM_IMAGE_MEMBER(_name, _index, _emit_load) \
static LLVMValueRef \
@ -405,6 +406,7 @@ draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_stat
sampler->dynamic_state.base.max_lod = draw_llvm_sampler_max_lod;
sampler->dynamic_state.base.lod_bias = draw_llvm_sampler_lod_bias;
sampler->dynamic_state.base.border_color = draw_llvm_sampler_border_color;
sampler->dynamic_state.base.max_aniso = draw_llvm_sampler_max_aniso;
sampler->dynamic_state.static_state = static_state;
sampler->nr_samplers = nr_samplers;