[virglrenderer-devel] [PATCH] vrend: Implement seamless cube maps

Stéphane Marchesin marcheu at chromium.org
Sat Mar 17 02:15:06 UTC 2018


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 at chromium.org>
---
 src/virgl_protocol.h | 1 +
 src/vrend_decode.c   | 1 +
 src/vrend_renderer.c | 5 +++++
 3 files changed, 7 insertions(+)

diff --git a/src/virgl_protocol.h b/src/virgl_protocol.h
index 7688ac5..5dc2874 100644
--- a/src/virgl_protocol.h
+++ b/src/virgl_protocol.h
@@ -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_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_SAMPLER_STATE_LOD_BIAS 3
 #define VIRGL_OBJ_SAMPLER_STATE_MIN_LOD 4
diff --git a/src/vrend_decode.c b/src/vrend_decode.c
index 6112bd8..605bee6 100644
--- a/src/vrend_decode.c
+++ b/src/vrend_decode.c
@@ -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.compare_mode = (tmp >> 15) & 0x1;
    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.min_lod = uif(get_buf_entry(ctx, VIRGL_OBJ_SAMPLER_STATE_MIN_LOD));
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 68bc932..4efba93 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -1287,6 +1287,7 @@ int vrend_create_sampler_state(struct vrend_context *ctx,
       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_FUNC, GL_NEVER + templ->compare_func);
+      glSamplerParameteri(state->id, GL_TEXTURE_CUBE_MAP_SEAMLESS, templ->seamless_cube_map);
       if (vrend_state.use_gles) {
          if (templ->lod_bias != 0.0f) {
             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);
    if (tex->state.compare_func != state->compare_func || set_all)
       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)
       glTexParameterIuiv(target, GL_TEXTURE_BORDER_COLOR, state->border_color.ui);
-- 
2.16.2.804.g6dcf76e118-goog



More information about the virglrenderer-devel mailing list