vrend: Implement seamless cube maps

This was previously ignored.

Along with the mesa patch, this fixes ~100 dEQP tests:
dEQP-GLES3.functional.texture.filtering.cube.*

Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Stéphane Marchesin 7 years ago committed by Dave Airlie
parent be996c7dde
commit a6a51a2e53
  1. 1
      src/virgl_protocol.h
  2. 1
      src/vrend_decode.c
  3. 5
      src/vrend_renderer.c

@ -330,6 +330,7 @@ enum virgl_context_cmd {
#define VIRGL_OBJ_SAMPLE_STATE_S0_MAG_IMG_FILTER(x) (((x) & 0x3) << 13) #define VIRGL_OBJ_SAMPLE_STATE_S0_MAG_IMG_FILTER(x) (((x) & 0x3) << 13)
#define VIRGL_OBJ_SAMPLE_STATE_S0_COMPARE_MODE(x) (((x) & 0x1) << 15) #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_COMPARE_FUNC(x) (((x) & 0x7) << 16)
#define VIRGL_OBJ_SAMPLE_STATE_S0_SEAMLESS_CUBE_MAP(x) (((x) & 0x1) << 19)
#define VIRGL_OBJ_SAMPLER_STATE_LOD_BIAS 3 #define VIRGL_OBJ_SAMPLER_STATE_LOD_BIAS 3
#define VIRGL_OBJ_SAMPLER_STATE_MIN_LOD 4 #define VIRGL_OBJ_SAMPLER_STATE_MIN_LOD 4

@ -594,6 +594,7 @@ static int vrend_decode_create_sampler_state(struct vrend_decode_ctx *ctx, uint3
state.mag_img_filter = (tmp >> 13) & 0x3; state.mag_img_filter = (tmp >> 13) & 0x3;
state.compare_mode = (tmp >> 15) & 0x1; state.compare_mode = (tmp >> 15) & 0x1;
state.compare_func = (tmp >> 16) & 0x7; state.compare_func = (tmp >> 16) & 0x7;
state.seamless_cube_map = (tmp >> 19) & 0x1;
state.lod_bias = uif(get_buf_entry(ctx, VIRGL_OBJ_SAMPLER_STATE_LOD_BIAS)); state.lod_bias = uif(get_buf_entry(ctx, VIRGL_OBJ_SAMPLER_STATE_LOD_BIAS));
state.min_lod = uif(get_buf_entry(ctx, VIRGL_OBJ_SAMPLER_STATE_MIN_LOD)); state.min_lod = uif(get_buf_entry(ctx, VIRGL_OBJ_SAMPLER_STATE_MIN_LOD));

@ -1287,6 +1287,7 @@ int vrend_create_sampler_state(struct vrend_context *ctx,
glSamplerParameterf(state->id, GL_TEXTURE_MAX_LOD, templ->max_lod); glSamplerParameterf(state->id, GL_TEXTURE_MAX_LOD, templ->max_lod);
glSamplerParameteri(state->id, GL_TEXTURE_COMPARE_MODE, templ->compare_mode ? GL_COMPARE_R_TO_TEXTURE : GL_NONE); glSamplerParameteri(state->id, GL_TEXTURE_COMPARE_MODE, templ->compare_mode ? GL_COMPARE_R_TO_TEXTURE : GL_NONE);
glSamplerParameteri(state->id, GL_TEXTURE_COMPARE_FUNC, GL_NEVER + templ->compare_func); glSamplerParameteri(state->id, GL_TEXTURE_COMPARE_FUNC, GL_NEVER + templ->compare_func);
glSamplerParameteri(state->id, GL_TEXTURE_CUBE_MAP_SEAMLESS, templ->seamless_cube_map);
if (vrend_state.use_gles) { if (vrend_state.use_gles) {
if (templ->lod_bias != 0.0f) { if (templ->lod_bias != 0.0f) {
report_gles_warn(ctx, GLES_WARN_LOD_BIAS, 0); report_gles_warn(ctx, GLES_WARN_LOD_BIAS, 0);
@ -3874,6 +3875,10 @@ static void vrend_apply_sampler_state(struct vrend_context *ctx,
glTexParameteri(target, GL_TEXTURE_COMPARE_MODE, state->compare_mode ? GL_COMPARE_R_TO_TEXTURE : GL_NONE); glTexParameteri(target, GL_TEXTURE_COMPARE_MODE, state->compare_mode ? GL_COMPARE_R_TO_TEXTURE : GL_NONE);
if (tex->state.compare_func != state->compare_func || set_all) if (tex->state.compare_func != state->compare_func || set_all)
glTexParameteri(target, GL_TEXTURE_COMPARE_FUNC, GL_NEVER + state->compare_func); glTexParameteri(target, GL_TEXTURE_COMPARE_FUNC, GL_NEVER + state->compare_func);
if (state->seamless_cube_map)
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
else
glDisable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
if (memcmp(&tex->state.border_color, &state->border_color, 16) || set_all) if (memcmp(&tex->state.border_color, &state->border_color, 16) || set_all)
glTexParameterIuiv(target, GL_TEXTURE_BORDER_COLOR, state->border_color.ui); glTexParameterIuiv(target, GL_TEXTURE_BORDER_COLOR, state->border_color.ui);

Loading…
Cancel
Save