From: Michel Dänzer Date: Wed, 18 Apr 2012 08:29:23 +0000 (+0200) Subject: radeonsi: Replace magic numbers with register definitions in sampler state. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=29d7186e4cb2ae01e888368276602fe5072fe2d9;p=mesa.git radeonsi: Replace magic numbers with register definitions in sampler state. --- diff --git a/src/gallium/drivers/radeonsi/evergreen_state.c b/src/gallium/drivers/radeonsi/evergreen_state.c index d70eda012f5..cc271df5a64 100644 --- a/src/gallium/drivers/radeonsi/evergreen_state.c +++ b/src/gallium/drivers/radeonsi/evergreen_state.c @@ -1133,21 +1133,21 @@ static void *si_create_sampler_state(struct pipe_context *ctx, border_color_type = 3; } - rstate->val[0] = si_tex_wrap(state->wrap_s) | - si_tex_wrap(state->wrap_t) << 3 | - si_tex_wrap(state->wrap_r) << 6 | - (state->max_anisotropy & 0x7) << 9 | /* XXX */ - si_tex_compare(state->compare_func) << 12 | - !state->normalized_coords << 15 | - aniso_flag_offset << 16 | /* XXX */ - !state->seamless_cube_map << 28 | - si_tex_mipfilter(state->min_mip_filter) << 29; - rstate->val[1] = S_FIXED(CLAMP(state->min_lod, 0, 15), 8) | - S_FIXED(CLAMP(state->max_lod, 0, 15), 8) << 12; - rstate->val[2] = S_FIXED(CLAMP(state->lod_bias, -16, 16), 8) | - si_tex_filter(state->mag_img_filter) << 20 | - si_tex_filter(state->min_img_filter) << 22; - rstate->val[3] = border_color_type << 30; + rstate->val[0] = (S_008F30_CLAMP_X(si_tex_wrap(state->wrap_s)) | + S_008F30_CLAMP_Y(si_tex_wrap(state->wrap_t)) | + S_008F30_CLAMP_Z(si_tex_wrap(state->wrap_r)) | + (state->max_anisotropy & 0x7) << 9 | /* XXX */ + S_008F30_DEPTH_COMPARE_FUNC(si_tex_compare(state->compare_func)) | + S_008F30_FORCE_UNNORMALIZED(!state->normalized_coords) | + aniso_flag_offset << 16 | /* XXX */ + S_008F30_DISABLE_CUBE_WRAP(!state->seamless_cube_map) | + S_008F30_FILTER_MODE(si_tex_mipfilter(state->min_mip_filter))); + rstate->val[1] = (S_008F34_MIN_LOD(S_FIXED(CLAMP(state->min_lod, 0, 15), 8)) | + S_008F34_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 8))); + rstate->val[2] = (S_008F38_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 8)) | + S_008F38_XY_MAG_FILTER(si_tex_filter(state->mag_img_filter)) | + S_008F38_XY_MIN_FILTER(si_tex_filter(state->min_img_filter))); + rstate->val[3] = S_008F3C_BORDER_COLOR_TYPE(border_color_type); #if 0 if (border_color_type == 3) {