radeonsi: set more sampler settings
authorMarek Olšák <marek.olsak@amd.com>
Sun, 21 Aug 2016 14:13:16 +0000 (16:13 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 5 Sep 2016 16:01:15 +0000 (18:01 +0200)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_state.c
src/gallium/drivers/radeonsi/sid.h

index 375e74bba552304a87ba3b9f655586c10188bb0a..a1c8720ce702c1639676f0b6f8d19a6c78b27232 100644 (file)
@@ -2826,7 +2826,8 @@ si_make_texture_descriptor(struct si_screen *screen,
        state[1] = (S_008F14_DATA_FORMAT(data_format) |
                    S_008F14_NUM_FORMAT(num_format));
        state[2] = (S_008F18_WIDTH(width - 1) |
-                   S_008F18_HEIGHT(height - 1));
+                   S_008F18_HEIGHT(height - 1) |
+                   S_008F18_PERF_MOD(4));
        state[3] = (S_008F1C_DST_SEL_X(si_map_swizzle(swizzle[0])) |
                    S_008F1C_DST_SEL_Y(si_map_swizzle(swizzle[1])) |
                    S_008F1C_DST_SEL_Z(si_map_swizzle(swizzle[2])) |
@@ -3172,10 +3173,13 @@ static void *si_create_sampler_state(struct pipe_context *ctx,
                          S_008F30_MAX_ANISO_RATIO(max_aniso_ratio) |
                          S_008F30_DEPTH_COMPARE_FUNC(si_tex_compare(state->compare_func)) |
                          S_008F30_FORCE_UNNORMALIZED(!state->normalized_coords) |
+                         S_008F30_ANISO_THRESHOLD(max_aniso_ratio >> 1) |
+                         S_008F30_ANISO_BIAS(max_aniso_ratio) |
                          S_008F30_DISABLE_CUBE_WRAP(!state->seamless_cube_map) |
                          S_008F30_COMPAT_MODE(sctx->b.chip_class >= VI));
        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)));
+                         S_008F34_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 8)) |
+                         S_008F34_PERF_MIP(max_aniso_ratio ? max_aniso_ratio + 6 : 0));
        rstate->val[2] = (S_008F38_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 8)) |
                          S_008F38_XY_MAG_FILTER(eg_tex_filter(state->mag_img_filter, max_aniso)) |
                          S_008F38_XY_MIN_FILTER(eg_tex_filter(state->min_img_filter, max_aniso)) |
index 9c74a6a8855bf2dd07af7459b80106a6c0ce9d8f..888de111a1fad94e7e2160a54099501a3357e161 100644 (file)
 #define   S_008F30_FORCE_UNNORMALIZED(x)                              (((unsigned)(x) & 0x1) << 15)
 #define   G_008F30_FORCE_UNNORMALIZED(x)                              (((x) >> 15) & 0x1)
 #define   C_008F30_FORCE_UNNORMALIZED                                 0xFFFF7FFF
+#define   S_008F30_ANISO_THRESHOLD(x)                                 (((unsigned)(x) & 0x07) << 16)
+#define   G_008F30_ANISO_THRESHOLD(x)                                 (((x) >> 16) & 0x07)
+#define   C_008F30_ANISO_THRESHOLD                                    0xFFF8FFFF
 #define   S_008F30_MC_COORD_TRUNC(x)                                  (((unsigned)(x) & 0x1) << 19)
 #define   G_008F30_MC_COORD_TRUNC(x)                                  (((x) >> 19) & 0x1)
 #define   C_008F30_MC_COORD_TRUNC                                     0xFFF7FFFF
 #define   S_008F30_FORCE_DEGAMMA(x)                                   (((unsigned)(x) & 0x1) << 20)
 #define   G_008F30_FORCE_DEGAMMA(x)                                   (((x) >> 20) & 0x1)
 #define   C_008F30_FORCE_DEGAMMA                                      0xFFEFFFFF
+#define   S_008F30_ANISO_BIAS(x)                                      (((unsigned)(x) & 0x3F) << 21)
+#define   G_008F30_ANISO_BIAS(x)                                      (((x) >> 21) & 0x3F)
+#define   C_008F30_ANISO_BIAS                                         0xF81FFFFF
 #define   S_008F30_TRUNC_COORD(x)                                     (((unsigned)(x) & 0x1) << 27)
 #define   G_008F30_TRUNC_COORD(x)                                     (((x) >> 27) & 0x1)
 #define   C_008F30_TRUNC_COORD                                        0xF7FFFFFF