virgl: add support for anisotropic texture filtering

This is the guest side for adding correct anisotropic filtering support

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11944>
This commit is contained in:
Dave Airlie
2021-07-19 06:36:01 +10:00
committed by Marge Bot
parent e831c4a537
commit 2116a4f5cc
4 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -949,7 +949,8 @@ int virgl_encode_sampler_state(struct virgl_context *ctx,
VIRGL_OBJ_SAMPLE_STATE_S0_MAG_IMG_FILTER(state->mag_img_filter) |
VIRGL_OBJ_SAMPLE_STATE_S0_COMPARE_MODE(state->compare_mode) |
VIRGL_OBJ_SAMPLE_STATE_S0_COMPARE_FUNC(state->compare_func) |
VIRGL_OBJ_SAMPLE_STATE_S0_SEAMLESS_CUBE_MAP(state->seamless_cube_map);
VIRGL_OBJ_SAMPLE_STATE_S0_SEAMLESS_CUBE_MAP(state->seamless_cube_map) |
VIRGL_OBJ_SAMPLE_STATE_S0_MAX_ANISOTROPY((int)(state->max_anisotropy));
virgl_encoder_write_dword(ctx->cbuf, tmp);
virgl_encoder_write_dword(ctx->cbuf, fui(state->lod_bias));
+2 -2
View File
@@ -82,7 +82,7 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_VERTEX_SHADER_SATURATE:
return 1;
case PIPE_CAP_ANISOTROPIC_FILTER:
return 0;
return vscreen->caps.caps.v2.max_anisotropy > 1.0;
case PIPE_CAP_POINT_SPRITE:
return 1;
case PIPE_CAP_MAX_RENDER_TARGETS:
@@ -460,7 +460,7 @@ virgl_get_paramf(struct pipe_screen *screen, enum pipe_capf param)
case PIPE_CAPF_MAX_POINT_WIDTH_AA:
return vscreen->caps.caps.v2.max_smooth_point_size;
case PIPE_CAPF_MAX_TEXTURE_ANISOTROPY:
return 16.0;
return vscreen->caps.caps.v2.max_anisotropy;
case PIPE_CAPF_MAX_TEXTURE_LOD_BIAS:
return vscreen->caps.caps.v2.max_texture_lod_bias;
case PIPE_CAPF_MIN_CONSERVATIVE_RASTER_DILATE:
+1
View File
@@ -597,6 +597,7 @@ struct virgl_caps_v2 {
uint32_t capability_bits_v2;
uint32_t max_video_memory;
char renderer[64];
float max_anisotropy;
};
union virgl_caps {
+1
View File
@@ -370,6 +370,7 @@ enum virgl_context_cmd {
#define VIRGL_OBJ_SAMPLE_STATE_S0_COMPARE_MODE(x) (((x) & 0x1) << 15)
#define VIRGL_OBJ_SAMPLE_STATE_S0_COMPARE_FUNC(x) (((x) & 0x7) << 16)
#define VIRGL_OBJ_SAMPLE_STATE_S0_SEAMLESS_CUBE_MAP(x) (((x) & 0x1) << 19)
#define VIRGL_OBJ_SAMPLE_STATE_S0_MAX_ANISOTROPY(x) (((x & 0x3f)) << 20)
#define VIRGL_OBJ_SAMPLER_STATE_LOD_BIAS 3
#define VIRGL_OBJ_SAMPLER_STATE_MIN_LOD 4