llvmpipe: add support for max aniso query.
This just joins the sampler code to the llvmpipe shader stages. Reviewed-by: Roland Scheidegger <sroland@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8804>
This commit is contained in:
@@ -111,7 +111,8 @@ create_jit_sampler_type(struct gallivm_state *gallivm)
|
||||
LLVMTypeRef elem_types[LP_JIT_SAMPLER_NUM_FIELDS];
|
||||
elem_types[LP_JIT_SAMPLER_MIN_LOD] =
|
||||
elem_types[LP_JIT_SAMPLER_MAX_LOD] =
|
||||
elem_types[LP_JIT_SAMPLER_LOD_BIAS] = LLVMFloatTypeInContext(lc);
|
||||
elem_types[LP_JIT_SAMPLER_LOD_BIAS] =
|
||||
elem_types[LP_JIT_SAMPLER_MAX_ANISO] = LLVMFloatTypeInContext(lc);
|
||||
elem_types[LP_JIT_SAMPLER_BORDER_COLOR] =
|
||||
LLVMArrayType(LLVMFloatTypeInContext(lc), 4);
|
||||
|
||||
@@ -130,6 +131,9 @@ create_jit_sampler_type(struct gallivm_state *gallivm)
|
||||
LP_CHECK_MEMBER_OFFSET(struct lp_jit_sampler, border_color,
|
||||
gallivm->target, sampler_type,
|
||||
LP_JIT_SAMPLER_BORDER_COLOR);
|
||||
LP_CHECK_MEMBER_OFFSET(struct lp_jit_sampler, max_aniso,
|
||||
gallivm->target, sampler_type,
|
||||
LP_JIT_SAMPLER_MAX_ANISO);
|
||||
LP_CHECK_STRUCT_SIZE(struct lp_jit_sampler,
|
||||
gallivm->target, sampler_type);
|
||||
return sampler_type;
|
||||
|
||||
@@ -71,6 +71,7 @@ struct lp_jit_sampler
|
||||
float max_lod;
|
||||
float lod_bias;
|
||||
float border_color[4];
|
||||
float max_aniso;
|
||||
};
|
||||
|
||||
|
||||
@@ -114,6 +115,7 @@ enum {
|
||||
LP_JIT_SAMPLER_MAX_LOD,
|
||||
LP_JIT_SAMPLER_LOD_BIAS,
|
||||
LP_JIT_SAMPLER_BORDER_COLOR,
|
||||
LP_JIT_SAMPLER_MAX_ANISO,
|
||||
LP_JIT_SAMPLER_NUM_FIELDS /* number of fields above */
|
||||
};
|
||||
|
||||
|
||||
@@ -1057,6 +1057,7 @@ lp_setup_set_fragment_sampler_state(struct lp_setup_context *setup,
|
||||
jit_sam->min_lod = sampler->min_lod;
|
||||
jit_sam->max_lod = sampler->max_lod;
|
||||
jit_sam->lod_bias = sampler->lod_bias;
|
||||
jit_sam->max_aniso = sampler->max_anisotropy;
|
||||
COPY_4V(jit_sam->border_color, sampler->border_color.f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -644,6 +644,7 @@ dump_cs_variant_key(const struct lp_compute_shader_variant_key *key)
|
||||
debug_printf(" .lod_bias_non_zero = %u\n", sampler->lod_bias_non_zero);
|
||||
debug_printf(" .apply_min_lod = %u\n", sampler->apply_min_lod);
|
||||
debug_printf(" .apply_max_lod = %u\n", sampler->apply_max_lod);
|
||||
debug_printf(" .aniso = %u\n", sampler->aniso);
|
||||
}
|
||||
for (i = 0; i < key->nr_sampler_views; ++i) {
|
||||
const struct lp_static_texture_state *texture = &key->samplers[i].texture_state;
|
||||
@@ -1049,6 +1050,7 @@ lp_csctx_set_sampler_state(struct lp_cs_context *csctx,
|
||||
jit_sam->min_lod = sampler->min_lod;
|
||||
jit_sam->max_lod = sampler->max_lod;
|
||||
jit_sam->lod_bias = sampler->lod_bias;
|
||||
jit_sam->max_aniso = sampler->max_anisotropy;
|
||||
COPY_4V(jit_sam->border_color, sampler->border_color.f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3408,6 +3408,7 @@ dump_fs_variant_key(struct lp_fragment_shader_variant_key *key)
|
||||
debug_printf(" .apply_min_lod = %u\n", sampler->apply_min_lod);
|
||||
debug_printf(" .apply_max_lod = %u\n", sampler->apply_max_lod);
|
||||
debug_printf(" .reduction_mode = %u\n", sampler->reduction_mode);
|
||||
debug_printf(" .aniso = %u\n", sampler->aniso);
|
||||
}
|
||||
for (i = 0; i < key->nr_sampler_views; ++i) {
|
||||
const struct lp_static_texture_state *texture = &key->samplers[i].texture_state;
|
||||
|
||||
@@ -248,6 +248,7 @@ LP_LLVM_SAMPLER_MEMBER(min_lod, LP_JIT_SAMPLER_MIN_LOD, TRUE)
|
||||
LP_LLVM_SAMPLER_MEMBER(max_lod, LP_JIT_SAMPLER_MAX_LOD, TRUE)
|
||||
LP_LLVM_SAMPLER_MEMBER(lod_bias, LP_JIT_SAMPLER_LOD_BIAS, TRUE)
|
||||
LP_LLVM_SAMPLER_MEMBER(border_color, LP_JIT_SAMPLER_BORDER_COLOR, FALSE)
|
||||
LP_LLVM_SAMPLER_MEMBER(max_aniso, LP_JIT_SAMPLER_MAX_ANISO, TRUE)
|
||||
|
||||
|
||||
/**
|
||||
@@ -446,6 +447,7 @@ lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
|
||||
sampler->dynamic_state.base.max_lod = lp_llvm_sampler_max_lod;
|
||||
sampler->dynamic_state.base.lod_bias = lp_llvm_sampler_lod_bias;
|
||||
sampler->dynamic_state.base.border_color = lp_llvm_sampler_border_color;
|
||||
sampler->dynamic_state.base.max_aniso = lp_llvm_sampler_max_aniso;
|
||||
|
||||
#if LP_USE_TEXTURE_CACHE
|
||||
sampler->dynamic_state.base.cache_ptr = lp_llvm_texture_cache_ptr;
|
||||
|
||||
Reference in New Issue
Block a user